Skip to content

Instantly share code, notes, and snippets.

View yufengg's full-sized avatar
💭
Set status

Yufeng yufengg

💭
Set status
View GitHub Profile
@yufengg
yufengg / AIA003_tf_estimators.ipynb
Last active April 5, 2020 00:42
Jupyter notebook for AI Adventures episode 3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
feature_columns = [
tf.feature_column.numeric_column(
"pixels", shape=784)
]
classifier = tf.estimator.LinearClassifier(
feature_columns=feature_columns,
n_classes=10,
model_dir=logdir)
tf.estimator.inputs.numpy_input_fn(
x={'pixels': X},
y=Y,
batch_size=batch_size,
num_epochs=epochs,
shuffle=shuffle)
DATA_SETS = input_data.read_data_sets(
"/tmp/fashion-mnist")
classifier.train(
input_fn=train_input_fn,
steps=num_steps)
accuracy_score = classifier.evaluate(
input_fn=eval_input_fn)['accuracy']
classifier =
tf.estimator.DNNClassifier(
feature_columns=feature_columns,
n_classes=10,
hidden_units=[100, 75, 50],
model_dir=logdir
)
X = DATA_SETS.test.images[5000:5005]
predict_input_fn =
tf.estimator.inputs.numpy_input_fn(
x={'pixels': X},
batch_size=1,
num_epochs=1,
shuffle=False)
predictions = classifier.predict(
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yufengg
yufengg / AutoML_data_preparation_AIA023.ipynb
Last active July 24, 2024 09:26
Notebook for preparing a CSV for Google Cloud AutoML Vision
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.