We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Autokeras1.0 task api error TypeError: __init__() got an unexpected keyword argument 'seed'
### Bug Description
i have installed autokeras1.0 from git at 12/20/2019,
when i running the code bellow, i got errors

this is the code:
```
import autokeras as ak
from keras.datasets import mnist
from sklearn import exceptions
from sklearn.metrics import confusion_matrix

(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(x_train.shape + (1,))
x_test = x_test.reshape(x_test.shape + (1,))


clf = ak.ImageClassifier(max_trials=100)
clf.fit(x_train, y_train,validation_split=0.2)
y = clf.predict(x_test, y_test)
```

erros
```
Traceback (most recent call last):
  File "D:/work/python_project/autokeras_test/autokerasv1.py", line 13, in <module>
    clf.fit(x_train, y_train,validation_split=0.2)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\task.py", line 116, in fit
    **kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\auto_model.py", line 199, in fit
    **kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\tuner.py", line 138, in search
    super().search(callbacks=new_callbacks, **fit_kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\kerastuner\engine\base_tuner.py", line 122, in search
    self.run_trial(trial, *fit_args, **fit_kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\tuner.py", line 53, in run_trial
    trial.hyperparameters)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\graph.py", line 460, in build_graphs
    plain_graph = self.hyper_build(hp)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\graph.py", line 480, in hyper_build
    outputs = old_block.build(hp, inputs=inputs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\base.py", line 117, in _build_wrapper
    return self._build(hp, *args, **kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\hyperblock.py", line 62, in build
    seed=self.seed)(output_node)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\preprocessor.py", line 577, in __init__
    super().__init__(**kwargs)
  File "D:\work\python_project\autokeras_test\venv\lib\site-packages\autokeras\hypermodel\base.py", line 100, in __init__
    super().__init__(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'seed'

```

### Setup Details
Include the details about the versions of:
 - OS type and version: window 10
 - Python: 3.6
 - autokeras: 1.0
 - scikit-learn:0.22
 - numpy:1.7.14
 - keras:2.3.1
 - scipy:1.4.1
 - tensorflow:2.0.0
 - pytorch:1.1.0




