Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Commit 55a8003

Browse files
authored
Fix numpy deprecation warnings (#166)
* Update plot_1d_total_variation.py * Update samples_generator.py * Update test_sag.py * Update gen_rst.py
1 parent 1329a57 commit 55a8003

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

doc/sphinxext/gen_rst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def line_count_sort(file_list, target_dir):
558558
unsorted[count][1] = total_lines - docstr_lines
559559
unsorted[count][0] = exmpl
560560
index = np.lexsort((unsorted[:, 0].astype(np.str),
561-
unsorted[:, 1].astype(np.float)))
561+
unsorted[:, 1].astype(float)))
562562
if not len(unsorted):
563563
return []
564564
return np.array(unsorted[index][:, 0]).tolist()

examples/plot_1d_total_variation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
np.random.seed(0) # for reproducibility
3232
X = np.random.rand(n_samples, n_features)
3333
# generate y as a linear model, y = sign(X w + noise)
34-
y = np.sign(X.dot(ground_truth) + 0.5 * np.random.randn(n_samples)).astype(np.int)
34+
y = np.sign(X.dot(ground_truth) + 0.5 * np.random.randn(n_samples)).astype(int)
3535

3636

3737
for penalty in ('l1', 'tv1d'):
@@ -45,4 +45,4 @@
4545
plt.grid()
4646
plt.legend()
4747
plt.ylim((-1.5, 1.5))
48-
plt.show()
48+
plt.show()

lightning/impl/datasets/samples_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def make_classification(n_samples=100, n_features=20, n_informative=2,
233233

234234
# Intialize X and y
235235
X = np.zeros((n_samples, n_features))
236-
y = np.zeros(n_samples, dtype=np.int)
236+
y = np.zeros(n_samples, dtype=int)
237237

238238
# Build the polytope
239239
C = np.array(list(product([-class_sep, class_sep], repeat=n_informative)))

lightning/impl/tests/test_sag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def test_sag_sample_weights():
441441
# resulting coefficients by adding noise to original samples
442442
X2 = np.concatenate((X, np.random.randn(*X.shape)), axis=0) # augment with noise
443443
y2 = np.concatenate((y, y), axis=0)
444-
sample_weights = np.ones(y2.size, dtype=np.float)
444+
sample_weights = np.ones(y2.size, dtype=float)
445445
sample_weights[X.shape[0]:] = 0.
446446

447447
clf1 = SAGARegressor(loss='squared', alpha=alpha, max_iter=100, random_state=0, tol=1e-24)

0 commit comments

Comments
 (0)