Skip to content

Commit

Permalink
Remove nTemplate attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Darius Morawiec committed Oct 17, 2017
1 parent 3c57a06 commit 29412ab
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@
" private double[][] X;\n",
" private int[] y;\n",
"\n",
" public KNeighborsClassifier(int nNeighbors, int nTemplates, int nClasses, double power, double[][] X, int[] y) {\n",
" public KNeighborsClassifier(int nNeighbors, int nClasses, double power, double[][] X, int[] y) {\n",
" this.nNeighbors = nNeighbors;\n",
" this.nTemplates = nTemplates;\n",
" this.nTemplates = y.length;\n",
" this.nClasses = nClasses;\n",
" this.power = power;\n",
" this.X = X;\n",
Expand Down Expand Up @@ -198,7 +198,7 @@
" int[] y = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};\n",
"\n",
" // Prediction:\n",
" KNeighborsClassifier clf = new KNeighborsClassifier(3, 150, 3, 2, X, y);\n",
" KNeighborsClassifier clf = new KNeighborsClassifier(3, 3, 2, X, y);\n",
" int estimation = clf.predict(features);\n",
" System.out.println(estimation);\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class KNeighborsClassifier {
private double[][] X;
private int[] y;
public KNeighborsClassifier(int nNeighbors, int nTemplates, int nClasses, double power, double[][] X, int[] y) {
public KNeighborsClassifier(int nNeighbors, int nClasses, double power, double[][] X, int[] y) {
this.nNeighbors = nNeighbors;
this.nTemplates = nTemplates;
this.nTemplates = y.length;
this.nClasses = nClasses;
this.power = power;
this.X = X;
Expand Down Expand Up @@ -122,7 +122,7 @@ class KNeighborsClassifier {
int[] y = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
// Prediction:
KNeighborsClassifier clf = new KNeighborsClassifier(3, 150, 3, 2, X, y);
KNeighborsClassifier clf = new KNeighborsClassifier(3, 3, 2, X, y);
int estimation = clf.predict(features);
System.out.println(estimation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"var KNeighborsClassifier = function(nNeighbors, nTemplates, nClasses, power, X, y) {\n",
"var KNeighborsClassifier = function(nNeighbors, nClasses, power, X, y) {\n",
"\n",
" this.nNeighbors = nNeighbors;\n",
" this.nTemplates = nTemplates;\n",
" this.nTemplates = y.length;\n",
" this.nClasses = nClasses;\n",
" this.power = power;\n",
" this.X = X;\n",
Expand Down Expand Up @@ -179,7 +179,7 @@
" var y = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2];\n",
"\n",
" // Estimator:\n",
" var clf = new KNeighborsClassifier(3, 150, 3, 2, X, y);\n",
" var clf = new KNeighborsClassifier(3, 3, 2, X, y);\n",
" var prediction = clf.predict(features);\n",
" console.log(prediction);\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
print(output)

"""
var KNeighborsClassifier = function(nNeighbors, nTemplates, nClasses, power, X, y) {
var KNeighborsClassifier = function(nNeighbors, nClasses, power, X, y) {
this.nNeighbors = nNeighbors;
this.nTemplates = nTemplates;
this.nTemplates = y.length;
this.nClasses = nClasses;
this.power = power;
this.X = X;
Expand Down Expand Up @@ -103,7 +103,7 @@
var y = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2];
// Estimator:
var clf = new KNeighborsClassifier(3, 150, 3, 2, X, y);
var clf = new KNeighborsClassifier(3, 3, 2, X, y);
var prediction = clf.predict(features);
console.log(prediction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class {class_name} {{
private double[][] X;
private int[] y;

public {class_name}(int nNeighbors, int nTemplates, int nClasses, double power, double[][] X, int[] y) {{
public {class_name}(int nNeighbors, int nClasses, double power, double[][] X, int[] y) {{
this.nNeighbors = nNeighbors;
this.nTemplates = nTemplates;
this.nTemplates = y.length;
this.nClasses = nClasses;
this.power = power;
this.X = X;
Expand Down Expand Up @@ -43,7 +43,7 @@ class {class_name} {{
{y}

// Prediction:
{class_name} clf = new {class_name}({n_neighbors}, {n_templates}, {n_classes}, {power}, X, y);
{class_name} clf = new {class_name}({n_neighbors}, {n_classes}, {power}, X, y);
int estimation = clf.{method_name}(features);
System.out.println(estimation);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var {class_name} = function(nNeighbors, nTemplates, nClasses, power, X, y) {{
var {class_name} = function(nNeighbors, nClasses, power, X, y) {{

this.nNeighbors = nNeighbors;
this.nTemplates = nTemplates;
this.nTemplates = y.length;
this.nClasses = nClasses;
this.power = power;
this.X = X;
Expand All @@ -27,7 +27,7 @@ if (typeof process !== 'undefined' && typeof process.argv !== 'undefined') {{
{y}

// Estimator:
var clf = new {class_name}({n_neighbors}, {n_templates}, {n_classes}, {power}, X, y);
var clf = new {class_name}({n_neighbors}, {n_classes}, {power}, X, y);
var prediction = clf.{method_name}(features);
console.log(prediction);

Expand Down

0 comments on commit 29412ab

Please sign in to comment.