简体   繁体   中英

I am getting WARNING:tensorflow:From in python

I am learning ML from AI Adventures but I have a problem with that code

WARNING:tensorflow:From Ai1.py:12: load_csv_with_header (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version. Instructions for updating: Use tf.data instead. Traceback (most recent call last): File "Ai1.py", line 12, in <module> target_dtype=np.int) File "C:\\Users\\Ardit\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\util\\deprecation.py", line 324, in new_func return func(*args, **kwargs) File "C:\\Users\\Ardit\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\contrib\\learn\\python\\learn\\datasets\\base.py", line 53, in load_csv_with_header header = next(data_file) File "C:\\Users\\Ardit\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\lib\\io\\file_io.py", line 220, in __next__ return self.next() File "C:\\Users\\Ardit\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\lib\\io\\file_io.py", line 214, in next retval = self.readline() File "C:\\Users\\Ardit\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\lib\\io\\file_io.py", line 184, in readline return self._prepare_value(self._read_buf.ReadLineAsString()) File "C:\\Users\\Ardit\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\lib\\io\\file_io.py", line 100, in _prepare_value return compat.as_str_any(val) File "C:\\Users\\Ardit\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\util\\compat.py", line 107, in as_str_any return as_str(value) File "C:\\Users\\Ardit\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\tensorflow\\python\\util\\compat.py", line 80, in as_text return bytes_or_text.decode(encoding) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 8: invalid start byte

I am using python 3.6 Can anyone help me

Sorry, here is the code

import tensorflow as tf
import numpy as np
from tensorflow.contrib.learn.python.learn.datasets import base

# Data files
IRIS_TRAINING = "iris_training.csv"
IRIS_TEST = "iris_test.csv"

# Load datasets.
training_set = base.load_csv_with_header(filename=IRIS_TRAINING,
                                     features_dtype=np.float32,
                                     target_dtype=np.int)
test_set = base.load_csv_with_header(filename=IRIS_TEST,
                                features_dtype=np.float32,
                               target_dtype=np.int)

print(training_set.data)

print(training_set.target)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM