org.neo4j.logging.Log Java Examples
The following examples show how to use
org.neo4j.logging.Log.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleLRModel.java From ml-models with Apache License 2.0 | 6 votes |
@Override void addTest(List<Double> given, double expected, Log log) { if (dataInvalid(given)) log.warn("Data point " + given.toString() + ", " + Double.toString(expected) + " is not valid and so was not added to the testing data."); else { double fact1 = getNTest() + 1.0; double fact2 = getNTest() / fact1; double dy = expected - ybar; ybar += dy / fact1; double rdev = expected - R.getIntercept() - given.get(0) * R.getSlope(); sse += rdev * rdev; if (hasConstant()) sst += fact2 * dy * dy; else sst += expected * expected; nTest++; state = State.testing; } }
Example #2
Source File: SimpleLRModel.java From ml-models with Apache License 2.0 | 6 votes |
@Override void removeTest(List<Double> given, double expected, Log log) { if (nTest > 0) { if (dataInvalid(given)) log.warn("Data point " + given.toString() + ", " + Double.toString(expected) + " is not valid and so was not removed from the testing data."); else { double fact1 = nTest - 1; double fact2 = nTest / fact1; double dy = expected - ybar; ybar -= dy / fact1; double rdev = expected - R.getIntercept() - given.get(0) * R.getSlope(); sse -= rdev * rdev; sst -= fact2 * dy * dy; nTest--; state = State.testing; } } }
Example #3
Source File: InitBuilderTest.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Test public void shouldBuildCorrectProcedureInstance() { GraphDatabaseService db = mock(GraphDatabaseService.class); Log log = mock(Log.class); Optional<Init> result = new InitBuilder().withDb(db).withLog(log).build(); assertThat(result.isPresent(), is(true)); assertThat(result.get().db, is(db)); assertThat(result.get().log, is(log)); }
Example #4
Source File: GlsLRModel.java From ml-models with Apache License 2.0 | 5 votes |
@Override public void addTrain(List<Double> given, double expected, Log log) { if (given.size() != numVars) throw new IllegalArgumentException("incorrect number of variables in given."); data.add(given); response.add(expected); numObs += 1; this.state = State.training; }
Example #5
Source File: UpdateBuilderTest.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Test public void shouldBuildCorrectProcedureInstance() { GraphDatabaseService db = mock(GraphDatabaseService.class); Log log = mock(Log.class); Optional<Update> result = new UpdateBuilder().withDb(db).withLog(log).build(); assertThat(result.isPresent(), is(true)); assertThat(result.get().db, is(db)); assertThat(result.get().log, is(log)); }
Example #6
Source File: RollbackBuilderTest.java From neo4j-versioner-core with Apache License 2.0 | 5 votes |
@Test public void shouldBuildCorrectProcedureInstance() { GraphDatabaseService db = mock(GraphDatabaseService.class); Log log = mock(Log.class); Optional<Rollback> result = new RollbackBuilder().withDb(db).withLog(log).build(); assertThat(result.isPresent(), is(true)); assertThat(result.get().db, is(db)); assertThat(result.get().log, is(log)); }
Example #7
Source File: LRModel.java From ml-models with Apache License 2.0 | 5 votes |
void removeMany(List<List<Double>> given, List<Double> expected, String type, Log log) { if (given.size() != expected.size()) throw new IllegalArgumentException("Length of given does not match length of expected."); switch(type) { case "train": for (int i = 0; i < given.size(); i++) removeTrain(given.get(i), expected.get(i), log); break; case "test": for (int i = 0; i < given.size(); i++) removeTest(given.get(i), expected.get(i), log); break; default: throw new IllegalArgumentException("Cannot add data of unrecognized type: " + type); } }
Example #8
Source File: MillerLRModel.java From ml-models with Apache License 2.0 | 5 votes |
@Override void addTrain(List<Double> given, double expected, Log log) { if (dataInvalid(given)) log.warn("Data point " + given.toString() + ", " + Double.toString(expected) + " is not valid and so was not added to the training data."); else { double[] givenArr = LR.doubleListToArray(given); R.addObservation(givenArr, expected); if (state == State.testing || state == State.ready) resetTest(); state = State.training; } }
Example #9
Source File: LRModel.java From ml-models with Apache License 2.0 | 5 votes |
void remove(List<Double> given, double expected, String type, Log log) { switch(type) { case "train": removeTrain(given, expected, log); break; case "test": removeTest(given, expected, log); break; default: throw new IllegalArgumentException("Cannot remove data of unrecognized type: " + type); } }
Example #10
Source File: MillerLRModel.java From ml-models with Apache License 2.0 | 5 votes |
@Override void addTest(List<Double> given, double expected, Log log) { if (!(state == State.testing)) { clearTest(); train(); } if (dataInvalid(given)) log.warn("Data point " + given.toString() + ", " + Double.toString(expected) + " is not valid and so was not added to the testing data."); else { double fact1 = nTest + 1.0; double fact2 = nTest / fact1; double dy = expected - ybar; ybar += dy / fact1; double[] params = trained.getParameterEstimates(); double rdev = expected; if (hasConstant()) { rdev -= params[0]; for (int i = 1; i < params.length; i++) rdev -= params[i] * given.get(i - 1); sst += fact2 * dy * dy; } else { for (int i = 0; i < params.length; i++) rdev -= params[i] * given.get(i); sst += expected * expected; } sse += rdev * rdev; nTest++; state = State.testing; } }
Example #11
Source File: LRModel.java From ml-models with Apache License 2.0 | 5 votes |
void addMany(List<List<Double>> given, List<Double> expected, String type, Log log) { if (given.size() != expected.size()) throw new IllegalArgumentException("Length of given does not match length of expected."); switch(type) { case "train": for (int i = 0; i < given.size(); i++) addTrain(given.get(i), expected.get(i), log); break; case "test": for (int i = 0; i < given.size(); i++) addTest(given.get(i), expected.get(i), log); break; default: throw new IllegalArgumentException("Cannot add data of unrecognized type: " + type); } }
Example #12
Source File: SimpleLRModel.java From ml-models with Apache License 2.0 | 5 votes |
@Override void addTrain(List<Double> given, double expected, Log log) { if (dataInvalid(given)) log.warn("Data point " + given.toString() + ", " + Double.toString(expected) + " is not valid and so was not added to the training data."); else { R.addData(given.get(0), expected); if (state == State.testing || state == State.ready) resetTest(); state = State.training; } }
Example #13
Source File: SimpleLRModel.java From ml-models with Apache License 2.0 | 5 votes |
@Override protected void removeTrain(List<Double> input, double output, Log log) { if (dataInvalid(input)) log.warn("Data point " + input.toString() + ", " + Double.toString(output) + " is not valid and so was not added to the training data."); else { for (double x : input) R.removeData(x, output); if (state == State.testing || state == State.ready) resetTest(); state = State.training; } }
Example #14
Source File: OlsLRModel.java From ml-models with Apache License 2.0 | 5 votes |
@Override void addTrain(List<Double> given, double expected, Log log) { if (given.size() != numVars) throw new IllegalArgumentException("incorrect number of variables in given."); data.add(expected); data.addAll(given); numObs += 1; this.state = State.training; }
Example #15
Source File: LRModel.java From ml-models with Apache License 2.0 | 5 votes |
void add(List<Double> given, double expected, String type, Log log) { switch(type) { case "train": addTrain(given, expected, log); break; case "test": addTest(given, expected, log); break; default: throw new IllegalArgumentException("Cannot add data of unrecognized type: " + type); } }
Example #16
Source File: Algorithm.java From ml-models with Apache License 2.0 | 4 votes |
public ME withLog(Log log) { return withProgressLogger(ProgressLogger.wrap(log, getClass().getSimpleName())); }
Example #17
Source File: MillerLRModel.java From ml-models with Apache License 2.0 | 4 votes |
@Override void removeTest(List<Double> given, double expected, Log log) { throw new IllegalArgumentException("Cannot remove test data from multiple linear regression."); }
Example #18
Source File: MillerLRModel.java From ml-models with Apache License 2.0 | 4 votes |
@Override protected void removeTrain(List<Double> input, double output, Log log) { throw new IllegalArgumentException("Data cannot be removed from a multiple linear regression."); }
Example #19
Source File: DecisionTreeExpanderTwo.java From decision_trees_with_rules with MIT License | 4 votes |
public DecisionTreeExpanderTwo(Map<String, String> facts, Log log) { this.facts = facts; this.log = log; se.setReturnType(String.class); }
Example #20
Source File: OlsLRModel.java From ml-models with Apache License 2.0 | 2 votes |
@Override void removeTest(List<Double> input, double output, Log log) { }
Example #21
Source File: OlsLRModel.java From ml-models with Apache License 2.0 | 2 votes |
@Override void removeTrain(List<Double> input, double output, Log log) { }
Example #22
Source File: OlsLRModel.java From ml-models with Apache License 2.0 | 2 votes |
@Override void addTest(List<Double> given, double expected, Log log) { }
Example #23
Source File: GlsLRModel.java From ml-models with Apache License 2.0 | 2 votes |
@Override void removeTrain(List<Double> input, double output, Log log) { }
Example #24
Source File: CoreProcedureBuilder.java From neo4j-versioner-core with Apache License 2.0 | 2 votes |
/** * Adds a {@link Log} and returns the current builder * * @param log * @return this */ public CoreProcedureBuilder<T> withLog(Log log) { this.log = log; return this; }
Example #25
Source File: GlsLRModel.java From ml-models with Apache License 2.0 | 2 votes |
@Override void removeTest(List<Double> input, double output, Log log) { }
Example #26
Source File: GlsLRModel.java From ml-models with Apache License 2.0 | 2 votes |
@Override void addTest(List<Double> given, double expected, Log log) { }
Example #27
Source File: LRModel.java From ml-models with Apache License 2.0 | votes |
abstract void addTrain(List<Double> given, double expected, Log log);
Example #28
Source File: LRModel.java From ml-models with Apache License 2.0 | votes |
abstract void removeTrain(List<Double> given, double expected, Log log);
Example #29
Source File: LRModel.java From ml-models with Apache License 2.0 | votes |
abstract void addTest(List<Double> given, double expected, Log log);
Example #30
Source File: LRModel.java From ml-models with Apache License 2.0 | votes |
abstract void removeTest(List<Double> given, double expected, Log log);