@Test(expected = CardinalityException.class) public void testPredictOnAnObservationWithWrongCardinality() { Vector weights = new DenseVector(new double[] {2.0, 3.0}); LogisticRegressionModel mdl = new LogisticRegressionModel(weights, 1.0); Vector observation = new DenseVector(new double[] {1.0}); mdl.predict(observation); }
@Override public Double predict(Vector input) { final double res = sigmoid(input.dot(weights) + intercept); if (isKeepingRawLabels) return res; else return res - threshold > 0 ? 1.0 : 0; }
LogisticRegressionModel implements IgniteModel<Vector, Double>, Exportable<LogisticRegressionModel>, Serializable { @Override public Double predict(Vector input) { final double res = sigmoid(input.dot(weights) + intercept); if (isKeepingRawLabels) return res; else return res - threshold > 0 ? 1.0 : 0; } }
LogisticRegressionModel implements IgniteModel<Vector, Double>, Exportable<LogisticRegressionModel>, Serializable { @Override public Double predict(Vector input) { final double res = sigmoid(input.dot(weights) + intercept); if (isKeepingRawLabels) return res; else return res - threshold > 0 ? 1.0 : 0; } LogisticRegressionModel(Vector weights, double intercept); }
LogisticRegressionModel implements IgniteModel<Vector, Double>, Exportable<LogisticRegressionModel>, Serializable { @Override public Double predict(Vector input) { final double res = sigmoid(input.dot(weights) + intercept); if (isKeepingRawLabels) return res; else return res - threshold > 0 ? 1.0 : 0; } LogisticRegressionModel(Vector weights, double intercept); LogisticRegressionModel withRawLabels(boolean isKeepingRawLabels); LogisticRegressionModel withThreshold(double threshold); LogisticRegressionModel withWeights(Vector weights); LogisticRegressionModel withIntercept(double intercept); boolean isKeepingRawLabels(); double threshold(); Vector weights(); double intercept(); @Override Double predict(Vector input); @Override void saveModel(Exporter<LogisticRegressionModel, P> exporter, P path); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override String toString(boolean pretty); }
LogisticRegressionModel implements IgniteModel<Vector, Double>, Exportable<LogisticRegressionModel>, Serializable { @Override public Double predict(Vector input) { final double res = sigmoid(input.dot(weights) + intercept); if (isKeepingRawLabels) return res; else return res - threshold > 0 ? 1.0 : 0; } LogisticRegressionModel(Vector weights, double intercept); LogisticRegressionModel withRawLabels(boolean isKeepingRawLabels); LogisticRegressionModel withThreshold(double threshold); LogisticRegressionModel withWeights(Vector weights); LogisticRegressionModel withIntercept(double intercept); boolean isKeepingRawLabels(); double threshold(); Vector weights(); double intercept(); @Override Double predict(Vector input); @Override void saveModel(Exporter<LogisticRegressionModel, P> exporter, P path); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override String toString(boolean pretty);  }