Java Code Examples for org.neo4j.logging.Log#warn()

The following examples show how to use org.neo4j.logging.Log#warn() . 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 vote down vote up
@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 vote down vote up
@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: MillerLRModel.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@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 4
Source File: MillerLRModel.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@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 5
Source File: SimpleLRModel.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@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 6
Source File: SimpleLRModel.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@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;
    }
}