TypeError: only size-1 arrays can be converted to Python scalars (Windows, Python 3.5) · Issue #26 · anttttti/Wordbatch · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run the following code with WordBatch on windows:
import wordbatch
from wordbatch.extractors import WordBag
from wordbatch.models import FTRL, FM_FTRL
import pandas as pd
import pandas as pd
import numpy as np
from sklearn.datasets import make_moons
X, y = make_moons(n_samples=10000, noise=0.7)
from sklearn.model_selection import train_test_split
X_t, X_v, y_t, y_v = train_test_split(X, y, stratify=y, test_size=0.2, random_state=8)
Can you give more details?
This doesn't reproduce on Ubuntu 16.04, Python 3.6.4 |Anaconda custom (64-bit), Numpy 1.14.2 and WB 1.35. The model trains fine with this setup.
Hello,
I run the following code with WordBatch on windows:
import wordbatch
from wordbatch.extractors import WordBag
from wordbatch.models import FTRL, FM_FTRL
import pandas as pd
import pandas as pd
import numpy as np
from sklearn.datasets import make_moons
X, y = make_moons(n_samples=10000, noise=0.7)
from sklearn.model_selection import train_test_split
X_t, X_v, y_t, y_v = train_test_split(X, y, stratify=y, test_size=0.2, random_state=8)
train_weight = np.array(pd.DataFrame(y_t).replace(1,400).replace(0,1).astype('float64'))
clf = FM_FTRL(alpha=0.5, beta=1, L1=10.0, L2=10.0, D=2 * 20, alpha_fm=0.02,
L2_fm=0.0, init_fm=0.01, weight_fm=1.0,
D_fm=2, e_noise=0.0, iters=3,
inv_link="sigmoid", threads=4
)
clf.fit(X_t, y_t, train_weight)
class_pred = clf.predict(X_v)
I get the following error:
TypeError Traceback (most recent call last)
in ()
---> 30 clf.fit(X_t, y_t, train_weight)
31 class_pred = clf.predict(X_v)
wordbatch\models\fm_ftrl.pyx in wordbatch.models.fm_ftrl.FM_FTRL.fit()
TypeError: only size-1 arrays can be converted to Python scalars
It appears only when WEIGHT is used.
Do you know possible cause?
Thanks,
Nikita
The text was updated successfully, but these errors were encountered: