This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn.model_selection import train_test_split | |
| X_train, X_test, y_train, y_test = train_test_split(predictors, target, test_size=0.3, random_state=40) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| predictors = train_df[['rm']] | |
| target = train_df['medv'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| train_df = pd.read_csv('/content/gdrive/My Drive/boston/train.csv', index_col='ID') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from google.colab import drive | |
| drive.mount('/content/gdrive') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: nginx-deployment | |
| labels: | |
| app: nginx | |
| spec: | |
| replicas: 3 | |
| selector: | |
| matchLabels: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Imports the Google Cloud client library | |
| const {Translate} = require('@google-cloud/translate').v2; | |
| // Creates a client | |
| const translate = new Translate(); | |
| /** | |
| * TODO(developer): Uncomment the following lines before running the sample. | |
| */ | |
| // const text = 'The text to translate, e.g. Hello, world!'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy']) | |
| model.fit(ds, epochs=3, steps_per_epoch=10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def preprocess_image(image): | |
| image = tf.image.decode_jpeg(image, channels=NUM_CHANNELS) | |
| image = tf.image.resize(image, [HEIGHT, WIDTH]) | |
| image /= 255.0 # normalize to [0,1] range | |
| return image | |
| def load_and_preprocess_image(path): | |
| image = tf.io.read_file(path) | |
| return preprocess_image(image) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| x = base_model.output | |
| x = layers.GlobalAveragePooling2D()(x) | |
| x = layers.Dense(4096, activation='relu')(x) | |
| x = layers.Dense(1, activation='sigmoid')(x) | |
| model_3 = models.Model(inputs=base_model.input, outputs=x) | |
| print(model_3.summary()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| base_model = tf.keras.applications.vgg19.VGG19(input_shape=(HEIGHT, WIDTH, NUM_CHANNELS), include_top=False, weights='imagenet') | |
| base_model.trainable = False | |
| print(base_model.summary()) |