payload: {"action":"created","comment":{"url":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/comments/266213819","pull_request_review_id":215328525,"id":266213819,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI2NjIxMzgxOQ==","diff_hunk":"@@ -0,0 +1,117 @@\n+import numpy as np\n+from tensorflow.keras.preprocessing.image import ImageDataGenerator\n+from autokeras.constant import Constant\n+from autokeras.preprocessor import DataTransformer\n+\n+\n+class ImageDataTransformer(DataTransformer):\n+    \"\"\" Perform basic image transformation and augmentation.\n+\n+    Attributes:\n+        max_val: the maximum value of all data.\n+        mean: the mean value.\n+        std: the standard deviation.\n+        augment: whether to perform augmentation on data.\n+    \"\"\"\n+\n+    def __init__(self, data, augment=None):\n+        super().__init__()\n+        self.max_val = data.max()\n+        data = data / self.max_val\n+        self.mean = np.mean(data, axis=(0, 1, 2), keepdims=True).flatten()\n+        self.std = np.std(data, axis=(0, 1, 2), keepdims=True).flatten()\n+        if augment is None:\n+            self.augment = Constant.DATA_AUGMENTATION\n+        else:\n+            self.augment = augment\n+\n+    def transform_train(self, data, targets=None, batch_size=None):\n+        \"\"\" Transform the training data, perform random cropping data augmentation and basic random flip augmentation.\n+\n+        Args:\n+            data: Numpy array. The data to be transformed.\n+            batch_size: int batch_size.\n+            targets: the target of training set.\n+\n+        Returns:\n+            A DataLoader class instance.\n+        \"\"\"\n+\n+        # TODO: RandomCrop, HorizontalFlip Customize Probability, Cutout\n+        # channel-wise normalize the image\n+        data = data / self.max_val\n+        data = (data - self.mean)/self.std\n+\n+        # other transformation\n+        if self.augment:\n+            datagen = ImageDataGenerator(\n+                # rescale image pixels to [0, 1]\n+                rescale=None,  # 1. / self.max_val,\n+                # set input mean to 0 over the dataset\n+                featurewise_center=False,\n+                # set each sample mean to 0\n+                samplewise_center=False,\n+                # divide inputs by std of dataset\n+                featurewise_std_normalization=False,\n+                # divide each input by its std\n+                samplewise_std_normalization=False,\n+                # apply ZCA whitening\n+                zca_whitening=False,\n+                # randomly rotate images in the range (deg 0 to 180)\n+                rotation_range=0,\n+                # randomly shift images horizontally\n+                width_shift_range=0.1,\n+                # randomly shift images vertically\n+                height_shift_range=0.1,\n+                # randomly flip images\n+                horizontal_flip=True,\n+                # randomly flip images\n+                vertical_flip=False)\n+        else:\n+            datagen = ImageDataGenerator()\n+\n+        datagen.fit(data)\n+\n+        if batch_size is None:\n+            batch_size = Constant.MAX_BATCH_SIZE\n+        batch_size = min(len(data), batch_size)\n+        return datagen.flow(data, targets, batch_size, shuffle=True)\n+\n+    def transform_test(self, data, targets=None, batch_size=None):\n+        \"\"\" Transform the test data, perform normalization.\n+\n+        Args:\n+            data: Numpy array. The data to be transformed.\n+            batch_size: int batch_size.\n+            targets: the target of test set.\n+        Returns:\n+            A DataLoader instance.\n+        \"\"\"\n+        # channel-wise normalize the image\n+        data = data / self.max_val\n+        data = (data - self.mean)/self.std\n+\n+        datagen = ImageDataGenerator()\n+        if batch_size is None:\n+            batch_size = Constant.MAX_BATCH_SIZE\n+        batch_size = min(len(data), batch_size)\n+        return datagen.flow(data, targets, batch_size, shuffle=False)\n+\n+\n+class DataTransformerMlp(DataTransformer):\n+    def __init__(self, data):\n+        super().__init__()\n+        self.mean = np.mean(data, axis=0)\n+        self.std = np.std(data, axis=0)\n+\n+    def transform_train(self, data, targets=None, batch_size=None):\n+        data = (data - self.mean) / self.std\n+        data = np.nan_to_num(data)\n+        datagen = ImageDataGenerator()\n+        if batch_size is None:\n+            batch_size = Constant.MAX_BATCH_SIZE\n+        batch_size = min(len(data), batch_size)\n+        return datagen.flow(data, targets, batch_size, shuffle=True)\n+\n+    def transform_test(self, data, target=None, batch_size=None):","path":"autokeras/backend/tensorflow/data_transformer.py","position":116,"original_position":116,"commit_id":"03f0b36e453dd0601745bb0aa133a7bce6b5c117","original_commit_id":"03f0b36e453dd0601745bb0aa133a7bce6b5c117","user":{"login":"codacy-bot","id":19940114,"node_id":"MDQ6VXNlcjE5OTQwMTE0","avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Parameters differ from overridden 'transform_test' method](https://app.codacy.com/app/jhfjhfj1/autokeras/pullRequest?prid=3277968)","created_at":"2019-03-16T20:19:48Z","updated_at":"2019-03-16T20:19:48Z","html_url":"https://github.com/jhfjhfj1/autokeras/pull/583#discussion_r266213819","pull_request_url":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/583","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/comments/266213819"},"html":{"href":"https://github.com/jhfjhfj1/autokeras/pull/583#discussion_r266213819"},"pull_request":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/583"}}},"pull_request":{"url":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/583","id":261789922,"node_id":"MDExOlB1bGxSZXF1ZXN0MjYxNzg5OTIy","html_url":"https://github.com/jhfjhfj1/autokeras/pull/583","diff_url":"https://github.com/jhfjhfj1/autokeras/pull/583.diff","patch_url":"https://github.com/jhfjhfj1/autokeras/pull/583.patch","issue_url":"https://api.github.com/repos/jhfjhfj1/autokeras/issues/583","number":583,"state":"open","locked":false,"title":"Backend","user":{"login":"pjpan","id":4448787,"node_id":"MDQ6VXNlcjQ0NDg3ODc=","avatar_url":"https://avatars1.githubusercontent.com/u/4448787?v=4","gravatar_id":"","url":"https://api.github.com/users/pjpan","html_url":"https://github.com/pjpan","followers_url":"https://api.github.com/users/pjpan/followers","following_url":"https://api.github.com/users/pjpan/following{/other_user}","gists_url":"https://api.github.com/users/pjpan/gists{/gist_id}","starred_url":"https://api.github.com/users/pjpan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjpan/subscriptions","organizations_url":"https://api.github.com/users/pjpan/orgs","repos_url":"https://api.github.com/users/pjpan/repos","events_url":"https://api.github.com/users/pjpan/events{/privacy}","received_events_url":"https://api.github.com/users/pjpan/received_events","type":"User","site_admin":false},"body":"This pull request resolves #ISSUE_NUMBER.\r\n\r\nThe pull request is in progress.\r\nOR\r\nThe pull request is ready to be merged.\r\n\r\nThe details of the pull request:\r\n","created_at":"2019-03-16T18:06:31Z","updated_at":"2019-03-16T20:19:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b4cc11ee1892d02ee721d4c4ed1f46f835a9c81","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/583/commits","review_comments_url":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/583/comments","review_comment_url":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jhfjhfj1/autokeras/issues/583/comments","statuses_url":"https://api.github.com/repos/jhfjhfj1/autokeras/statuses/03f0b36e453dd0601745bb0aa133a7bce6b5c117","head":{"label":"jhfjhfj1:backend","ref":"backend","sha":"03f0b36e453dd0601745bb0aa133a7bce6b5c117","user":{"login":"jhfjhfj1","id":5476582,"node_id":"MDQ6VXNlcjU0NzY1ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/5476582?v=4","gravatar_id":"","url":"https://api.github.com/users/jhfjhfj1","html_url":"https://github.com/jhfjhfj1","followers_url":"https://api.github.com/users/jhfjhfj1/followers","following_url":"https://api.github.com/users/jhfjhfj1/following{/other_user}","gists_url":"https://api.github.com/users/jhfjhfj1/gists{/gist_id}","starred_url":"https://api.github.com/users/jhfjhfj1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhfjhfj1/subscriptions","organizations_url":"https://api.github.com/users/jhfjhfj1/orgs","repos_url":"https://api.github.com/users/jhfjhfj1/repos","events_url":"https://api.github.com/users/jhfjhfj1/events{/privacy}","received_events_url":"https://api.github.com/users/jhfjhfj1/received_events","type":"User","site_admin":false},"repo":{"id":111340129,"node_id":"MDEwOlJlcG9zaXRvcnkxMTEzNDAxMjk=","name":"autokeras","full_name":"jhfjhfj1/autokeras","private":false,"owner":{"login":"jhfjhfj1","id":5476582,"node_id":"MDQ6VXNlcjU0NzY1ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/5476582?v=4","gravatar_id":"","url":"https://api.github.com/users/jhfjhfj1","html_url":"https://github.com/jhfjhfj1","followers_url":"https://api.github.com/users/jhfjhfj1/followers","following_url":"https://api.github.com/users/jhfjhfj1/following{/other_user}","gists_url":"https://api.github.com/users/jhfjhfj1/gists{/gist_id}","starred_url":"https://api.github.com/users/jhfjhfj1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhfjhfj1/subscriptions","organizations_url":"https://api.github.com/users/jhfjhfj1/orgs","repos_url":"https://api.github.com/users/jhfjhfj1/repos","events_url":"https://api.github.com/users/jhfjhfj1/events{/privacy}","received_events_url":"https://api.github.com/users/jhfjhfj1/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jhfjhfj1/autokeras","description":"accessible AutoML for deep learning.","fork":false,"url":"https://api.github.com/repos/jhfjhfj1/autokeras","forks_url":"https://api.github.com/repos/jhfjhfj1/autokeras/forks","keys_url":"https://api.github.com/repos/jhfjhfj1/autokeras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhfjhfj1/autokeras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhfjhfj1/autokeras/teams","hooks_url":"https://api.github.com/repos/jhfjhfj1/autokeras/hooks","issue_events_url":"https://api.github.com/repos/jhfjhfj1/autokeras/issues/events{/number}","events_url":"https://api.github.com/repos/jhfjhfj1/autokeras/events","assignees_url":"https://api.github.com/repos/jhfjhfj1/autokeras/assignees{/user}","branches_url":"https://api.github.com/repos/jhfjhfj1/autokeras/branches{/branch}","tags_url":"https://api.github.com/repos/jhfjhfj1/autokeras/tags","blobs_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhfjhfj1/autokeras/statuses/{sha}","languages_url":"https://api.github.com/repos/jhfjhfj1/autokeras/languages","stargazers_url":"https://api.github.com/repos/jhfjhfj1/autokeras/stargazers","contributors_url":"https://api.github.com/repos/jhfjhfj1/autokeras/contributors","subscribers_url":"https://api.github.com/repos/jhfjhfj1/autokeras/subscribers","subscription_url":"https://api.github.com/repos/jhfjhfj1/autokeras/subscription","commits_url":"https://api.github.com/repos/jhfjhfj1/autokeras/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhfjhfj1/autokeras/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhfjhfj1/autokeras/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhfjhfj1/autokeras/contents/{+path}","compare_url":"https://api.github.com/repos/jhfjhfj1/autokeras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhfjhfj1/autokeras/merges","archive_url":"https://api.github.com/repos/jhfjhfj1/autokeras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhfjhfj1/autokeras/downloads","issues_url":"https://api.github.com/repos/jhfjhfj1/autokeras/issues{/number}","pulls_url":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls{/number}","milestones_url":"https://api.github.com/repos/jhfjhfj1/autokeras/milestones{/number}","notifications_url":"https://api.github.com/repos/jhfjhfj1/autokeras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhfjhfj1/autokeras/labels{/name}","releases_url":"https://api.github.com/repos/jhfjhfj1/autokeras/releases{/id}","deployments_url":"https://api.github.com/repos/jhfjhfj1/autokeras/deployments","created_at":"2017-11-19T23:18:20Z","updated_at":"2019-03-16T17:35:33Z","pushed_at":"2019-03-16T20:17:47Z","git_url":"git://github.com/jhfjhfj1/autokeras.git","ssh_url":"git@github.com:jhfjhfj1/autokeras.git","clone_url":"https://github.com/jhfjhfj1/autokeras.git","svn_url":"https://github.com/jhfjhfj1/autokeras","homepage":"http://autokeras.com/","size":71543,"stargazers_count":4833,"watchers_count":4833,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":714,"mirror_url":null,"archived":false,"open_issues_count":102,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":714,"open_issues":102,"watchers":4833,"default_branch":"master"}},"base":{"label":"jhfjhfj1:master","ref":"master","sha":"76b07e64cf693cff7531f0bd7b5bca4fc9faf18c","user":{"login":"jhfjhfj1","id":5476582,"node_id":"MDQ6VXNlcjU0NzY1ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/5476582?v=4","gravatar_id":"","url":"https://api.github.com/users/jhfjhfj1","html_url":"https://github.com/jhfjhfj1","followers_url":"https://api.github.com/users/jhfjhfj1/followers","following_url":"https://api.github.com/users/jhfjhfj1/following{/other_user}","gists_url":"https://api.github.com/users/jhfjhfj1/gists{/gist_id}","starred_url":"https://api.github.com/users/jhfjhfj1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhfjhfj1/subscriptions","organizations_url":"https://api.github.com/users/jhfjhfj1/orgs","repos_url":"https://api.github.com/users/jhfjhfj1/repos","events_url":"https://api.github.com/users/jhfjhfj1/events{/privacy}","received_events_url":"https://api.github.com/users/jhfjhfj1/received_events","type":"User","site_admin":false},"repo":{"id":111340129,"node_id":"MDEwOlJlcG9zaXRvcnkxMTEzNDAxMjk=","name":"autokeras","full_name":"jhfjhfj1/autokeras","private":false,"owner":{"login":"jhfjhfj1","id":5476582,"node_id":"MDQ6VXNlcjU0NzY1ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/5476582?v=4","gravatar_id":"","url":"https://api.github.com/users/jhfjhfj1","html_url":"https://github.com/jhfjhfj1","followers_url":"https://api.github.com/users/jhfjhfj1/followers","following_url":"https://api.github.com/users/jhfjhfj1/following{/other_user}","gists_url":"https://api.github.com/users/jhfjhfj1/gists{/gist_id}","starred_url":"https://api.github.com/users/jhfjhfj1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhfjhfj1/subscriptions","organizations_url":"https://api.github.com/users/jhfjhfj1/orgs","repos_url":"https://api.github.com/users/jhfjhfj1/repos","events_url":"https://api.github.com/users/jhfjhfj1/events{/privacy}","received_events_url":"https://api.github.com/users/jhfjhfj1/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jhfjhfj1/autokeras","description":"accessible AutoML for deep learning.","fork":false,"url":"https://api.github.com/repos/jhfjhfj1/autokeras","forks_url":"https://api.github.com/repos/jhfjhfj1/autokeras/forks","keys_url":"https://api.github.com/repos/jhfjhfj1/autokeras/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhfjhfj1/autokeras/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhfjhfj1/autokeras/teams","hooks_url":"https://api.github.com/repos/jhfjhfj1/autokeras/hooks","issue_events_url":"https://api.github.com/repos/jhfjhfj1/autokeras/issues/events{/number}","events_url":"https://api.github.com/repos/jhfjhfj1/autokeras/events","assignees_url":"https://api.github.com/repos/jhfjhfj1/autokeras/assignees{/user}","branches_url":"https://api.github.com/repos/jhfjhfj1/autokeras/branches{/branch}","tags_url":"https://api.github.com/repos/jhfjhfj1/autokeras/tags","blobs_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhfjhfj1/autokeras/statuses/{sha}","languages_url":"https://api.github.com/repos/jhfjhfj1/autokeras/languages","stargazers_url":"https://api.github.com/repos/jhfjhfj1/autokeras/stargazers","contributors_url":"https://api.github.com/repos/jhfjhfj1/autokeras/contributors","subscribers_url":"https://api.github.com/repos/jhfjhfj1/autokeras/subscribers","subscription_url":"https://api.github.com/repos/jhfjhfj1/autokeras/subscription","commits_url":"https://api.github.com/repos/jhfjhfj1/autokeras/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhfjhfj1/autokeras/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhfjhfj1/autokeras/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhfjhfj1/autokeras/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhfjhfj1/autokeras/contents/{+path}","compare_url":"https://api.github.com/repos/jhfjhfj1/autokeras/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhfjhfj1/autokeras/merges","archive_url":"https://api.github.com/repos/jhfjhfj1/autokeras/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhfjhfj1/autokeras/downloads","issues_url":"https://api.github.com/repos/jhfjhfj1/autokeras/issues{/number}","pulls_url":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls{/number}","milestones_url":"https://api.github.com/repos/jhfjhfj1/autokeras/milestones{/number}","notifications_url":"https://api.github.com/repos/jhfjhfj1/autokeras/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhfjhfj1/autokeras/labels{/name}","releases_url":"https://api.github.com/repos/jhfjhfj1/autokeras/releases{/id}","deployments_url":"https://api.github.com/repos/jhfjhfj1/autokeras/deployments","created_at":"2017-11-19T23:18:20Z","updated_at":"2019-03-16T17:35:33Z","pushed_at":"2019-03-16T20:17:47Z","git_url":"git://github.com/jhfjhfj1/autokeras.git","ssh_url":"git@github.com:jhfjhfj1/autokeras.git","clone_url":"https://github.com/jhfjhfj1/autokeras.git","svn_url":"https://github.com/jhfjhfj1/autokeras","homepage":"http://autokeras.com/","size":71543,"stargazers_count":4833,"watchers_count":4833,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":714,"mirror_url":null,"archived":false,"open_issues_count":102,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":714,"open_issues":102,"watchers":4833,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/583"},"html":{"href":"https://github.com/jhfjhfj1/autokeras/pull/583"},"issue":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/issues/583"},"comments":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/issues/583/comments"},"review_comments":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/583/comments"},"review_comment":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/pulls/583/commits"},"statuses":{"href":"https://api.github.com/repos/jhfjhfj1/autokeras/statuses/03f0b36e453dd0601745bb0aa133a7bce6b5c117"}},"author_association":"NONE"}}
other: {"actor":{"display_login":"codacy-bot"}}