yeah you got this chief
This commit is contained in:
@@ -1068,79 +1068,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 28,
|
||||
"execution_count": 56,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"<bound method NDFrame.head of Rank Name \\\n",
|
||||
"19 20.0 Grand Theft Auto V \n",
|
||||
"20 21.0 Grand Theft Auto V \n",
|
||||
"21 22.0 Brain Age: Train Your Brain in Minutes a Day \n",
|
||||
"24 25.0 Mario Kart 7 \n",
|
||||
"25 26.0 Pokemon Diamond / Pearl Version \n",
|
||||
"... ... ... \n",
|
||||
"55090 55091.0 Strafe \n",
|
||||
"55423 55424.0 Thumper \n",
|
||||
"55490 55491.0 Travis Strikes Again: No More Heroes \n",
|
||||
"55528 55529.0 TumbleSeed \n",
|
||||
"55653 55654.0 Wheels of Aurelia \n",
|
||||
"\n",
|
||||
" Genre ESRB_Rating Platform Publisher \\\n",
|
||||
"19 Action M PS3 Rockstar Games \n",
|
||||
"20 Action M PS4 Rockstar Games \n",
|
||||
"21 Misc E DS Nintendo \n",
|
||||
"24 Racing E 3DS Nintendo \n",
|
||||
"25 Role-Playing E DS Nintendo \n",
|
||||
"... ... ... ... ... \n",
|
||||
"55090 Shooter M PC Devolver Digital \n",
|
||||
"55423 Music E10 NS Drool \n",
|
||||
"55490 Action M NS Grasshopper Manufacture Inc. \n",
|
||||
"55528 Action-Adventure E NS aeiowu \n",
|
||||
"55653 Visual Novel T PS4 Mixedbag Srl \n",
|
||||
"\n",
|
||||
" Developer Critic_Score User_Score Total_Shipped \\\n",
|
||||
"19 Rockstar North 1.0 9.507143 20.076667 \n",
|
||||
"20 Rockstar North 1.0 9.528571 19.543333 \n",
|
||||
"21 Nintendo SDD 1.0 9.550000 19.010000 \n",
|
||||
"24 Nintendo EAD / Retro Studios 1.0 9.614286 18.110000 \n",
|
||||
"25 Game Freak 1.0 9.635714 17.670000 \n",
|
||||
"... ... ... ... ... \n",
|
||||
"55090 Pixel Titans 1.0 8.000000 0.030000 \n",
|
||||
"55423 Drool 1.0 9.300000 0.030000 \n",
|
||||
"55490 Grasshopper Manufacture 1.0 8.309565 0.030000 \n",
|
||||
"55528 Team TumbleSeed 1.0 7.747826 0.030000 \n",
|
||||
"55653 Santa Ragione Srl 1.0 8.550000 0.030000 \n",
|
||||
"\n",
|
||||
" NA_Sales PAL_Sales Year bin_Critic_Score bin_value \\\n",
|
||||
"19 6.370 9.850 2013.0 larg 8.5 \n",
|
||||
"20 6.060 9.710 2014.0 larg 8.5 \n",
|
||||
"21 6.295 9.288 2006.0 larg 8.5 \n",
|
||||
"24 7.000 8.022 2011.0 larg 8.5 \n",
|
||||
"25 7.235 7.600 2007.0 larg 8.5 \n",
|
||||
"... ... ... ... ... ... \n",
|
||||
"55090 0.000 0.000 2017.0 larg 8.5 \n",
|
||||
"55423 0.000 0.000 2017.0 larg 8.5 \n",
|
||||
"55490 0.000 0.000 2019.0 larg 8.5 \n",
|
||||
"55528 0.000 0.000 2017.0 epik 5.5 \n",
|
||||
"55653 0.000 0.000 2016.0 larg 8.5 \n",
|
||||
"\n",
|
||||
" Critic_Score_Norm Kmean_Labels my_channel \n",
|
||||
"19 1.830687 4 NaN \n",
|
||||
"20 2.083244 4 NaN \n",
|
||||
"21 0.736276 4 NaN \n",
|
||||
"24 0.820462 4 NaN \n",
|
||||
"25 1.157204 4 NaN \n",
|
||||
"... ... ... ... \n",
|
||||
"55090 -0.021392 6 NaN \n",
|
||||
"55423 1.493945 8 NaN \n",
|
||||
"55490 0.652091 6 NaN \n",
|
||||
"55528 -0.189763 6 NaN \n",
|
||||
"55653 0.652091 6 NaN \n",
|
||||
"\n",
|
||||
"[6116 rows x 18 columns]>\n",
|
||||
" Genre ESRB_Rating Platform NA_Sales\n",
|
||||
"19 Action 3 17 750\n",
|
||||
"20 Action 3 18 742\n",
|
||||
@@ -1161,19 +1095,19 @@
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"C:\\Users\\hellom\\AppData\\Local\\Temp\\ipykernel_12888\\1695520614.py:18: SettingWithCopyWarning: \n",
|
||||
"/tmp/ipykernel_8738/2203680914.py:18: SettingWithCopyWarning: \n",
|
||||
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
||||
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
||||
"\n",
|
||||
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
||||
" to_be_nodes[\"NA_Sales\"] = le.fit_transform(gammas[\"NA_Sales\"])\n",
|
||||
"C:\\Users\\hellom\\AppData\\Local\\Temp\\ipykernel_12888\\1695520614.py:19: SettingWithCopyWarning: \n",
|
||||
"/tmp/ipykernel_8738/2203680914.py:19: SettingWithCopyWarning: \n",
|
||||
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
||||
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
||||
"\n",
|
||||
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
|
||||
" to_be_nodes[\"ESRB_Rating\"] = le.fit_transform(gammas[\"ESRB_Rating\"])\n",
|
||||
"C:\\Users\\hellom\\AppData\\Local\\Temp\\ipykernel_12888\\1695520614.py:20: SettingWithCopyWarning: \n",
|
||||
"/tmp/ipykernel_8738/2203680914.py:20: SettingWithCopyWarning: \n",
|
||||
"A value is trying to be set on a copy of a slice from a DataFrame.\n",
|
||||
"Try using .loc[row_indexer,col_indexer] = value instead\n",
|
||||
"\n",
|
||||
@@ -1189,7 +1123,7 @@
|
||||
"gammas.loc[gammas[\"Critic_Score\"] < 5, 'Critic_Score'] = 0\n",
|
||||
"gammas.loc[gammas[\"Critic_Score\"] > 5, 'Critic_Score'] = 1\n",
|
||||
"\n",
|
||||
"print(gammas.head)\n",
|
||||
"# print(gammas.head)\n",
|
||||
"\n",
|
||||
"# Columns to be considered as nodes\n",
|
||||
"to_be_nodes = gammas[node_cols]\n",
|
||||
@@ -1197,9 +1131,9 @@
|
||||
"\n",
|
||||
"le = preprocessing.LabelEncoder()\n",
|
||||
"# Attribute to be predicted\n",
|
||||
"predikt_col = le.fit_transform(gammas[\"Genre\"])\n",
|
||||
"predikt_col = le.fit_transform(gammas[\"Critic_Score\"])\n",
|
||||
"\n",
|
||||
"# to_be_nodes[\"Genre\"] = le.fit_transform(gammas[\"Genre\"])\n",
|
||||
"to_be_nodes[\"Genre\"] = le.fit_transform(gammas[\"Genre\"])\n",
|
||||
"to_be_nodes[\"NA_Sales\"] = le.fit_transform(gammas[\"NA_Sales\"])\n",
|
||||
"to_be_nodes[\"ESRB_Rating\"] = le.fit_transform(gammas[\"ESRB_Rating\"])\n",
|
||||
"to_be_nodes[\"Platform\"] = le.fit_transform(gammas[\"Platform\"])\n",
|
||||
@@ -1231,18 +1165,24 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"execution_count": 54,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'DecisionTreeClassifier' is not defined",
|
||||
"ename": "ValueError",
|
||||
"evalue": "could not convert string to float: 'Action-Adventure'",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[1;32mIn[25], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m classifier_obj \u001b[39m=\u001b[39m DecisionTreeClassifier()\n\u001b[0;32m 3\u001b[0m classifier_obj \u001b[39m=\u001b[39m classifier_obj\u001b[39m.\u001b[39mfit(node_train, predikt_train)\n\u001b[0;32m 5\u001b[0m predikt_result \u001b[39m=\u001b[39m classifier_obj\u001b[39m.\u001b[39mpredict(node_test)\n",
|
||||
"\u001b[1;31mNameError\u001b[0m: name 'DecisionTreeClassifier' is not defined"
|
||||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
|
||||
"Cell \u001b[0;32mIn[54], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m classifier_obj \u001b[39m=\u001b[39m DecisionTreeClassifier()\n\u001b[0;32m----> 3\u001b[0m classifier_obj \u001b[39m=\u001b[39m classifier_obj\u001b[39m.\u001b[39;49mfit(node_train, predikt_train)\n\u001b[1;32m 5\u001b[0m predikt_result \u001b[39m=\u001b[39m classifier_obj\u001b[39m.\u001b[39mpredict(node_test)\n\u001b[1;32m 7\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39mACCURACY FOR MODEL PRE: \u001b[39m\u001b[39m\"\u001b[39m, metrics\u001b[39m.\u001b[39maccuracy_score(predikt_test, predikt_result))\n",
|
||||
"File \u001b[0;32m~/bin/anaconda3/envs/jewpidor/lib/python3.10/site-packages/sklearn/tree/_classes.py:889\u001b[0m, in \u001b[0;36mDecisionTreeClassifier.fit\u001b[0;34m(self, X, y, sample_weight, check_input)\u001b[0m\n\u001b[1;32m 859\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mfit\u001b[39m(\u001b[39mself\u001b[39m, X, y, sample_weight\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, check_input\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m):\n\u001b[1;32m 860\u001b[0m \u001b[39m \u001b[39m\u001b[39m\"\"\"Build a decision tree classifier from the training set (X, y).\u001b[39;00m\n\u001b[1;32m 861\u001b[0m \n\u001b[1;32m 862\u001b[0m \u001b[39m Parameters\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 886\u001b[0m \u001b[39m Fitted estimator.\u001b[39;00m\n\u001b[1;32m 887\u001b[0m \u001b[39m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 889\u001b[0m \u001b[39msuper\u001b[39;49m()\u001b[39m.\u001b[39;49mfit(\n\u001b[1;32m 890\u001b[0m X,\n\u001b[1;32m 891\u001b[0m y,\n\u001b[1;32m 892\u001b[0m sample_weight\u001b[39m=\u001b[39;49msample_weight,\n\u001b[1;32m 893\u001b[0m check_input\u001b[39m=\u001b[39;49mcheck_input,\n\u001b[1;32m 894\u001b[0m )\n\u001b[1;32m 895\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\n",
|
||||
"File \u001b[0;32m~/bin/anaconda3/envs/jewpidor/lib/python3.10/site-packages/sklearn/tree/_classes.py:186\u001b[0m, in \u001b[0;36mBaseDecisionTree.fit\u001b[0;34m(self, X, y, sample_weight, check_input)\u001b[0m\n\u001b[1;32m 184\u001b[0m check_X_params \u001b[39m=\u001b[39m \u001b[39mdict\u001b[39m(dtype\u001b[39m=\u001b[39mDTYPE, accept_sparse\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mcsc\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m 185\u001b[0m check_y_params \u001b[39m=\u001b[39m \u001b[39mdict\u001b[39m(ensure_2d\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m, dtype\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m)\n\u001b[0;32m--> 186\u001b[0m X, y \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_validate_data(\n\u001b[1;32m 187\u001b[0m X, y, validate_separately\u001b[39m=\u001b[39;49m(check_X_params, check_y_params)\n\u001b[1;32m 188\u001b[0m )\n\u001b[1;32m 189\u001b[0m \u001b[39mif\u001b[39;00m issparse(X):\n\u001b[1;32m 190\u001b[0m X\u001b[39m.\u001b[39msort_indices()\n",
|
||||
"File \u001b[0;32m~/bin/anaconda3/envs/jewpidor/lib/python3.10/site-packages/sklearn/base.py:549\u001b[0m, in \u001b[0;36mBaseEstimator._validate_data\u001b[0;34m(self, X, y, reset, validate_separately, **check_params)\u001b[0m\n\u001b[1;32m 547\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39m\"\u001b[39m\u001b[39mestimator\u001b[39m\u001b[39m\"\u001b[39m \u001b[39mnot\u001b[39;00m \u001b[39min\u001b[39;00m check_X_params:\n\u001b[1;32m 548\u001b[0m check_X_params \u001b[39m=\u001b[39m {\u001b[39m*\u001b[39m\u001b[39m*\u001b[39mdefault_check_params, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mcheck_X_params}\n\u001b[0;32m--> 549\u001b[0m X \u001b[39m=\u001b[39m check_array(X, input_name\u001b[39m=\u001b[39;49m\u001b[39m\"\u001b[39;49m\u001b[39mX\u001b[39;49m\u001b[39m\"\u001b[39;49m, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mcheck_X_params)\n\u001b[1;32m 550\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39m\"\u001b[39m\u001b[39mestimator\u001b[39m\u001b[39m\"\u001b[39m \u001b[39mnot\u001b[39;00m \u001b[39min\u001b[39;00m check_y_params:\n\u001b[1;32m 551\u001b[0m check_y_params \u001b[39m=\u001b[39m {\u001b[39m*\u001b[39m\u001b[39m*\u001b[39mdefault_check_params, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mcheck_y_params}\n",
|
||||
"File \u001b[0;32m~/bin/anaconda3/envs/jewpidor/lib/python3.10/site-packages/sklearn/utils/validation.py:877\u001b[0m, in \u001b[0;36mcheck_array\u001b[0;34m(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator, input_name)\u001b[0m\n\u001b[1;32m 875\u001b[0m array \u001b[39m=\u001b[39m xp\u001b[39m.\u001b[39mastype(array, dtype, copy\u001b[39m=\u001b[39m\u001b[39mFalse\u001b[39;00m)\n\u001b[1;32m 876\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m--> 877\u001b[0m array \u001b[39m=\u001b[39m _asarray_with_order(array, order\u001b[39m=\u001b[39;49morder, dtype\u001b[39m=\u001b[39;49mdtype, xp\u001b[39m=\u001b[39;49mxp)\n\u001b[1;32m 878\u001b[0m \u001b[39mexcept\u001b[39;00m ComplexWarning \u001b[39mas\u001b[39;00m complex_warning:\n\u001b[1;32m 879\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[1;32m 880\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mComplex data not supported\u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39m{}\u001b[39;00m\u001b[39m\\n\u001b[39;00m\u001b[39m\"\u001b[39m\u001b[39m.\u001b[39mformat(array)\n\u001b[1;32m 881\u001b[0m ) \u001b[39mfrom\u001b[39;00m \u001b[39mcomplex_warning\u001b[39;00m\n",
|
||||
"File \u001b[0;32m~/bin/anaconda3/envs/jewpidor/lib/python3.10/site-packages/sklearn/utils/_array_api.py:185\u001b[0m, in \u001b[0;36m_asarray_with_order\u001b[0;34m(array, dtype, order, copy, xp)\u001b[0m\n\u001b[1;32m 182\u001b[0m xp, _ \u001b[39m=\u001b[39m get_namespace(array)\n\u001b[1;32m 183\u001b[0m \u001b[39mif\u001b[39;00m xp\u001b[39m.\u001b[39m\u001b[39m__name__\u001b[39m \u001b[39min\u001b[39;00m {\u001b[39m\"\u001b[39m\u001b[39mnumpy\u001b[39m\u001b[39m\"\u001b[39m, \u001b[39m\"\u001b[39m\u001b[39mnumpy.array_api\u001b[39m\u001b[39m\"\u001b[39m}:\n\u001b[1;32m 184\u001b[0m \u001b[39m# Use NumPy API to support order\u001b[39;00m\n\u001b[0;32m--> 185\u001b[0m array \u001b[39m=\u001b[39m numpy\u001b[39m.\u001b[39;49masarray(array, order\u001b[39m=\u001b[39;49morder, dtype\u001b[39m=\u001b[39;49mdtype)\n\u001b[1;32m 186\u001b[0m \u001b[39mreturn\u001b[39;00m xp\u001b[39m.\u001b[39masarray(array, copy\u001b[39m=\u001b[39mcopy)\n\u001b[1;32m 187\u001b[0m \u001b[39melse\u001b[39;00m:\n",
|
||||
"File \u001b[0;32m~/bin/anaconda3/envs/jewpidor/lib/python3.10/site-packages/pandas/core/generic.py:2070\u001b[0m, in \u001b[0;36mNDFrame.__array__\u001b[0;34m(self, dtype)\u001b[0m\n\u001b[1;32m 2069\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__array__\u001b[39m(\u001b[39mself\u001b[39m, dtype: npt\u001b[39m.\u001b[39mDTypeLike \u001b[39m|\u001b[39m \u001b[39mNone\u001b[39;00m \u001b[39m=\u001b[39m \u001b[39mNone\u001b[39;00m) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m np\u001b[39m.\u001b[39mndarray:\n\u001b[0;32m-> 2070\u001b[0m \u001b[39mreturn\u001b[39;00m np\u001b[39m.\u001b[39;49masarray(\u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_values, dtype\u001b[39m=\u001b[39;49mdtype)\n",
|
||||
"\u001b[0;31mValueError\u001b[0m: could not convert string to float: 'Action-Adventure'"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user