using Accord.Statistics.Analysis;
public static void Main()
new[] { 2.5, 2.4, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 0.5, 0.7, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 2.2, 2.9, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 1.9, 2.2, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 3.1, 3.0, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 2.3, 2.7, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 2.0, 1.6, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 1.0, 1.1, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 1.5, 1.6, 1, 2, 3, 4, 5, 6, 7, 8 },
new[] { 1.1, 0.9, 1, 2, 3, 4, 5, 6, 7, 8 }
var pca = new PrincipalComponentAnalysis(PrincipalComponentMethod.Center);
double[][] finalData = pca.Transform(data);
Console.WriteLine("-------");
var scaled_finalData = Scale(finalData);
public static double[][] Scale(double[][] m){
for (int i = 0; i < m.GetLength(0); i++){
for (int j = 0; j < m[i].GetLength(0); j++){
m[i][j] = (m[i][j] - min_m)/(max_m - min_m);
public static void pr(double[][] m){
for (int i = 0; i < m.GetLength(0); i++){
for (int j = 0; j < m[i].GetLength(0); j++){
Console.Write(m[i][j] + ", ");