Java Code Examples for org.neo4j.procedure.Mode#READ

The following examples show how to use org.neo4j.procedure.Mode#READ . 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: LR.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@Procedure(value = "regression.linear.create", mode = Mode.READ)
@Description("Initialize a linear regression model with 'name' of type 'framework' and store in static memory. " +
        "Indicate whether to include a constant term. Accepted frameworks are 'Simple' and 'Multiple'.")
public Stream<ModelResult> create(@Name("name") String model, @Name("framework") String framework,
                                  @Name(value="include constant term?", defaultValue="true") boolean constant,
                                  @Name(value="# of independent vars", defaultValue="1") Long numVars) {
    return Stream.of(LRModel.create(model, framework, constant, numVars.intValue()).asResult());
}
 
Example 2
Source File: LR.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@Procedure(value = "regression.linear.addM", mode = Mode.READ)
@Description("Void procedure which adds multiple observations (given[i], expected[i]) to 'model'. Indicate whether data is for " +
        "training or testing the model.")
public void addM(@Name("model") String model, @Name("given") List<List<Double>> given, @Name("expected") List<Double> expected,
                 @Name(value="type", defaultValue="train") String type) {
    LRModel.from(model).addMany(given, expected, type, log);
}
 
Example 3
Source File: LR.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@Procedure(value = "regression.linear.remove", mode = Mode.READ)
@Description("Void procedure which removes a single observation of type 'type' from 'model'. Throws runtime error if model is not of " +
        "framework 'Simple'.")
public void remove(@Name("model") String model, @Name("given") List<Double> given, @Name("expected") double expected,
                   @Name(value="type", defaultValue = "train") String type) {
    LRModel.from(model).remove(given, expected, type, log);
}
 
Example 4
Source File: LR.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@Procedure(value = "regression.linear.removeM", mode = Mode.READ)
@Description("Void procedure which removes multiple observations (given[i], expected[i]) from 'model'. Indicate whether to " +
        "remove data from training or testing dataset.")
public void removeM(@Name("model") String model, @Name("given") List<List<Double>> given, @Name("expected") List<Double> expected,
@Name(value = "type", defaultValue = "train") String type) {
    LRModel.from(model).removeMany(given, expected, type, log);
}
 
Example 5
Source File: LR.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@Procedure(value = "regression.linear.train", mode = Mode.READ)
@Description("Trains the model and returns stream containing the model's name (model), type (framework), whether " +
        "it containes a constant term (hasConstant), number of independent variables (numVars), state (state), " +
        "number of observations (N), and information (info).")
public Stream<ModelResult> train(@Name("model") String model) {
    return Stream.of(LRModel.from(model).train().asResult());
}
 
Example 6
Source File: LR.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@Procedure(value = "regression.linear.info", mode = Mode.READ)
@Description("Return a stream containing the model's name (model), type (framework), whether it containes a constant term " +
        "(hasConstant), number of independent variables (numVars), state (state), number of observations (N), and information " +
        "(info). If the model is in state 'ready' info will contain parameters and statistics about the trained model.")
public Stream<ModelResult> info(@Name("model") String model) {
    return Stream.of(LRModel.from(model).asResult());
}
 
Example 7
Source File: LR.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@Procedure(value = "regression.linear.delete", mode = Mode.READ)
@Description("Deletes 'model' from storage. Returns a stream containing the model's name (model), type (framework), " +
        "whether it containes a constant term (hasConstant), number of independent variables (numVars), state (state), " +
        "number of observations (N), and information (info).")
public Stream<ModelResult> delete(@Name("model") String model) {
    return Stream.of(LRModel.removeModel(model));
}
 
Example 8
Source File: LR.java    From ml-models with Apache License 2.0 5 votes vote down vote up
@Procedure(value = "regression.linear.load", mode = Mode.READ)
@Description("This procedure loads the model stored in data into the procedure's memory under the name 'model'. " +
        "The model must be of type 'Simple' and 'data' must be a byte array. Returns a stream containing the model's " +
        "name (model), type (framework), whether it containes a constant term (hasConstant), number of independent " +
        "variables (numVars), state (state), number of observations (N), and information (info).")
public Stream<ModelResult> load(@Name("model") String model, @Name("data") Object data, @Name("framework") String framework) {
    return Stream.of(LRModel.load(model, data, framework).asResult());
}
 
Example 9
Source File: LR.java    From ml-models with Apache License 2.0 4 votes vote down vote up
@Procedure(value = "regression.linear.clear", mode=Mode.READ)
@Description("If type is 'all' clear all data from 'model' and model returns to state 'created'. If type is 'test' only clear test data from 'model'.")
public Stream<ModelResult> clear(@Name("model") String model, @Name(value="type", defaultValue = "all") String type) {
    return Stream.of(LRModel.from(model).clear(type).asResult());
}
 
Example 10
Source File: LR.java    From ml-models with Apache License 2.0 4 votes vote down vote up
@Procedure(value = "regression.linear.add", mode = Mode.READ)
@Description("Void procedure which adds a single observation to the model. Indicate whether data is for training or testing the model.")
public void add(@Name("model") String model, @Name("given") List<Double> given, @Name("expected") double expected,
                @Name(value="type", defaultValue="train") String type) {
    LRModel.from(model).add(given, expected, type, log);
}
 
Example 11
Source File: LR.java    From ml-models with Apache License 2.0 4 votes vote down vote up
@Procedure(value = "regression.linear.copy", mode = Mode.READ)
@Description("Copies training data from model 'source' into model 'dest'.")
public Stream<ModelResult> copy(@Name("source") String source, @Name("dest") String dest) {
    return Stream.of(LRModel.from(dest).copy(source).asResult());
}
 
Example 12
Source File: LR.java    From ml-models with Apache License 2.0 4 votes vote down vote up
@Procedure(value = "regression.linear.test", mode = Mode.READ)
@Description("Tests the fit of the model on test data and returns statistics.")
public Stream<ModelResult> test(@Name("model") String model) {
    return Stream.of(LRModel.from(model).test().asResult());
}