Coder Social home page Coder Social logo

Comments (2)

ShahzebL avatar ShahzebL commented on June 9, 2024

Hi,

Not sure if you're still encountering this issue. I tried checking out your dataset, but couldn't access it. Are there enough samples in data? Another option if working with small sample sizes is to decrease batch_size significantly in the fit method.

Hope this helps.

from autokeras.

rahmatiangit avatar rahmatiangit commented on June 9, 2024

- Problem: I get this error if the dataset has 41 or fewer rows. There is no error when the data set is 42 or higher!

- Fix: The Following change in batch_size fixes this problem: default is 32
search.fit(x=X_train, y=y_train, verbose=0, epochs=10, batch_size=12)

- Details: Autokeras 1.1, Code, and passing/failing data sets are attached.

code

url = 'auto-insurance_41a.csv'
dataframe = read_csv(url, header=None)
print(dataframe.shape)

split into input and output elements

data = dataframe.values
data = data.astype('float32')
X, y = data[:, :-1], data[:, -1]
print(X.shape, y.shape)

separate into train and test sets

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)
search = StructuredDataRegressor(max_trials=15, loss='mean_absolute_error')
search.fit(x=X_train, y=y_train, verbose=0, epochs=10)

code

error

Reloading Tuner from ./structured_data_regressor/tuner0.json


ValueError Traceback (most recent call last)

in <cell line: 11>()
9 search = StructuredDataRegressor(max_trials=15, loss='mean_absolute_error')
10 # perform the search
---> 11 search.fit(x=X_train, y=y_train, verbose=0, epochs=10)
12 # evaluate the model
13 mae, _ = search.evaluate(X_test, y_test, verbose=0)

2 frames

/usr/local/lib/python3.10/dist-packages/autokeras/tasks/structured_data.py in fit(self, x, y, epochs, callbacks, validation_split, validation_data, **kwargs)
137 self.check_in_fit(x)
138
--> 139 history = super().fit(
140 x=x,
141 y=y,

/usr/local/lib/python3.10/dist-packages/autokeras/auto_model.py in fit(self, x, y, batch_size, epochs, callbacks, validation_split, validation_data, verbose, **kwargs)
286 # Split the data with validation_split.
287 if validation_data is None and validation_split:
--> 288 dataset, validation_data = data_utils.split_dataset(
289 dataset, validation_split
290 )

/usr/local/lib/python3.10/dist-packages/autokeras/utils/data_utils.py in split_dataset(dataset, validation_split)
44 num_instances = dataset.reduce(np.int64(0), lambda x, _: x + 1).numpy()
45 if num_instances < 2:
---> 46 raise ValueError(
47 "The dataset should at least contain 2 batches to be split."
48 )

ValueError: The dataset should at least contain 2 batches to be split.

Error

auto-insurance_41a.csv
auto-insurance_42a.csv

from autokeras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.