mse
Bases: metric
The mse evaluation metric.
The class inherits from the base metric class.
...
Attributes:
Name | Type | Description |
---|---|---|
name |
str, default = 'mean_squared_error'
|
Name of the mse evaluation metric. |
metric |
object
|
The accuracy evaluation metric calculation method. |
Methods:
Name | Description |
---|---|
__init__ |
It performs the initialization of the mse evaluation metric. Its internal metric calculation method is declared to be mean_squared_error from sklearn. |
evaluate |
It implements the abstract evaluate method declared in the base metric class. The method calculates the mse score of the inputs. |
__call__ |
It reimplements the abstract callable method declared in the base metric class. |
Source code in tinybig/metric/regression_metric.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
__call__(y_true, y_score, *args, **kwargs)
The callable method of the mse metric class.
It re-implements the build-in callable method. This method will call the evaluate method to calculate the mse of the input parameters.
Examples:
Binary classification f1 score
>>> from tinybig.metric import mse as mse_metric
>>> mse_metric = mse_metric(name='mse_metric')
>>> y_true = [[0.5, 1],[-1, 1],[7, -6]]
>>> y_score = [[0, 2],[-1, 2],[8, -5]]
>>> mse_metric.evaluate(y_true=y_true, y_score=y_score)
0.708...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_true
|
list
|
The list of true labels of data instances. |
required |
y_score
|
list
|
The list of predicted scores of data instances. |
required |
args
|
Other parameters |
()
|
|
kwargs
|
Other parameters |
{}
|
Returns:
Type | Description |
---|---|
float | list
|
The calculated mse score of the input parameters. |
Source code in tinybig/metric/regression_metric.py
__init__(name='mean_squared_error')
The initialization method of the mse evaluation metric.
It initializes a mse evaluation metric object based on the input metric name. This method will also call the initialization method of the base class as well. The metric calculation approach is initialized as the sklearn.metrics.mean_squared_error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
The name of the evaluation metric. |
'mean_squared_error'
|
Source code in tinybig/metric/regression_metric.py
evaluate(y_true, y_score, *args, **kwargs)
The evaluate method of the mse evaluation metric class.
It calculates the mse scores based on the provided input parameters "y_true" and "y_score". The method will return calculated accuracy score as the output.
Examples:
>>> from tinybig.metric import mse as mse_metric
>>> mse_metric = mse_metric(name='mse_metric')
>>> y_true = [3, -0.5, 2, 7]
>>> y_score = [2.5, 0.0, 2, 8]
>>> mse_metric.evaluate(y_true=y_true, y_score=y_score)
0.375
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_true
|
list
|
The list of true labels of data instances. |
required |
y_score
|
list
|
The list of predicted scores of data instances. |
required |
args
|
Other parameters |
()
|
|
kwargs
|
Other parameters |
{}
|
Returns:
Type | Description |
---|---|
float | list
|
The calculated mse score of the input parameters. |