We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trying to run this notebook https://www.kaggle.com/code/kmader/active-learning-optimization-improvement/notebook
getting an error in learner.teach step (and also in pd.concat(seq_iter.compute()) step):
learner.teach
pd.concat(seq_iter.compute())
# initializing the learner from modAL.models import ActiveLearner initial_df = all_papaya_samples_df.sample(20, random_state=2018) learner = ActiveLearner( estimator=SVC(kernel = 'rbf', probability=True, random_state = 2018), X_training=initial_df[['firmness', 'redness']], y_training=initial_df['tastiness'] ) # query for labels X_pool = all_papaya_samples_df[['firmness', 'redness']].values y_pool = all_papaya_samples_df['tastiness'].values query_idx, query_inst = learner.query(X_pool) query_idx, query_inst fig, m_axs = plt.subplots(2, 3, figsize = (12, 12)) last_pts = initial_df.shape[0] queried_pts = [] for c_ax, c_pts in zip(m_axs.flatten(), np.linspace(20, 350, 6).astype(int)): for _ in range(c_pts-last_pts): query_idx, _ = learner.query(X_pool) queried_pts += [query_idx] learner.teach(X_pool[query_idx], y_pool[query_idx]) last_pts = c_pts fit_and_show_model(learner, None, title_str = 'Sampled: {}'.format(c_pts), ax = c_ax, fit_model = False )
TypeError Traceback (most recent call last) /tmp/ipykernel_28372/2173050794.py in <module> 6 query_idx, _ = learner.query(X_pool) 7 queried_pts += [query_idx] ----> 8 learner.teach(X_pool[query_idx], y_pool[query_idx]) 9 last_pts = c_pts 10 fit_and_show_model(learner, /opt/conda/lib/python3.7/site-packages/modAL/models/learners.py in teach(self, X, y, bootstrap, only_new, **fit_kwargs) 96 **fit_kwargs: Keyword arguments to be passed to the fit method of the predictor. 97 """ ---> 98 self._add_training_data(X, y) 99 if not only_new: 100 self._fit_to_known(bootstrap=bootstrap, **fit_kwargs) /opt/conda/lib/python3.7/site-packages/modAL/models/base.py in _add_training_data(self, X, y) 94 else: 95 try: ---> 96 self.X_training = data_vstack((self.X_training, X)) 97 self.y_training = data_vstack((self.y_training, y)) 98 except ValueError: /opt/conda/lib/python3.7/site-packages/modAL/utils/data.py in data_vstack(blocks) 22 return sp.vstack(blocks) 23 elif isinstance(blocks[0], pd.DataFrame): ---> 24 return blocks[0].append(blocks[1:]) 25 elif isinstance(blocks[0], np.ndarray): 26 return np.concatenate(blocks) /opt/conda/lib/python3.7/site-packages/pandas/core/frame.py in append(self, other, ignore_index, verify_integrity, sort) 8967 ignore_index=ignore_index, 8968 verify_integrity=verify_integrity, -> 8969 sort=sort, 8970 ) 8971 ).__finalize__(self, method="append") /opt/conda/lib/python3.7/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs) 309 stacklevel=stacklevel, 310 ) --> 311 return func(*args, **kwargs) 312 313 return wrapper /opt/conda/lib/python3.7/site-packages/pandas/core/reshape/concat.py in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy) 302 verify_integrity=verify_integrity, 303 copy=copy, --> 304 sort=sort, 305 ) 306 /opt/conda/lib/python3.7/site-packages/pandas/core/reshape/concat.py in __init__(self, objs, axis, join, keys, levels, names, ignore_index, verify_integrity, copy, sort) 382 "only Series and DataFrame objs are valid" 383 ) --> 384 raise TypeError(msg) 385 386 ndims.add(obj.ndim) TypeError: cannot concatenate object of type '<class 'numpy.ndarray'>'; only Series and DataFrame objs are valid
The text was updated successfully, but these errors were encountered:
No branches or pull requests
trying to run this notebook https://www.kaggle.com/code/kmader/active-learning-optimization-improvement/notebook
getting an error in
learner.teach
step (and also inpd.concat(seq_iter.compute())
step):The text was updated successfully, but these errors were encountered: