235 lines
7.9 KiB
Plaintext
235 lines
7.9 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 1,
|
||
"outputs": [],
|
||
"source": [
|
||
"import pandas as pd"
|
||
],
|
||
"metadata": {
|
||
"collapsed": false,
|
||
"pycharm": {
|
||
"name": "#%%\n"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 2,
|
||
"outputs": [],
|
||
"source": [
|
||
"data = pd.read_csv('./供热测试结果.csv')"
|
||
],
|
||
"metadata": {
|
||
"collapsed": false,
|
||
"pycharm": {
|
||
"name": "#%%\n"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 3,
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": " 0 1\n0 0.072858 0.072700\n1 0.073347 0.075045\n2 0.082159 0.080671\n3 0.084120 0.081944\n4 0.065845 0.066739\n.. ... ...\n408 0.066066 0.066927\n409 0.084331 0.082709\n410 0.069216 0.069256\n411 0.065259 0.066203\n412 0.069608 0.071754\n\n[413 rows x 2 columns]",
|
||
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>0</th>\n <th>1</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0.072858</td>\n <td>0.072700</td>\n </tr>\n <tr>\n <th>1</th>\n <td>0.073347</td>\n <td>0.075045</td>\n </tr>\n <tr>\n <th>2</th>\n <td>0.082159</td>\n <td>0.080671</td>\n </tr>\n <tr>\n <th>3</th>\n <td>0.084120</td>\n <td>0.081944</td>\n </tr>\n <tr>\n <th>4</th>\n <td>0.065845</td>\n <td>0.066739</td>\n </tr>\n <tr>\n <th>...</th>\n <td>...</td>\n <td>...</td>\n </tr>\n <tr>\n <th>408</th>\n <td>0.066066</td>\n <td>0.066927</td>\n </tr>\n <tr>\n <th>409</th>\n <td>0.084331</td>\n <td>0.082709</td>\n </tr>\n <tr>\n <th>410</th>\n <td>0.069216</td>\n <td>0.069256</td>\n </tr>\n <tr>\n <th>411</th>\n <td>0.065259</td>\n <td>0.066203</td>\n </tr>\n <tr>\n <th>412</th>\n <td>0.069608</td>\n <td>0.071754</td>\n </tr>\n </tbody>\n</table>\n<p>413 rows × 2 columns</p>\n</div>"
|
||
},
|
||
"execution_count": 3,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"data"
|
||
],
|
||
"metadata": {
|
||
"collapsed": false,
|
||
"pycharm": {
|
||
"name": "#%%\n"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 4,
|
||
"outputs": [],
|
||
"source": [
|
||
"from sklearn.metrics import r2_score"
|
||
],
|
||
"metadata": {
|
||
"collapsed": false,
|
||
"pycharm": {
|
||
"name": "#%%\n"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 7,
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": "0.8483477508497194"
|
||
},
|
||
"execution_count": 7,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"r2_score(data.values[:,1], data.values[:,0])"
|
||
],
|
||
"metadata": {
|
||
"collapsed": false,
|
||
"pycharm": {
|
||
"name": "#%%\n"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 8,
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Help on function r2_score in module sklearn.metrics._regression:\n",
|
||
"\n",
|
||
"r2_score(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average')\n",
|
||
" :math:`R^2` (coefficient of determination) regression score function.\n",
|
||
" \n",
|
||
" Best possible score is 1.0 and it can be negative (because the\n",
|
||
" model can be arbitrarily worse). A constant model that always\n",
|
||
" predicts the expected value of y, disregarding the input features,\n",
|
||
" would get a :math:`R^2` score of 0.0.\n",
|
||
" \n",
|
||
" Read more in the :ref:`User Guide <r2_score>`.\n",
|
||
" \n",
|
||
" Parameters\n",
|
||
" ----------\n",
|
||
" y_true : array-like of shape (n_samples,) or (n_samples, n_outputs)\n",
|
||
" Ground truth (correct) target values.\n",
|
||
" \n",
|
||
" y_pred : array-like of shape (n_samples,) or (n_samples, n_outputs)\n",
|
||
" Estimated target values.\n",
|
||
" \n",
|
||
" sample_weight : array-like of shape (n_samples,), default=None\n",
|
||
" Sample weights.\n",
|
||
" \n",
|
||
" multioutput : {'raw_values', 'uniform_average', 'variance_weighted'}, array-like of shape (n_outputs,) or None, default='uniform_average'\n",
|
||
" \n",
|
||
" Defines aggregating of multiple output scores.\n",
|
||
" Array-like value defines weights used to average scores.\n",
|
||
" Default is \"uniform_average\".\n",
|
||
" \n",
|
||
" 'raw_values' :\n",
|
||
" Returns a full set of scores in case of multioutput input.\n",
|
||
" \n",
|
||
" 'uniform_average' :\n",
|
||
" Scores of all outputs are averaged with uniform weight.\n",
|
||
" \n",
|
||
" 'variance_weighted' :\n",
|
||
" Scores of all outputs are averaged, weighted by the variances\n",
|
||
" of each individual output.\n",
|
||
" \n",
|
||
" .. versionchanged:: 0.19\n",
|
||
" Default value of multioutput is 'uniform_average'.\n",
|
||
" \n",
|
||
" Returns\n",
|
||
" -------\n",
|
||
" z : float or ndarray of floats\n",
|
||
" The :math:`R^2` score or ndarray of scores if 'multioutput' is\n",
|
||
" 'raw_values'.\n",
|
||
" \n",
|
||
" Notes\n",
|
||
" -----\n",
|
||
" This is not a symmetric function.\n",
|
||
" \n",
|
||
" Unlike most other scores, :math:`R^2` score may be negative (it need not\n",
|
||
" actually be the square of a quantity R).\n",
|
||
" \n",
|
||
" This metric is not well-defined for single samples and will return a NaN\n",
|
||
" value if n_samples is less than two.\n",
|
||
" \n",
|
||
" References\n",
|
||
" ----------\n",
|
||
" .. [1] `Wikipedia entry on the Coefficient of determination\n",
|
||
" <https://en.wikipedia.org/wiki/Coefficient_of_determination>`_\n",
|
||
" \n",
|
||
" Examples\n",
|
||
" --------\n",
|
||
" >>> from sklearn.metrics import r2_score\n",
|
||
" >>> y_true = [3, -0.5, 2, 7]\n",
|
||
" >>> y_pred = [2.5, 0.0, 2, 8]\n",
|
||
" >>> r2_score(y_true, y_pred)\n",
|
||
" 0.948...\n",
|
||
" >>> y_true = [[0.5, 1], [-1, 1], [7, -6]]\n",
|
||
" >>> y_pred = [[0, 2], [-1, 2], [8, -5]]\n",
|
||
" >>> r2_score(y_true, y_pred,\n",
|
||
" ... multioutput='variance_weighted')\n",
|
||
" 0.938...\n",
|
||
" >>> y_true = [1, 2, 3]\n",
|
||
" >>> y_pred = [1, 2, 3]\n",
|
||
" >>> r2_score(y_true, y_pred)\n",
|
||
" 1.0\n",
|
||
" >>> y_true = [1, 2, 3]\n",
|
||
" >>> y_pred = [2, 2, 2]\n",
|
||
" >>> r2_score(y_true, y_pred)\n",
|
||
" 0.0\n",
|
||
" >>> y_true = [1, 2, 3]\n",
|
||
" >>> y_pred = [3, 2, 1]\n",
|
||
" >>> r2_score(y_true, y_pred)\n",
|
||
" -3.0\n",
|
||
"\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"help(r2_score)"
|
||
],
|
||
"metadata": {
|
||
"collapsed": false,
|
||
"pycharm": {
|
||
"name": "#%%\n"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": null,
|
||
"outputs": [],
|
||
"source": [],
|
||
"metadata": {
|
||
"collapsed": false,
|
||
"pycharm": {
|
||
"name": "#%%\n"
|
||
}
|
||
}
|
||
}
|
||
],
|
||
"metadata": {
|
||
"kernelspec": {
|
||
"display_name": "Python 3",
|
||
"language": "python",
|
||
"name": "python3"
|
||
},
|
||
"language_info": {
|
||
"codemirror_mode": {
|
||
"name": "ipython",
|
||
"version": 2
|
||
},
|
||
"file_extension": ".py",
|
||
"mimetype": "text/x-python",
|
||
"name": "python",
|
||
"nbconvert_exporter": "python",
|
||
"pygments_lexer": "ipython2",
|
||
"version": "2.7.6"
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 0
|
||
} |