--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `autokeras/hypermodel/hyperblock.py`
Content:
```
1 from tensorflow.python.util import nest
2 
3 from autokeras.hypermodel import base
4 from autokeras.hypermodel import block as block_module
5 from autokeras.hypermodel import node as node_module
6 from autokeras.hypermodel import preprocessor as preprocessor_module
7 
8 
9 class ImageBlock(base.HyperBlock):
10     """Block for image data.
11 
12     The image blocks is a block choosing from ResNetBlock, XceptionBlock, ConvBlock,
13     which is controlled by a hyperparameter, 'block_type'.
14 
15     # Arguments
16         block_type: String. 'resnet', 'xception', 'vanilla'. The type of HyperBlock
17             to use. If unspecified, it will be tuned automatically.
18         normalize: Boolean. Whether to channel-wise normalize the images.
19             If unspecified, it will be tuned automatically.
20         augment: Boolean. Whether to do image augmentation. If unspecified,
21             it will be tuned automatically.
22     """
23 
24     def __init__(self,
25                  block_type=None,
26                  normalize=None,
27                  augment=None,
28                  seed=None,
29                  **kwargs):
30         super().__init__(**kwargs)
31         self.block_type = block_type
32         self.normalize = normalize
33         self.augment = augment
34         self.seed = seed
35 
36     def get_config(self):
37         config = super().get_config()
38         config.update({'block_type': self.block_type,
39                        'normalize': self.normalize,
40                        'augment': self.augment,
41                        'seed': self.seed})
42         return config
43 
44     def build(self, hp, inputs=None):
45         input_node = nest.flatten(inputs)[0]
46         output_node = input_node
47 
48         block_type = self.block_type or hp.Choice('block_type',
49                                                   ['resnet', 'xception', 'vanilla'],
50                                                   default='vanilla')
51 
52         normalize = self.normalize
53         if normalize is None:
54             normalize = hp.Choice('normalize', [True, False], default=True)
55         augment = self.augment
56         if augment is None:
57             augment = hp.Choice('augment', [True, False], default=False)
58         if normalize:
59             output_node = preprocessor_module.Normalization()(output_node)
60         if augment:
61             output_node = preprocessor_module.ImageAugmentation(
62                 seed=self.seed)(output_node)
63         sub_block_name = self.name + '_' + block_type
64         if block_type == 'resnet':
65             output_node = block_module.ResNetBlock(name=sub_block_name)(output_node)
66         elif block_type == 'xception':
67             output_node = block_module.XceptionBlock(
68                 name=sub_block_name)(output_node)
69         elif block_type == 'vanilla':
70             output_node = block_module.ConvBlock(name=sub_block_name)(output_node)
71         return output_node
72 
73 
74 class TextBlock(base.HyperBlock):
75     """Block for text data.
76 
77     # Arguments
78         vectorizer: String. 'sequence' or 'ngram'. If it is 'sequence',
79             TextToIntSequence will be used. If it is 'ngram', TextToNgramVector will
80             be used. If unspecified, it will be tuned automatically.
81         pretraining: Boolean. Whether to use pretraining weights in the N-gram
82             vectorizer. If unspecified, it will be tuned automatically.
83     """
84 
85     def __init__(self, vectorizer=None, pretraining=None, **kwargs):
86         super().__init__(**kwargs)
87         self.vectorizer = vectorizer
88         self.pretraining = pretraining
89 
90     def get_config(self):
91         config = super().get_config()
92         config.update({'vectorizer': self.vectorizer,
93                        'pretraining': self.pretraining})
94         return config
95 
96     def build(self, hp, inputs=None):
97         input_node = nest.flatten(inputs)[0]
98         output_node = input_node
99         vectorizer = self.vectorizer or hp.Choice('vectorizer',
100                                                   ['sequence', 'ngram'],
101                                                   default='sequence')
102         if not isinstance(input_node, node_module.TextNode):
103             raise ValueError('The input_node should be a TextNode.')
104         if vectorizer == 'ngram':
105             output_node = preprocessor_module.TextToNgramVector()(output_node)
106             output_node = block_module.DenseBlock()(output_node)
107         else:
108             output_node = preprocessor_module.TextToIntSequence()(output_node)
109             output_node = block_module.EmbeddingBlock(
110                 pretraining=self.pretraining)(output_node)
111             output_node = block_module.ConvBlock(separable=True)(output_node)
112             output_node = block_module.SpatialReduction()(output_node)
113             output_node = block_module.DenseBlock()(output_node)
114         return output_node
115 
116 
117 class StructuredDataBlock(base.HyperBlock):
118     """Block for structured data.
119 
120     # Arguments
121         feature_engineering: Boolean. Whether to use feature engineering block.
122             Defaults to True. If specified as None, it will be tuned automatically.
123         module_type: String. 'dense' or 'lightgbm'. If it is 'dense', DenseBlock
124             will be used. If it is 'lightgbm', LightGBM will be used. If
125             unspecified, it will be tuned automatically.
126         seed: Int. Random seed.
127     """
128 
129     def __init__(self,
130                  feature_engineering=True,
131                  module_type=None,
132                  seed=None,
133                  **kwargs):
134         super().__init__(**kwargs)
135         self.feature_engineering = feature_engineering
136         self.module_type = module_type
137         self.num_heads = None
138         self.seed = seed
139 
140     def get_config(self):
141         config = super().get_config()
142         config.update({'feature_engineering': self.feature_engineering,
143                        'module_type': self.module_type,
144                        'seed': self.seed})
145         return config
146 
147     def get_state(self):
148         state = super().get_state()
149         state.update({'num_heads': self.num_heads})
150         return state
151 
152     def set_state(self, state):
153         super().set_state(state)
154         self.num_heads = state.get('num_heads')
155 
156     def build_feature_engineering(self, hp, input_node):
157         output_node = input_node
158         feature_engineering = self.feature_engineering
159         if feature_engineering is None:
160             # TODO: If False, use plain label encoding.
161             feature_engineering = hp.Choice('feature_engineering',
162                                             [True],
163                                             default=True)
164         if feature_engineering:
165             output_node = preprocessor_module.FeatureEngineering()(output_node)
166         return output_node
167 
168     def build_body(self, hp, input_node):
169         if self.num_heads > 1:
170             module_type_choices = ['dense']
171         else:
172             module_type_choices = ['lightgbm', 'dense']
173         module_type = self.module_type or hp.Choice('module_type',
174                                                     module_type_choices,
175                                                     default=module_type_choices[0])
176         if module_type == 'dense':
177             output_node = block_module.DenseBlock()(input_node)
178         elif module_type == 'lightgbm':
179             output_node = preprocessor_module.LightGBM(
180                 seed=self.seed)(input_node)
181         else:
182             raise ValueError('Unsupported module'
183                              'type: {module_type}'.format(
184                                  module_type=module_type))
185         nest.flatten(output_node)[0].shape = self.output_shape
186         return output_node
187 
188     def build(self, hp, inputs=None):
189         input_node = nest.flatten(inputs)[0]
190         output_node = self.build_feature_engineering(hp, input_node)
191         output_node = self.build_body(hp, output_node)
192         return output_node
193 
194 
195 class TimeSeriesBlock(base.HyperBlock):
196 
197     def build(self, hp, inputs=None):
198         raise NotImplementedError
199 
200 
201 class GeneralBlock(base.HyperBlock):
202     """A general neural network block when the input type is unknown.
203 
204     When the input type is unknown. The GeneralBlock would search in a large space
205     for a good model.
206 
207     # Arguments
208         name: String.
209     """
210 
211     def build(self, hp, inputs=None):
212         raise NotImplementedError
213
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/autokeras/hypermodel/hyperblock.py b/autokeras/hypermodel/hyperblock.py
--- a/autokeras/hypermodel/hyperblock.py
+++ b/autokeras/hypermodel/hyperblock.py
@@ -58,8 +58,7 @@
         if normalize:
             output_node = preprocessor_module.Normalization()(output_node)
         if augment:
-            output_node = preprocessor_module.ImageAugmentation(
-                seed=self.seed)(output_node)
+            output_node = preprocessor_module.ImageAugmentation()(output_node)
         sub_block_name = self.name + '_' + block_type
         if block_type == 'resnet':
             output_node = block_module.ResNetBlock(name=sub_block_name)(output_node)

{"golden_diff": "diff --git a/autokeras/hypermodel/hyperblock.py b/autokeras/hypermodel/hyperblock.py\n--- a/autokeras/hypermodel/hyperblock.py\n+++ b/autokeras/hypermodel/hyperblock.py\n@@ -58,8 +58,7 @@\n         if normalize:\n             output_node = preprocessor_module.Normalization()(output_node)\n         if augment:\n-            output_node = preprocessor_module.ImageAugmentation(\n-                seed=self.seed)(output_node)\n+            output_node = preprocessor_module.ImageAugmentation()(output_node)\n         sub_block_name = self.name + '_' + block_type\n         if block_type == 'resnet':\n             output_node = block_module.ResNetBlock(name=sub_block_name)(output_node)\n", "issue": "Autokeras1.0 task api error TypeError: __init__() got an unexpected keyword argument 'seed'\n### Bug Description\r\ni have installed autokeras1.0 from git at 12/20/2019,\r\nwhen i running the code bellow, i got errors\r\n\r\nthis is the code:\r\n```\r\nimport autokeras as ak\r\nfrom keras.datasets import mnist\r\nfrom sklearn import exceptions\r\nfrom sklearn.metrics import confusion_matrix\r\n\r\n(x_train, y_train), (x_test, y_test) = mnist.load_data()\r\nx_train = x_train.reshape(x_train.shape + (1,))\r\nx_test = x_test.reshape(x_test.shape + (1,))\r\n\r\n\r\nclf = ak.ImageClassifier(max_trials=100)\r\nclf.fit(x_train, y_train,validation_split=0.2)\r\ny = clf.predict(x_test, y_test)\r\n```\r\n\r\nerros\r\n```\r\nTraceback (most recent call last):\r\n  File \"D:/work/python_project/autokeras_test/autokerasv1.py\", line 13, in <module>\r\n    clf.fit(x_train, y_train,validation_split=0.2)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\task.py\", line 116, in fit\r\n    **kwargs)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\auto_model.py\", line 199, in fit\r\n    **kwargs)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\tuner.py\", line 138, in search\r\n    super().search(callbacks=new_callbacks, **fit_kwargs)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\kerastuner\\engine\\base_tuner.py\", line 122, in search\r\n    self.run_trial(trial, *fit_args, **fit_kwargs)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\tuner.py\", line 53, in run_trial\r\n    trial.hyperparameters)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\hypermodel\\graph.py\", line 460, in build_graphs\r\n    plain_graph = self.hyper_build(hp)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\hypermodel\\graph.py\", line 480, in hyper_build\r\n    outputs = old_block.build(hp, inputs=inputs)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\hypermodel\\base.py\", line 117, in _build_wrapper\r\n    return self._build(hp, *args, **kwargs)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\hypermodel\\hyperblock.py\", line 62, in build\r\n    seed=self.seed)(output_node)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\hypermodel\\preprocessor.py\", line 577, in __init__\r\n    super().__init__(**kwargs)\r\n  File \"D:\\work\\python_project\\autokeras_test\\venv\\lib\\site-packages\\autokeras\\hypermodel\\base.py\", line 100, in __init__\r\n    super().__init__(**kwargs)\r\nTypeError: __init__() got an unexpected keyword argument 'seed'\r\n\r\n```\r\n\r\n### Setup Details\r\nInclude the details about the versions of:\r\n - OS type and version: window 10\r\n - Python: 3.6\r\n - autokeras: 1.0\r\n - scikit-learn:0.22\r\n - numpy:1.7.14\r\n - keras:2.3.1\r\n - scipy:1.4.1\r\n - tensorflow:2.0.0\r\n - pytorch:1.1.0\r\n\r\n\r\n\n", "before_files": [{"content": "from tensorflow.python.util import nest\n\nfrom autokeras.hypermodel import base\nfrom autokeras.hypermodel import block as block_module\nfrom autokeras.hypermodel import node as node_module\nfrom autokeras.hypermodel import preprocessor as preprocessor_module\n\n\nclass ImageBlock(base.HyperBlock):\n    \"\"\"Block for image data.\n\n    The image blocks is a block choosing from ResNetBlock, XceptionBlock, ConvBlock,\n    which is controlled by a hyperparameter, 'block_type'.\n\n    # Arguments\n        block_type: String. 'resnet', 'xception', 'vanilla'. The type of HyperBlock\n            to use. If unspecified, it will be tuned automatically.\n        normalize: Boolean. Whether to channel-wise normalize the images.\n            If unspecified, it will be tuned automatically.\n        augment: Boolean. Whether to do image augmentation. If unspecified,\n            it will be tuned automatically.\n    \"\"\"\n\n    def __init__(self,\n                 block_type=None,\n                 normalize=None,\n                 augment=None,\n                 seed=None,\n                 **kwargs):\n        super().__init__(**kwargs)\n        self.block_type = block_type\n        self.normalize = normalize\n        self.augment = augment\n        self.seed = seed\n\n    def get_config(self):\n        config = super().get_config()\n        config.update({'block_type': self.block_type,\n                       'normalize': self.normalize,\n                       'augment': self.augment,\n                       'seed': self.seed})\n        return config\n\n    def build(self, hp, inputs=None):\n        input_node = nest.flatten(inputs)[0]\n        output_node = input_node\n\n        block_type = self.block_type or hp.Choice('block_type',\n                                                  ['resnet', 'xception', 'vanilla'],\n                                                  default='vanilla')\n\n        normalize = self.normalize\n        if normalize is None:\n            normalize = hp.Choice('normalize', [True, False], default=True)\n        augment = self.augment\n        if augment is None:\n            augment = hp.Choice('augment', [True, False], default=False)\n        if normalize:\n            output_node = preprocessor_module.Normalization()(output_node)\n        if augment:\n            output_node = preprocessor_module.ImageAugmentation(\n                seed=self.seed)(output_node)\n        sub_block_name = self.name + '_' + block_type\n        if block_type == 'resnet':\n            output_node = block_module.ResNetBlock(name=sub_block_name)(output_node)\n        elif block_type == 'xception':\n            output_node = block_module.XceptionBlock(\n                name=sub_block_name)(output_node)\n        elif block_type == 'vanilla':\n            output_node = block_module.ConvBlock(name=sub_block_name)(output_node)\n        return output_node\n\n\nclass TextBlock(base.HyperBlock):\n    \"\"\"Block for text data.\n\n    # Arguments\n        vectorizer: String. 'sequence' or 'ngram'. If it is 'sequence',\n            TextToIntSequence will be used. If it is 'ngram', TextToNgramVector will\n            be used. If unspecified, it will be tuned automatically.\n        pretraining: Boolean. Whether to use pretraining weights in the N-gram\n            vectorizer. If unspecified, it will be tuned automatically.\n    \"\"\"\n\n    def __init__(self, vectorizer=None, pretraining=None, **kwargs):\n        super().__init__(**kwargs)\n        self.vectorizer = vectorizer\n        self.pretraining = pretraining\n\n    def get_config(self):\n        config = super().get_config()\n        config.update({'vectorizer': self.vectorizer,\n                       'pretraining': self.pretraining})\n        return config\n\n    def build(self, hp, inputs=None):\n        input_node = nest.flatten(inputs)[0]\n        output_node = input_node\n        vectorizer = self.vectorizer or hp.Choice('vectorizer',\n                                                  ['sequence', 'ngram'],\n                                                  default='sequence')\n        if not isinstance(input_node, node_module.TextNode):\n            raise ValueError('The input_node should be a TextNode.')\n        if vectorizer == 'ngram':\n            output_node = preprocessor_module.TextToNgramVector()(output_node)\n            output_node = block_module.DenseBlock()(output_node)\n        else:\n            output_node = preprocessor_module.TextToIntSequence()(output_node)\n            output_node = block_module.EmbeddingBlock(\n                pretraining=self.pretraining)(output_node)\n            output_node = block_module.ConvBlock(separable=True)(output_node)\n            output_node = block_module.SpatialReduction()(output_node)\n            output_node = block_module.DenseBlock()(output_node)\n        return output_node\n\n\nclass StructuredDataBlock(base.HyperBlock):\n    \"\"\"Block for structured data.\n\n    # Arguments\n        feature_engineering: Boolean. Whether to use feature engineering block.\n            Defaults to True. If specified as None, it will be tuned automatically.\n        module_type: String. 'dense' or 'lightgbm'. If it is 'dense', DenseBlock\n            will be used. If it is 'lightgbm', LightGBM will be used. If\n            unspecified, it will be tuned automatically.\n        seed: Int. Random seed.\n    \"\"\"\n\n    def __init__(self,\n                 feature_engineering=True,\n                 module_type=None,\n                 seed=None,\n                 **kwargs):\n        super().__init__(**kwargs)\n        self.feature_engineering = feature_engineering\n        self.module_type = module_type\n        self.num_heads = None\n        self.seed = seed\n\n    def get_config(self):\n        config = super().get_config()\n        config.update({'feature_engineering': self.feature_engineering,\n                       'module_type': self.module_type,\n                       'seed': self.seed})\n        return config\n\n    def get_state(self):\n        state = super().get_state()\n        state.update({'num_heads': self.num_heads})\n        return state\n\n    def set_state(self, state):\n        super().set_state(state)\n        self.num_heads = state.get('num_heads')\n\n    def build_feature_engineering(self, hp, input_node):\n        output_node = input_node\n        feature_engineering = self.feature_engineering\n        if feature_engineering is None:\n            # TODO: If False, use plain label encoding.\n            feature_engineering = hp.Choice('feature_engineering',\n                                            [True],\n                                            default=True)\n        if feature_engineering:\n            output_node = preprocessor_module.FeatureEngineering()(output_node)\n        return output_node\n\n    def build_body(self, hp, input_node):\n        if self.num_heads > 1:\n            module_type_choices = ['dense']\n        else:\n            module_type_choices = ['lightgbm', 'dense']\n        module_type = self.module_type or hp.Choice('module_type',\n                                                    module_type_choices,\n                                                    default=module_type_choices[0])\n        if module_type == 'dense':\n            output_node = block_module.DenseBlock()(input_node)\n        elif module_type == 'lightgbm':\n            output_node = preprocessor_module.LightGBM(\n                seed=self.seed)(input_node)\n        else:\n            raise ValueError('Unsupported module'\n                             'type: {module_type}'.format(\n                                 module_type=module_type))\n        nest.flatten(output_node)[0].shape = self.output_shape\n        return output_node\n\n    def build(self, hp, inputs=None):\n        input_node = nest.flatten(inputs)[0]\n        output_node = self.build_feature_engineering(hp, input_node)\n        output_node = self.build_body(hp, output_node)\n        return output_node\n\n\nclass TimeSeriesBlock(base.HyperBlock):\n\n    def build(self, hp, inputs=None):\n        raise NotImplementedError\n\n\nclass GeneralBlock(base.HyperBlock):\n    \"\"\"A general neural network block when the input type is unknown.\n\n    When the input type is unknown. The GeneralBlock would search in a large space\n    for a good model.\n\n    # Arguments\n        name: String.\n    \"\"\"\n\n    def build(self, hp, inputs=None):\n        raise NotImplementedError\n", "path": "autokeras/hypermodel/hyperblock.py"}], "after_files": [{"content": "from tensorflow.python.util import nest\n\nfrom autokeras.hypermodel import base\nfrom autokeras.hypermodel import block as block_module\nfrom autokeras.hypermodel import node as node_module\nfrom autokeras.hypermodel import preprocessor as preprocessor_module\n\n\nclass ImageBlock(base.HyperBlock):\n    \"\"\"Block for image data.\n\n    The image blocks is a block choosing from ResNetBlock, XceptionBlock, ConvBlock,\n    which is controlled by a hyperparameter, 'block_type'.\n\n    # Arguments\n        block_type: String. 'resnet', 'xception', 'vanilla'. The type of HyperBlock\n            to use. If unspecified, it will be tuned automatically.\n        normalize: Boolean. Whether to channel-wise normalize the images.\n            If unspecified, it will be tuned automatically.\n        augment: Boolean. Whether to do image augmentation. If unspecified,\n            it will be tuned automatically.\n    \"\"\"\n\n    def __init__(self,\n                 block_type=None,\n                 normalize=None,\n                 augment=None,\n                 seed=None,\n                 **kwargs):\n        super().__init__(**kwargs)\n        self.block_type = block_type\n        self.normalize = normalize\n        self.augment = augment\n        self.seed = seed\n\n    def get_config(self):\n        config = super().get_config()\n        config.update({'block_type': self.block_type,\n                       'normalize': self.normalize,\n                       'augment': self.augment,\n                       'seed': self.seed})\n        return config\n\n    def build(self, hp, inputs=None):\n        input_node = nest.flatten(inputs)[0]\n        output_node = input_node\n\n        block_type = self.block_type or hp.Choice('block_type',\n                                                  ['resnet', 'xception', 'vanilla'],\n                                                  default='vanilla')\n\n        normalize = self.normalize\n        if normalize is None:\n            normalize = hp.Choice('normalize', [True, False], default=True)\n        augment = self.augment\n        if augment is None:\n            augment = hp.Choice('augment', [True, False], default=False)\n        if normalize:\n            output_node = preprocessor_module.Normalization()(output_node)\n        if augment:\n            output_node = preprocessor_module.ImageAugmentation()(output_node)\n        sub_block_name = self.name + '_' + block_type\n        if block_type == 'resnet':\n            output_node = block_module.ResNetBlock(name=sub_block_name)(output_node)\n        elif block_type == 'xception':\n            output_node = block_module.XceptionBlock(\n                name=sub_block_name)(output_node)\n        elif block_type == 'vanilla':\n            output_node = block_module.ConvBlock(name=sub_block_name)(output_node)\n        return output_node\n\n\nclass TextBlock(base.HyperBlock):\n    \"\"\"Block for text data.\n\n    # Arguments\n        vectorizer: String. 'sequence' or 'ngram'. If it is 'sequence',\n            TextToIntSequence will be used. If it is 'ngram', TextToNgramVector will\n            be used. If unspecified, it will be tuned automatically.\n        pretraining: Boolean. Whether to use pretraining weights in the N-gram\n            vectorizer. If unspecified, it will be tuned automatically.\n    \"\"\"\n\n    def __init__(self, vectorizer=None, pretraining=None, **kwargs):\n        super().__init__(**kwargs)\n        self.vectorizer = vectorizer\n        self.pretraining = pretraining\n\n    def get_config(self):\n        config = super().get_config()\n        config.update({'vectorizer': self.vectorizer,\n                       'pretraining': self.pretraining})\n        return config\n\n    def build(self, hp, inputs=None):\n        input_node = nest.flatten(inputs)[0]\n        output_node = input_node\n        vectorizer = self.vectorizer or hp.Choice('vectorizer',\n                                                  ['sequence', 'ngram'],\n                                                  default='sequence')\n        if not isinstance(input_node, node_module.TextNode):\n            raise ValueError('The input_node should be a TextNode.')\n        if vectorizer == 'ngram':\n            output_node = preprocessor_module.TextToNgramVector()(output_node)\n            output_node = block_module.DenseBlock()(output_node)\n        else:\n            output_node = preprocessor_module.TextToIntSequence()(output_node)\n            output_node = block_module.EmbeddingBlock(\n                pretraining=self.pretraining)(output_node)\n            output_node = block_module.ConvBlock(separable=True)(output_node)\n            output_node = block_module.SpatialReduction()(output_node)\n            output_node = block_module.DenseBlock()(output_node)\n        return output_node\n\n\nclass StructuredDataBlock(base.HyperBlock):\n    \"\"\"Block for structured data.\n\n    # Arguments\n        feature_engineering: Boolean. Whether to use feature engineering block.\n            Defaults to True. If specified as None, it will be tuned automatically.\n        module_type: String. 'dense' or 'lightgbm'. If it is 'dense', DenseBlock\n            will be used. If it is 'lightgbm', LightGBM will be used. If\n            unspecified, it will be tuned automatically.\n        seed: Int. Random seed.\n    \"\"\"\n\n    def __init__(self,\n                 feature_engineering=True,\n                 module_type=None,\n                 seed=None,\n                 **kwargs):\n        super().__init__(**kwargs)\n        self.feature_engineering = feature_engineering\n        self.module_type = module_type\n        self.num_heads = None\n        self.seed = seed\n\n    def get_config(self):\n        config = super().get_config()\n        config.update({'feature_engineering': self.feature_engineering,\n                       'module_type': self.module_type,\n                       'seed': self.seed})\n        return config\n\n    def get_state(self):\n        state = super().get_state()\n        state.update({'num_heads': self.num_heads})\n        return state\n\n    def set_state(self, state):\n        super().set_state(state)\n        self.num_heads = state.get('num_heads')\n\n    def build_feature_engineering(self, hp, input_node):\n        output_node = input_node\n        feature_engineering = self.feature_engineering\n        if feature_engineering is None:\n            # TODO: If False, use plain label encoding.\n            feature_engineering = hp.Choice('feature_engineering',\n                                            [True],\n                                            default=True)\n        if feature_engineering:\n            output_node = preprocessor_module.FeatureEngineering()(output_node)\n        return output_node\n\n    def build_body(self, hp, input_node):\n        if self.num_heads > 1:\n            module_type_choices = ['dense']\n        else:\n            module_type_choices = ['lightgbm', 'dense']\n        module_type = self.module_type or hp.Choice('module_type',\n                                                    module_type_choices,\n                                                    default=module_type_choices[0])\n        if module_type == 'dense':\n            output_node = block_module.DenseBlock()(input_node)\n        elif module_type == 'lightgbm':\n            output_node = preprocessor_module.LightGBM(\n                seed=self.seed)(input_node)\n        else:\n            raise ValueError('Unsupported module'\n                             'type: {module_type}'.format(\n                                 module_type=module_type))\n        nest.flatten(output_node)[0].shape = self.output_shape\n        return output_node\n\n    def build(self, hp, inputs=None):\n        input_node = nest.flatten(inputs)[0]\n        output_node = self.build_feature_engineering(hp, input_node)\n        output_node = self.build_body(hp, output_node)\n        return output_node\n\n\nclass TimeSeriesBlock(base.HyperBlock):\n\n    def build(self, hp, inputs=None):\n        raise NotImplementedError\n\n\nclass GeneralBlock(base.HyperBlock):\n    \"\"\"A general neural network block when the input type is unknown.\n\n    When the input type is unknown. The GeneralBlock would search in a large space\n    for a good model.\n\n    # Arguments\n        name: String.\n    \"\"\"\n\n    def build(self, hp, inputs=None):\n        raise NotImplementedError\n", "path": "autokeras/hypermodel/hyperblock.py"}]}