[release-12.1.1] Transformations: Rename Regression Analysis to Trendline' (#108815)
Transformations: Rename Regression Analysis to Trendline (#108631)
* Rename regression analysis transformation
* fix a couple translations
* remove extra word
* Fix tests
* Change frame name to use regression
(cherry picked from commit ffb8f4ea0c)
This commit is contained in:
@@ -1473,17 +1473,19 @@ If you have multiple types it will default to string type.
|
||||
|
||||
{{< figure src="/media/docs/grafana/transformations/screenshot-grafana-11-2-transpose-transformation.png" class="docs-image--no-shadow" max-width= "1100px" alt="Before and after transpose transformation" >}}
|
||||
|
||||
### Regression analysis
|
||||
### Trendline
|
||||
|
||||
Use this transformation to create a new data frame containing values predicted by a statistical model. This is useful for finding a trend in chaotic data. It works by fitting a mathematical function to the data, using either linear or polynomial regression. The data frame can then be used in a visualization to display a trendline.
|
||||
|
||||
There are two different models:
|
||||
|
||||
- **Linear regression** - Fits a linear function to the data.
|
||||
- **Linear** - Fits a linear function to the data.
|
||||
{{< figure src="/static/img/docs/transformations/linear-regression.png" class="docs-image--no-shadow" max-width= "1100px" alt="A time series visualization with a straight line representing the linear function" >}}
|
||||
- **Polynomial regression** - Fits a polynomial function to the data.
|
||||
- **Polynomial** - Fits a polynomial function to the data.
|
||||
{{< figure src="/static/img/docs/transformations/polynomial-regression.png" class="docs-image--no-shadow" max-width= "1100px" alt="A time series visualization with a curved line representing the polynomial function" >}}
|
||||
|
||||
> **Note:** This transformation was previously called regression analysis.
|
||||
|
||||
[Table panel]: ref:table-panel
|
||||
[Calculation types]: ref:calculation-types
|
||||
[sparkline cell type]: ref:sparkline-cell-type
|
||||
|
||||
@@ -1576,25 +1576,27 @@ ${buildImageContent(
|
||||
},
|
||||
},
|
||||
regression: {
|
||||
name: 'Regression analysis',
|
||||
name: 'Trendline',
|
||||
getHelperDocs: function (imageRenderType: ImageRenderType = ImageRenderType.ShortcodeFigure) {
|
||||
return `
|
||||
Use this transformation to create a new data frame containing values predicted by a statistical model. This is useful for finding a trend in chaotic data. It works by fitting a mathematical function to the data, using either linear or polynomial regression. The data frame can then be used in a visualization to display a trendline.
|
||||
|
||||
There are two different models:
|
||||
|
||||
- **Linear regression** - Fits a linear function to the data.
|
||||
- **Linear** - Fits a linear function to the data.
|
||||
${buildImageContent(
|
||||
'/static/img/docs/transformations/linear-regression.png',
|
||||
imageRenderType,
|
||||
'A time series visualization with a straight line representing the linear function'
|
||||
)}
|
||||
- **Polynomial regression** - Fits a polynomial function to the data.
|
||||
- **Polynomial** - Fits a polynomial function to the data.
|
||||
${buildImageContent(
|
||||
'/static/img/docs/transformations/polynomial-regression.png',
|
||||
imageRenderType,
|
||||
'A time series visualization with a curved line representing the polynomial function'
|
||||
)}
|
||||
|
||||
> **Note:** This transformation was previously called regression analysis.
|
||||
`;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
|
||||
import { ModelType, RegressionTransformer, RegressionTransformerOptions } from './regression';
|
||||
|
||||
describe('Regression transformation', () => {
|
||||
describe('Trendline transformation', () => {
|
||||
it('it should predict a linear regression to exactly fit the data when the data is f(x) = x', () => {
|
||||
const source = [
|
||||
toDataFrame({
|
||||
@@ -45,7 +45,7 @@ describe('Regression transformation', () => {
|
||||
name: 'Linear regression',
|
||||
fields: [
|
||||
{ name: 'time', type: FieldType.time, values: [0, 1, 2, 3, 4, 5], config: {} },
|
||||
{ name: 'value predicted', type: FieldType.number, values: [0, 1, 2, 3, 4, 5], config: {} },
|
||||
{ name: 'value', type: FieldType.number, values: [0, 1, 2, 3, 4, 5], config: {} },
|
||||
],
|
||||
length: 6,
|
||||
}),
|
||||
@@ -86,7 +86,7 @@ describe('Regression transformation', () => {
|
||||
name: 'Linear regression',
|
||||
fields: [
|
||||
{ name: 'time', type: FieldType.time, values: [0, 1, 2, 3, 4, 5], config: {} },
|
||||
{ name: 'value predicted', type: FieldType.number, values: [1, 1, 1, 1, 1, 1], config: {} },
|
||||
{ name: 'value', type: FieldType.number, values: [1, 1, 1, 1, 1, 1], config: {} },
|
||||
],
|
||||
length: 6,
|
||||
}),
|
||||
|
||||
@@ -37,7 +37,7 @@ export const DEGREES = [
|
||||
|
||||
export const RegressionTransformer: SynchronousDataTransformerInfo<RegressionTransformerOptions> = {
|
||||
id: DataTransformerID.regression,
|
||||
name: 'Regression analysis',
|
||||
name: 'Trendline',
|
||||
description: 'Create a new data frame containing values predicted by a statistical model.',
|
||||
operator: (options, ctx) => (source) =>
|
||||
source.pipe(map((data) => RegressionTransformer.transformer(options, ctx)(data))),
|
||||
@@ -126,7 +126,7 @@ export const RegressionTransformer: SynchronousDataTransformerInfo<RegressionTra
|
||||
fields: [
|
||||
{ name: xField.name, type: xField.type, values: predictionPoints, config: {} },
|
||||
{
|
||||
name: `${getFieldDisplayName(yField, predictFromFrame, frames)} predicted`,
|
||||
name: `${getFieldDisplayName(yField, predictFromFrame, frames)}`,
|
||||
type: yField.type,
|
||||
values: predictionPoints.map((x) => result.predict(x - normalizationSubtrahend)),
|
||||
config: {},
|
||||
|
||||
@@ -8665,9 +8665,9 @@
|
||||
"type": {
|
||||
"loki": {
|
||||
"indexed-label_one": "Indexed label",
|
||||
"indexed-label_other": "Indexed labels",
|
||||
"indexed-label_other": "Indexed label",
|
||||
"parsedl-label_one": "Parsed field",
|
||||
"parsedl-label_other": "Parsed fields",
|
||||
"parsedl-label_other": "Parsed field",
|
||||
"structured-metadata_one": "Structured metadata",
|
||||
"structured-metadata_other": "Structured metadata"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user