markap14 commented on a change in pull request #3681: NIFI-6510 - Analytics framework URL: https://github.com/apache/nifi/pull/3681#discussion_r320940898
########## File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/analytics/models/SimpleRegression.java ########## @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.controller.status.analytics.models; + + +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Stream; + +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.math3.stat.regression.RegressionResults; +import org.apache.nifi.controller.status.analytics.StatusAnalyticsModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * <p> + * An implementation of the {@link StatusAnalyticsModel} that uses the SimpleRegression class from math for computation of regression. It only supports Bivariates + * for x,y (multiple predictors are not supported by SimpleRegression). Online learning is supported for collecting multiple samples at different points in time + * + * </p> + */ +public class SimpleRegression extends BivariateStatusAnalyticsModel { + + private static final Logger LOG = LoggerFactory.getLogger(SimpleRegression.class); + private final org.apache.commons.math3.stat.regression.SimpleRegression regression; + private final Boolean supportOnlineLearning; + private RegressionResults results; + + public SimpleRegression() { + this.regression = new org.apache.commons.math3.stat.regression.SimpleRegression(); Review comment: Probably best to use call to other constructor: `this(true);` as opposed to repeating the code. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
