Comments (3)
here's the diff needed to replace numpy.float
and numpy.int
with float
and int
respectively:
diff --git a/hep_ml/commonutils.py b/hep_ml/commonutils.py
index b888c69..bf46e75 100755
--- a/hep_ml/commonutils.py
+++ b/hep_ml/commonutils.py
@@ -222,7 +222,7 @@ def compute_knn_indices_of_same_class(X, y, n_neighbours=50):
:rtype numpy.array, shape [len(dataframe), knn], each row contains indices of closest signal events
"""
assert len(X) == len(y), "different size"
- result = numpy.zeros([len(X), n_neighbours], dtype=numpy.int)
+ result = numpy.zeros([len(X), n_neighbours], dtype=int)
for label in set(y):
is_signal = y == label
label_knn = compute_knn_indices_of_signal(X, is_signal, n_neighbours)
diff --git a/hep_ml/losses.py b/hep_ml/losses.py
index e1e079a..89fc18f 100644
--- a/hep_ml/losses.py
+++ b/hep_ml/losses.py
@@ -727,7 +727,7 @@ class AbstractFlatnessLossFunction(AbstractLossFunction):
def _compute_fl_derivatives(self, y_pred):
y_pred = numpy.ravel(y_pred)
- neg_gradient = numpy.zeros(len(self.y), dtype=numpy.float)
+ neg_gradient = numpy.zeros(len(self.y), dtype=float)
for label in self.uniform_label:
label_mask = self.label_masks[label]
diff --git a/hep_ml/metrics_utils.py b/hep_ml/metrics_utils.py
index b705f7a..e00c7e2 100644
--- a/hep_ml/metrics_utils.py
+++ b/hep_ml/metrics_utils.py
@@ -67,7 +67,7 @@ def compute_bin_indices(X_part, bin_limits=None, n_bins=20):
variable_data = X_part[:, variable_index]
bin_limits.append(numpy.linspace(numpy.min(variable_data), numpy.max(variable_data), n_bins + 1)[1: -1])
- bin_indices = numpy.zeros(len(X_part), dtype=numpy.int)
+ bin_indices = numpy.zeros(len(X_part), dtype=int)
for axis, bin_limits_axis in enumerate(bin_limits):
bin_indices *= (len(bin_limits_axis) + 1)
bin_indices += numpy.searchsorted(bin_limits_axis, X_part[:, axis])
diff --git a/tests/test_gradientboosting.py b/tests/test_gradientboosting.py
index fbec64a..c77ac68 100644
--- a/tests/test_gradientboosting.py
+++ b/tests/test_gradientboosting.py
@@ -112,7 +112,7 @@ def test_constant_fitting(n_samples=1000, n_features=5):
Testing if initial constant fitted properly
"""
X, y = generate_sample(n_samples=n_samples, n_features=n_features)
- y = y.astype(numpy.float) + 1000.
+ y = y.astype(float) + 1000.
for loss in [MSELossFunction(), losses.MAELossFunction()]:
gb = UGradientBoostingRegressor(loss=loss, n_estimators=10)
gb.fit(X, y)
(i didn't run the tests because I couldn't get them to immediately work)
from hep_ml.
(i didn't run the tests because I couldn't get them to immediately work)
Those are all safe changes, can you open PR anyways?
from hep_ml.
Merged, thanks Richard!
from hep_ml.
Related Issues (20)
- Random behavior of GBReweighter and UGradientBoostingClassifier
- Nominal weights when correcting already weighted original HOT 1
- Assertion Error with UGradientBoost HOT 1
- sPlot returns NAN sWeights HOT 3
- Odd behaviour of GBReweighter HOT 3
- Using sWeights with GBReweighter HOT 1
- Saving uboost BDT with tf/keras base estimators HOT 5
- Persistify GBReweighter instance HOT 1
- Error propagation from weights HOT 6
- Create a new release? HOT 1
- Theano is going away HOT 1
- Benchmark with independent classification model HOT 3
- New release? HOT 2
- Large variations in signal/background distributions HOT 7
- GBReweighter KeyError: 'squared_error' ?? HOT 7
- Porting loss function to XGBoost HOT 1
- GPU Acceleration in GBDT HOT 6
- Documenting behavior of normalization HOT 1
- GBReweights seems to be not working in my case HOT 4
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 hep_ml.