Skip to content
New issue

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

Model fitting error #7

Open
jasonhuxinlei opened this issue Nov 2, 2020 · 2 comments
Open

Model fitting error #7

jasonhuxinlei opened this issue Nov 2, 2020 · 2 comments

Comments

@jasonhuxinlei
Copy link

Hello, when I ran the code on my computer, I reported the following error
**model = AutoEncoder(
encoder_layers = [512, 512, 512], #model architecture
decoder_layers = [], #decoder optional - you can create bottlenecks if you like
activation='relu',
swap_p=0.2, #noise parameter
lr = 0.01,
lr_decay=.99,
batch_size=512,
logger='ipynb', #special logging for jupyter notebooks
verbose=False,
optimizer='sgd',
scaler='gauss_rank', #gauss rank scaling forces your numeric features into standard normal distributions
min_cats=3 #Define cutoff for minority categories, default 10
)
model.fit(X_train, epochs=1000, val=X_val)
**

TypeError Traceback (most recent call last)
in
----> 1 model.fit(X_train, epochs=1000, val=X_val)

~\anaconda3\envs\test\lib\site-packages\dfencoder\autoencoder.py in fit(self, df, epochs, val)
556
557 if self.optim is None:
--> 558 self.build_model(df)
559 if self.n_megabatches==1:
560 df = self.prepare_df(df)

~\anaconda3\envs\test\lib\site-packages\dfencoder\autoencoder.py in build_model(self, df)
344
345 #get metadata from features
--> 346 self.init_features(df)
347 input_dim = self.build_inputs()
348

~\anaconda3\envs\test\lib\site-packages\dfencoder\autoencoder.py in init_features(self, df)
250 def init_features(self, df):
251 self.init_numeric(df)
--> 252 self.init_cats(df)
253 self.init_binary(df)
254

~\anaconda3\envs\test\lib\site-packages\dfencoder\autoencoder.py in init_cats(self, df)
220 def init_cats(self, df):
221 dt = df.dtypes
--> 222 objects = list(dt[dt==pd.Categorical].index)
223 for ft in objects:
224 feature = {}

~\anaconda3\envs\test\lib\site-packages\pandas\core\ops\common.py in new_method(self, other)
63 other = item_from_zerodim(other)
64
---> 65 return method(self, other)
66
67 return new_method

~\anaconda3\envs\test\lib\site-packages\pandas\core\ops_init_.py in wrapper(self, other)
368 rvalues = extract_array(other, extract_numpy=True)
369
--> 370 res_values = comparison_op(lvalues, rvalues, op)
371
372 return self._construct_result(res_values, name=res_name)

~\anaconda3\envs\test\lib\site-packages\pandas\core\ops\array_ops.py in comparison_op(left, right, op)
221 # We are not catching all listlikes here (e.g. frozenset, tuple)
222 # The ambiguous case is object-dtype. See GH#27803
--> 223 if len(lvalues) != len(rvalues):
224 raise ValueError(
225 "Lengths must match to compare", lvalues.shape, rvalues.shape

TypeError: object of type 'type' has no len()

@AlliedToasters
Copy link
Owner

Sorry for the late reply. I'm afraid I can't reproduce your error unless I have access to the data contained in the X_train variable. Would you be able to link to a public source of code where I can reproduce the error? For example, google collab. Thanks!

@pablosteinmetz
Copy link

Same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants