Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autokeras/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from autokeras.tuners import Hyperband
from autokeras.tuners import RandomSearch

__version__ = "3.0.0dev"
__version__ = "3.0.0"

CUSTOM_OBJECTS = {
"CastToFloat32": CastToFloat32,
Expand Down
21 changes: 8 additions & 13 deletions docs/ipynb/customized.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"outputs": [],
"source": [
"!export KERAS_BACKEND=\"torch\"\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The !export command in a Jupyter cell only sets the environment variable for the subshell of that specific command and does not persist for the notebook's kernel. To set the environment variable for the entire notebook session, you should use the %env magic command.

Suggested change
"!export KERAS_BACKEND=\"torch\"\n",
"%env KERAS_BACKEND=torch\n",

"!pip install autokeras"
]
},
Expand Down Expand Up @@ -135,20 +136,11 @@
"the validation data, please refer to the Validation Data section of the\n",
"tutorials of [Image\n",
"Classification](/tutorial/image_classification/#validation-data), [Text\n",
"Classification](/tutorial/text_classification/#validation-data),\n",
"Classification](/tutorial/text_classification/#validation-data), [Structured\n",
"Data\n",
"Classification](/tutorial/structured_data_classification/#validation-data),\n",
"[Multi-task and Multiple Validation](/tutorial/multi/#validation-data).\n",
"\n",
"## Data Format\n",
"You can refer to the documentation of\n",
"[ImageInput](/node/#imageinput-class),\n",
"[TextInput](/node/#textinput-class),\n",
"[RegressionHead](/block/#regressionhead-class),\n",
"[ClassificationHead](/block/#classificationhead-class),\n",
"for the format of different types of data.\n",
"You can also refer to the Data Format section of the tutorials of\n",
"[Image Classification](/tutorial/image_classification/#data-format),\n",
"[Text Classification](/tutorial/text_classification/#data-format).\n",
"\n",
"## Implement New Block\n",
"\n",
"You can extend the [Block](/base/#block-class)\n",
Expand Down Expand Up @@ -229,6 +221,7 @@
"[ImageInput](/node/#imageinput-class),\n",
"[Input](/node/#input-class),\n",
"[TextInput](/node/#textinput-class).\n",
"[StructuredDataInput](/node/#structureddatainput-class),\n",
"\n",
"**Preprocessors**:\n",
"[FeatureEngineering](/block/#featureengineering-class),\n",
Expand All @@ -239,14 +232,16 @@
"**Blocks**:\n",
"[ConvBlock](/block/#convblock-class),\n",
"[DenseBlock](/block/#denseblock-class),\n",
"[Embedding](/block/#embedding-class),\n",
"[Merge](/block/#merge-class),\n",
"[ResNetBlock](/block/#resnetblock-class),\n",
"[RNNBlock](/block/#rnnblock-class),\n",
"[SpatialReduction](/block/#spatialreduction-class),\n",
"[TemporalReduction](/block/#temporalreduction-class),\n",
"[XceptionBlock](/block/#xceptionblock-class),\n",
"[ImageBlock](/block/#imageblock-class),\n",
"[TextBlock](/block/#textblock-class).\n"
"[TextBlock](/block/#textblock-class).\n",
"[StructuredDataBlock](/block/#structureddatablock-class),\n"
]
}
],
Expand Down
1 change: 1 addition & 0 deletions docs/ipynb/export.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"outputs": [],
"source": [
"!export KERAS_BACKEND=\"torch\"\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The !export command in a Jupyter cell only sets the environment variable for the subshell of that specific command and does not persist for the notebook's kernel. To set the environment variable for the entire notebook session, you should use the %env magic command.

Suggested change
"!export KERAS_BACKEND=\"torch\"\n",
"%env KERAS_BACKEND=torch\n",

"!pip install autokeras"
]
},
Expand Down
60 changes: 1 addition & 59 deletions docs/ipynb/image_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"outputs": [],
"source": [
"!export KERAS_BACKEND=\"torch\"\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The !export command in a Jupyter cell only sets the environment variable for the subshell of that specific command and does not persist for the notebook's kernel. To set the environment variable for the entire notebook session, you should use the %env magic command.

Suggested change
"!export KERAS_BACKEND=\"torch\"\n",
"%env KERAS_BACKEND=torch\n",

"!pip install autokeras"
]
},
Expand All @@ -19,7 +20,6 @@
},
"outputs": [],
"source": [
"import numpy as np\n",
"from keras.datasets import mnist\n",
"\n",
"import autokeras as ak"
Expand Down Expand Up @@ -225,64 +225,6 @@
"clf.fit(x_train, y_train, epochs=1)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text"
},
"source": [
"## Data Format\n",
"The AutoKeras ImageClassifier is quite flexible for the data format.\n",
"\n",
"For the image, it accepts data formats both with and without the channel\n",
"dimension. The images in the MNIST dataset do not have the channel dimension.\n",
"Each image is a matrix with shape (28, 28). AutoKeras also accepts images of\n",
"three dimensions with the channel dimension at last, e.g., (32, 32, 3), (28,\n",
"28, 1).\n",
"\n",
"For the classification labels, AutoKeras accepts both plain labels, i.e.\n",
"strings or integers, and one-hot encoded encoded labels, i.e. vectors of 0s and\n",
"1s.\n",
"\n",
"So if you prepare your data in the following way, the ImageClassifier should\n",
"still work.\n"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab_type": "code"
},
"outputs": [],
"source": [
"(x_train, y_train), (x_test, y_test) = mnist.load_data()\n",
"\n",
"# Reshape the images to have the channel dimension.\n",
"x_train = x_train.reshape(x_train.shape + (1,))\n",
"x_test = x_test.reshape(x_test.shape + (1,))\n",
"\n",
"# One-hot encode the labels.\n",
"eye = np.eye(10)\n",
"y_train = eye[y_train]\n",
"y_test = eye[y_test]\n",
"\n",
"print(x_train.shape) # (60000, 28, 28, 1)\n",
"print(y_train.shape) # (60000, 10)\n",
"print(y_train[:3])\n",
"# array([[0., 0., 0., 0., 0., 1., 0., 0., 0., 0.],\n",
"# [1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
"# [0., 0., 0., 0., 1., 0., 0., 0., 0., 0.]])\n",
"\n",
"clf = ak.ImageClassifier(overwrite=True, max_trials=1)\n",
"# Feed the Dataset to the classifier.\n",
"clf.fit(x=x_train, y=y_train, epochs=1)\n",
"# Predict with the best model.\n",
"predicted_y = clf.predict(x=x_test)\n",
"# Evaluate the best model with testing data.\n",
"print(clf.evaluate(x=x_test, y=y_test))"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down
52 changes: 1 addition & 51 deletions docs/ipynb/image_regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"outputs": [],
"source": [
"!export KERAS_BACKEND=\"torch\"\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The !export command in a Jupyter cell only sets the environment variable for the subshell of that specific command and does not persist for the notebook's kernel. To set the environment variable for the entire notebook session, you should use the %env magic command.

Suggested change
"!export KERAS_BACKEND=\"torch\"\n",
"%env KERAS_BACKEND=torch\n",

"!pip install autokeras"
]
},
Expand Down Expand Up @@ -228,57 +229,6 @@
"reg.fit(x_train, y_train, epochs=1)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text"
},
"source": [
"## Data Format\n",
"The AutoKeras ImageRegressor is quite flexible for the data format.\n",
"\n",
"For the image, it accepts data formats both with and without the channel\n",
"dimension. The images in the MNIST dataset do not have the channel dimension.\n",
"Each image is a matrix with shape (28, 28). AutoKeras also accepts images of\n",
"three dimensions with the channel dimension at last, e.g., (32, 32, 3), (28,\n",
"28, 1).\n",
"\n",
"For the regression targets, it should be a vector of numerical values.\n",
"AutoKeras accepts numpy.ndarray.\n"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab_type": "code"
},
"outputs": [],
"source": [
"(x_train, y_train), (x_test, y_test) = mnist.load_data()\n",
"x_train = x_train[:100]\n",
"y_train = y_train[:100]\n",
"x_test = x_test[:100]\n",
"y_test = y_test[:100]\n",
"\n",
"# Reshape the images to have the channel dimension.\n",
"x_train = x_train.reshape(x_train.shape + (1,))\n",
"x_test = x_test.reshape(x_test.shape + (1,))\n",
"y_train = y_train.reshape(y_train.shape + (1,))\n",
"y_test = y_test.reshape(y_test.shape + (1,))\n",
"\n",
"print(x_train.shape) # (60000, 28, 28, 1)\n",
"print(y_train.shape) # (60000, 10)\n",
"\n",
"reg = ak.ImageRegressor(overwrite=True, max_trials=1)\n",
"# Feed the Dataset to the regressor.\n",
"reg.fit(x_train, y_train, epochs=1)\n",
"# Predict with the best model.\n",
"predicted_y = reg.predict(x_test)\n",
"# Evaluate the best model with testing data.\n",
"print(reg.evaluate(x_test, y_test))"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand Down
13 changes: 1 addition & 12 deletions docs/ipynb/multi.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"outputs": [],
"source": [
"!export KERAS_BACKEND=\"torch\"\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The !export command in a Jupyter cell only sets the environment variable for the subshell of that specific command and does not persist for the notebook's kernel. To set the environment variable for the entire notebook session, you should use the %env magic command.

Suggested change
"!export KERAS_BACKEND=\"torch\"\n",
"%env KERAS_BACKEND=torch\n",

"!pip install autokeras"
]
},
Expand Down Expand Up @@ -296,18 +297,6 @@
"colab_type": "text"
},
"source": [
"## Data Format\n",
"You can refer to the documentation of\n",
"[ImageInput](/node/#imageinput-class),\n",
"[Input](/node/#input-class),\n",
"[TextInput](/node/#textinput-class),\n",
"[RegressionHead](/block/#regressionhead-class),\n",
"[ClassificationHead](/block/#classificationhead-class),\n",
"for the format of different types of data.\n",
"You can also refer to the Data Format section of the tutorials of\n",
"[Image Classification](/tutorial/image_classification/#data-format),\n",
"[Text Classification](/tutorial/text_classification/#data-format),\n",
"\n",
"## Reference\n",
"[AutoModel](/auto_model/#automodel-class),\n",
"[ImageInput](/node/#imageinput-class),\n",
Expand Down
Loading