Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Daniels first batch of .cs examples
- Loading branch information
Soeren Sonnenburg
committed
Aug 28, 2011
1 parent
c5ea1a3
commit 04d6769
Showing
10 changed files
with
304 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
examples/undocumented/csharp_modular/distance_canberra_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
public class distance_canberra_modular { | ||
public static void Main() { | ||
|
||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
CanberraMetric distance = new CanberraMetric(feats_train, feats_train); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
examples/undocumented/csharp_modular/distance_chebyshew_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
public class distance_chebyshew_modular { | ||
public static void Main() { | ||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
ChebyshewMetric distance = new ChebyshewMetric(feats_train, feats_train); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} | ||
|
29 changes: 29 additions & 0 deletions
29
examples/undocumented/csharp_modular/distance_chisquare_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
|
||
public class distance_chisquare_modular { | ||
public static void Main() { | ||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
ChiSquareDistance distance = new ChiSquareDistance(feats_train, feats_train); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
examples/undocumented/csharp_modular/distance_cosine_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
|
||
public class distance_cosine_modular { | ||
public static void Main() { | ||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
CosineDistance distance = new CosineDistance(feats_train, feats_train); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
examples/undocumented/csharp_modular/distance_geodesic_modular (1).cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
public class distance_geodesic_modular { | ||
public static void Main() { | ||
|
||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
GeodesicMetric distance = new GeodesicMetric(feats_train, feats_train); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
examples/undocumented/csharp_modular/distance_geodesic_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
|
||
public class distance_geodesic_modular { | ||
public static void Main() { | ||
|
||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
GeodesicMetric distance = new GeodesicMetric(feats_train, feats_train); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
examples/undocumented/csharp_modular/distance_jensen_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
|
||
public class distance_jensen_modular { | ||
public static void Main() { | ||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
JensenMetric distance = new JensenMetric(feats_train, feats_train); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
examples/undocumented/csharp_modular/distance_minkowski_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
|
||
public class distance_minkowski_modular { | ||
public static void Main() { | ||
|
||
modshogun.init_shogun_with_defaults(); | ||
double k = 3; | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
MinkowskiMetric distance = new MinkowskiMetric(feats_train, feats_train, k); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} | ||
|
32 changes: 32 additions & 0 deletions
32
examples/undocumented/csharp_modular/distance_normsquared_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
|
||
public class distance_normsquared_modular { | ||
public static void Main() { | ||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
EuclidianDistance distance = new EuclidianDistance(feats_train, feats_train); | ||
distance.set_disable_sqrt(true); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
examples/undocumented/csharp_modular/distance_tanimoto_modular.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
|
||
public class distance_tanimoto_modular { | ||
public static void Main() { | ||
|
||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat"); | ||
double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat"); | ||
|
||
RealFeatures feats_train = new RealFeatures(traindata_real); | ||
RealFeatures feats_test = new RealFeatures(testdata_real); | ||
|
||
TanimotoDistance distance = new TanimotoDistance(feats_train, feats_train); | ||
|
||
double[,] dm_train = distance.get_distance_matrix(); | ||
distance.init(feats_train, feats_test); | ||
double[,] dm_test = distance.get_distance_matrix(); | ||
|
||
|
||
foreach(double item in dm_train) { | ||
Console.Write(item); | ||
} | ||
|
||
foreach(double item in dm_test) { | ||
Console.Write(item); | ||
} | ||
|
||
|
||
modshogun.exit_shogun(); | ||
} | ||
} | ||
|