Module org.elasticsearch.xcore
Class RSquared
java.lang.Object
org.elasticsearch.xpack.core.ml.dataframe.evaluation.regression.RSquared
- All Implemented Interfaces:
NamedWriteable
,Writeable
,org.elasticsearch.xcontent.ToXContent
,org.elasticsearch.xcontent.ToXContentObject
,EvaluationMetric
Calculates R-Squared between two known numerical fields.
equation: R-Squared = 1 - SSres/SStot
such that,
SSres = Σ(y - y´)^2, The residual sum of squares
SStot = Σ(y - y_mean)^2, The total sum of squares
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V extends Object>, Writeable.Writer<V extends Object>
-
Field Summary
FieldsFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.elasticsearch.core.Tuple<List<AggregationBuilder>,
List<PipelineAggregationBuilder>> aggs
(EvaluationParameters parameters, EvaluationFields fields) Builds the aggregation that collect required data to compute the metricboolean
static RSquared
fromXContent
(org.elasticsearch.xcontent.XContentParser parser) getName()
Returns the name of the metric (which may differ to the writeable name)Returns the set of fields that this metric requires in order to be calculated.Gets the evaluation result for this metric.int
hashCode()
void
process
(InternalAggregations aggs) Processes given aggregations as a step towards computing resultorg.elasticsearch.xcontent.XContentBuilder
toXContent
(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) void
writeTo
(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragment
-
Field Details
-
NAME
public static final org.elasticsearch.xcontent.ParseField NAME
-
-
Constructor Details
-
RSquared
-
RSquared
public RSquared()
-
-
Method Details
-
fromXContent
-
getName
Description copied from interface:EvaluationMetric
Returns the name of the metric (which may differ to the writeable name)- Specified by:
getName
in interfaceEvaluationMetric
-
getRequiredFields
Description copied from interface:EvaluationMetric
Returns the set of fields that this metric requires in order to be calculated.- Specified by:
getRequiredFields
in interfaceEvaluationMetric
-
aggs
public org.elasticsearch.core.Tuple<List<AggregationBuilder>,List<PipelineAggregationBuilder>> aggs(EvaluationParameters parameters, EvaluationFields fields) Description copied from interface:EvaluationMetric
Builds the aggregation that collect required data to compute the metric- Specified by:
aggs
in interfaceEvaluationMetric
- Parameters:
parameters
- settings that may be needed by aggregationsfields
- fields that may be needed by aggregations- Returns:
- the aggregations required to compute the metric
-
process
Description copied from interface:EvaluationMetric
Processes given aggregations as a step towards computing result- Specified by:
process
in interfaceEvaluationMetric
- Parameters:
aggs
- aggregations fromSearchResponse
-
getResult
Description copied from interface:EvaluationMetric
Gets the evaluation result for this metric.- Specified by:
getResult
in interfaceEvaluationMetric
- Returns:
Optional.empty()
if the result is not available yet,Optional.of(result)
otherwise
-
getWriteableName
- Specified by:
getWriteableName
in interfaceNamedWriteable
-
writeTo
- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceorg.elasticsearch.xcontent.ToXContent
- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-