Classify2赚钱
This commit is contained in:
@@ -1450,7 +1450,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 106,
|
||||
"execution_count": 133,
|
||||
"id": "8f134d435f71e9e2",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
@@ -1529,11 +1529,11 @@
|
||||
" 'loss_function': 'CrossEntropy', # 适用于二分类\n",
|
||||
" 'eval_metric': 'Precision', # 评估指标\n",
|
||||
" 'iterations': 500,\n",
|
||||
" 'learning_rate': 0.03,\n",
|
||||
" 'learning_rate': 0.05,\n",
|
||||
" 'depth': 8, # 控制模型复杂度\n",
|
||||
" 'l2_leaf_reg': 1, # L2 正则化\n",
|
||||
" 'l2_leaf_reg': 3, # L2 正则化\n",
|
||||
" 'verbose': 500,\n",
|
||||
" 'early_stopping_rounds': 50,\n",
|
||||
" 'early_stopping_rounds': 100,\n",
|
||||
" # 'one_hot_max_size': 50,\n",
|
||||
" # 'class_weights': [0.6, 1.2]\n",
|
||||
" 'task_type': 'GPU'\n",
|
||||
@@ -1553,7 +1553,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 107,
|
||||
"execution_count": 138,
|
||||
"id": "c6eb5cd4-e714-420a-ac48-39af3e11ee81",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
@@ -1566,15 +1566,15 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"train data size: 363894\n",
|
||||
"原始样本数: 363894, 去除标签为空后样本数: 363894\n",
|
||||
"train data size: 36400\n",
|
||||
"原始样本数: 36400, 去除标签为空后样本数: 36400\n",
|
||||
"cat_features: [7]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "2c891d9511d34cd69044024e529641fc",
|
||||
"model_id": "4301941223d144c89c9302df7bb676ce",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@@ -1589,10 +1589,10 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"0:\tlearn: 0.6250000\ttest: 0.0000000\tbest: 0.0000000 (0)\ttotal: 11.5ms\tremaining: 5.74s\n",
|
||||
"bestTest = 0.5761589404\n",
|
||||
"bestIteration = 1\n",
|
||||
"Shrink model to first 2 iterations.\n"
|
||||
"0:\tlearn: 0.6421053\ttest: 0.1200000\tbest: 0.1200000 (0)\ttotal: 98.9ms\tremaining: 49.3s\n",
|
||||
"bestTest = 0.8\n",
|
||||
"bestIteration = 17\n",
|
||||
"Shrink model to first 18 iterations.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -1604,12 +1604,12 @@
|
||||
"# feature_contri = [2 if feat.startswith('act_factor') or 'buy' in feat or 'sell' in feat else 1 for feat in feature_columns]\n",
|
||||
"# light_params['feature_contri'] = feature_contri\n",
|
||||
"# print(f'feature_contri: {feature_contri}')\n",
|
||||
"model, scaler, pca = train_model(train_data.dropna(subset=['label']).groupby('trade_date', group_keys=False).apply(lambda x: x.nsmallest(500, 'total_mv')), feature_columns)\n"
|
||||
"model, scaler, pca = train_model(train_data.dropna(subset=['label']).groupby('trade_date', group_keys=False).apply(lambda x: x.nsmallest(50, 'total_mv')), feature_columns)\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 108,
|
||||
"execution_count": 139,
|
||||
"id": "5d1522a7538db91b",
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
@@ -1649,7 +1649,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 109,
|
||||
"execution_count": 140,
|
||||
"id": "340a82b9",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -1657,19 +1657,19 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"59971\n",
|
||||
"0 10.03\n",
|
||||
"53077\n",
|
||||
"0 2.98\n",
|
||||
"1 8.26\n",
|
||||
"2 10.03\n",
|
||||
"3 6.06\n",
|
||||
"4 6.06\n",
|
||||
" ... \n",
|
||||
"179989 -0.82\n",
|
||||
"179990 5.03\n",
|
||||
"179991 5.78\n",
|
||||
"179992 5.44\n",
|
||||
"179993 2.34\n",
|
||||
"Name: pct_chg, Length: 179994, dtype: float64\n"
|
||||
"168084 5.03\n",
|
||||
"168085 -0.98\n",
|
||||
"168086 5.44\n",
|
||||
"168087 3.01\n",
|
||||
"168088 -0.24\n",
|
||||
"Name: pct_chg, Length: 168089, dtype: float64\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -1680,7 +1680,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 110,
|
||||
"execution_count": 141,
|
||||
"id": "7e9023cc",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
||||
Reference in New Issue
Block a user