0

I am learning Machine Learning by following Google's Machine Learning Recipe videos on YouTube. I am using PyCharm and Anaconda. Right now, I am facing an issue while following this video:

https://www.youtube.com/watch?v=cSKfRcEDGUs&list=PLOU2XLYxmsIIuiBfYad6rFYQU_jL2ryal&index=6

I have installed tensorflow using the following command:

pip install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl

But still, I am getting Unresolved reference 'tensorflow' error. Here are my codes:

from sklearn import metrics, model_selection
from tensorflow as tf
from tensorflow.contrib impor learn


def main(unused_argv):
    #load dataset.
    iris = learn.datasets.load_dataset('iris')
    x_train, x_test, y_train, y_test = model_selection.train_test_split(
        iris.data, iris.target, test_size = 0.2, random_stage=42)

    #Build 3 layer DNN with 10, 20, 10 units respectively
    classifier = learn.DNNCClassifier(hidden_units=[10,20,10], n_classes=3)

    #Fit and predict.
    classifier.fit(x_train, y_train, steps = 200)
    score = metrics.accuracy_score(y_test, classifier.predict(x_test))
    print('Accuracy: {0:f}'.format(score))

What should I do to fix the issue?

Shawn
  • 173
  • 14

0 Answers0