Comments (9)
Hey @trivialfis
Here are the feature names:
['t_2m:C_53.77_1.702', 't_2m:C_53.84_1.767', 't_2m:C_53.9_1.832', 't_2m:C_53.97_1.897', 't_2m:C_54.03_1.962', 't_2m:C_54.1_2.027', 'wind_speed_10m:ms_53.77_1.702', 'wind_speed_10m:ms_53.84_1.767', 'wind_speed_10m:ms_53.9_1.832', 'wind_speed_10m:ms_53.97_1.897', 'wind_speed_10m:ms_54.03_1.962', 'wind_speed_10m:ms_54.1_2.027', 'wind_speed_100m:ms_53.77_1.702', 'wind_speed_100m:ms_53.84_1.767', 'wind_speed_100m:ms_53.9_1.832', 'wind_speed_100m:ms_53.97_1.897', 'wind_speed_100m:ms_54.03_1.962', 'wind_speed_100m:ms_54.1_2.027', 'wind_dir_10m:d_53.77_1.702', 'wind_dir_10m:d_53.84_1.767', 'wind_dir_10m:d_53.9_1.832', 'wind_dir_10m:d_53.97_1.897', 'wind_dir_10m:d_54.03_1.962', 'wind_dir_10m:d_54.1_2.027', 'wind_dir_100m:d_53.77_1.702', 'wind_dir_100m:d_53.84_1.767', 'wind_dir_100m:d_53.9_1.832', 'wind_dir_100m:d_53.97_1.897', 'wind_dir_100m:d_54.03_1.962', 'wind_dir_100m:d_54.1_2.027', 'precip_1h:mm_53.77_1.702', 'precip_1h:mm_53.84_1.767', 'precip_1h:mm_53.9_1.832', 'precip_1h:mm_53.97_1.897', 'precip_1h:mm_54.03_1.962', 'precip_1h:mm_54.1_2.027', 'relative_humidity_2m:p_53.77_1.702', 'relative_humidity_2m:p_53.84_1.767', 'relative_humidity_2m:p_53.9_1.832', 'relative_humidity_2m:p_53.97_1.897', 'relative_humidity_2m:p_54.03_1.962', 'relative_humidity_2m:p_54.1_2.027', 'Wind_MWh_credit', 'windlimit']
Here is the constraints python value being passed to the regressor object
{'wind_speed_10m:ms_53.77_1.702': 1, 'wind_speed_10m:ms_53.84_1.767': 1, 'wind_speed_10m:ms_53.9_1.832': 1, 'wind_speed_10m:ms_53.97_1.897': 1, 'wind_speed_10m:ms_54.03_1.962': 1, 'wind_speed_10m:ms_54.1_2.027': 1, 'wind_speed_100m:ms_53.77_1.702': 1, 'wind_speed_100m:ms_53.84_1.767': 1, 'wind_speed_100m:ms_53.9_1.832': 1, 'wind_speed_100m:ms_53.97_1.897': 1, 'wind_speed_100m:ms_54.03_1.962': 1, 'wind_speed_100m:ms_54.1_2.027': 1, 'windlimit': 1, 'relative_humidity_2m:p_53.77_1.702': -1, 'relative_humidity_2m:p_53.84_1.767': -1, 'relative_humidity_2m:p_53.9_1.832': -1, 'relative_humidity_2m:p_53.97_1.897': -1, 'relative_humidity_2m:p_54.03_1.962': -1, 'relative_humidity_2m:p_54.1_2.027': -1}
from xgboost.
Hi, could you please provide some info for us to reproduce:
- The actual Python value of the constraint parameter.
- The list of feature names.
from xgboost.
Hi, I tried to create a reproducer based on the parameters, but couldn't see the error:
import numpy as np
import pandas as pd
import xgboost as xgb
from sklearn.datasets import make_regression
alpha = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
mono = {
"wind_speed_10m:ms_53.77_1.702": 1,
"wind_speed_10m:ms_53.84_1.767": 1,
"wind_speed_10m:ms_53.9_1.832": 1,
"wind_speed_10m:ms_53.97_1.897": 1,
"wind_speed_10m:ms_54.03_1.962": 1,
"wind_speed_10m:ms_54.1_2.027": 1,
"wind_speed_100m:ms_53.77_1.702": 1,
"wind_speed_100m:ms_53.84_1.767": 1,
"wind_speed_100m:ms_53.9_1.832": 1,
"wind_speed_100m:ms_53.97_1.897": 1,
"wind_speed_100m:ms_54.03_1.962": 1,
"wind_speed_100m:ms_54.1_2.027": 1,
"windlimit": 1,
"relative_humidity_2m:p_53.77_1.702": -1,
"relative_humidity_2m:p_53.84_1.767": -1,
"relative_humidity_2m:p_53.9_1.832": -1,
"relative_humidity_2m:p_53.97_1.897": -1,
"relative_humidity_2m:p_54.03_1.962": -1,
"relative_humidity_2m:p_54.1_2.027": -1,
}
fname = [
"t_2m:C_53.77_1.702",
"t_2m:C_53.84_1.767",
"t_2m:C_53.9_1.832",
"t_2m:C_53.97_1.897",
"t_2m:C_54.03_1.962",
"t_2m:C_54.1_2.027",
"wind_speed_10m:ms_53.77_1.702",
"wind_speed_10m:ms_53.84_1.767",
"wind_speed_10m:ms_53.9_1.832",
"wind_speed_10m:ms_53.97_1.897",
"wind_speed_10m:ms_54.03_1.962",
"wind_speed_10m:ms_54.1_2.027",
"wind_speed_100m:ms_53.77_1.702",
"wind_speed_100m:ms_53.84_1.767",
"wind_speed_100m:ms_53.9_1.832",
"wind_speed_100m:ms_53.97_1.897",
"wind_speed_100m:ms_54.03_1.962",
"wind_speed_100m:ms_54.1_2.027",
"wind_dir_10m:d_53.77_1.702",
"wind_dir_10m:d_53.84_1.767",
"wind_dir_10m:d_53.9_1.832",
"wind_dir_10m:d_53.97_1.897",
"wind_dir_10m:d_54.03_1.962",
"wind_dir_10m:d_54.1_2.027",
"wind_dir_100m:d_53.77_1.702",
"wind_dir_100m:d_53.84_1.767",
"wind_dir_100m:d_53.9_1.832",
"wind_dir_100m:d_53.97_1.897",
"wind_dir_100m:d_54.03_1.962",
"wind_dir_100m:d_54.1_2.027",
"precip_1h:mm_53.77_1.702",
"precip_1h:mm_53.84_1.767",
"precip_1h:mm_53.9_1.832",
"precip_1h:mm_53.97_1.897",
"precip_1h:mm_54.03_1.962",
"precip_1h:mm_54.1_2.027",
"relative_humidity_2m:p_53.77_1.702",
"relative_humidity_2m:p_53.84_1.767",
"relative_humidity_2m:p_53.9_1.832",
"relative_humidity_2m:p_53.97_1.897",
"relative_humidity_2m:p_54.03_1.962",
"relative_humidity_2m:p_54.1_2.027",
"Wind_MWh_credit",
"windlimit",
]
n_features = len(fname)
X, y = make_regression(256, n_features)
X_df = pd.DataFrame(X, columns=fname)
xgb_regressor_wind = xgb.XGBRegressor(
objective="reg:quantileerror",
quantile_alpha=alpha,
# n_jobs=1,
colsample_bytree=0.8,
gamma=0.3,
learning_rate=0.02,
max_depth=4,
n_estimators=800,
subsample=0.6,
min_child_weight=3,
monotone_constraints=mono,
)
xgb_regressor_wind.fit(X_df, y)
from xgboost.
Hey the problem isnt while fitting but rather while predicting, fitting the model is fine but using the fitted model causes issues
from xgboost.
@niltecedu I added a predict to the previous snippet , it works fine as well.
from xgboost.
Hey @trivialfis Oddly enough this snippet does work but when I get my actual weather data it doesnt :/
Camt seem to get to the root of the issue, the monotone dict is auto generated based on the dataframe column named,
But the columns I sent and the dict I had is was fails in my program,
from xgboost.
Is it possible that you turned the parameter into a string instead of a dictionary?
from xgboost.
Feel free to reopen if there's a way to reproduce it.
from xgboost.
Is it possible that you turned the parameter into a string instead of a dictionary?
Hey I checked it more and it looks the same, like it a dict,
The problem stems from when Im reading it from a dataframe to create my dict and looks like thats causing issues?
If I get to the bottom of it I will update, Im gonna assume its pandas bug maybe then because I can run your snippet fine
from xgboost.
Related Issues (20)
- 2.1.0 Release Roadmap
- Failed to set feature types in R xgboost HOT 1
- Question: Import xgboost as new port in vcpkg repo, build failed for arm64_osx, arm64_uwp, arm64_windows... HOT 4
- Use CMAKE_MSVC_RUNTIME_LIBRARY to consistently handle linking mode for MSVC runtime
- Binary classification: target is probability instead of label?
- typo in `src/tree/updater_approx.cc` line 55 HOT 1
- 2.1.0 Release Candidate
- [CI] Migration to manylinux_2_28_x86_64 and rockylinux8
- Update the default CTK to 12.4. HOT 1
- Update Python requirement to 3.10.
- Don't construct a column matrix when there's no missing value HOT 1
- Feature: C# package HOT 1
- Compatibility with latest Dask HOT 1
- [jvm-packages for GPU] Support numerical feature input
- Issue with LambdaMart and Learning to Rank HOT 2
- process_type: update / updater: refresh deletes all trees from existing model HOT 2
- How XGBoost sample_weights alternate the Gain function formula?
- Federated Learning Tests do not run
- CHECK_* macro in logging.h collides with CHECK_* macro from absl
- [doc] Move `news.md` into document. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xgboost.