我正在阅读 Francois Chollet 的“使用 Python 进行深度学习”一书,但是当我尝试完全按照示例中的方式导入数据集时,我经常收到此错误:
Exception: URL fetch failure on https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels_notop.h5: None -- [Errno 64] Host is down
Run Code Online (Sandbox Code Playgroud)
这是什么意思?我能做些什么吗,或者书中的例子已经过时了...
作业是:
您的任务是更正数字化文本中的错误.您只需要处理以下错误:
我的代码:
def correct(string):
for i in string:
if '5' in string:
string = string.replace('5','S')
elif '0' in string:
string = string.replace('0','O')
elif '1' in string:
string = string.replace('1','I')
return string
Run Code Online (Sandbox Code Playgroud)
我知道这个解决方案不适用于:
Test.assert_equals(correct("51NGAP0RE"),"SINGAPORE");
Run Code Online (Sandbox Code Playgroud)
有没有人有关于如何使这个更通用的功能,适用于每个单词的提示?
我有一些创建图形的代码。但是,我不明白如何让 x 和 y 轴出现。我试过了,ax.tick_params(left=True, bottom=True, labelleft=True, labelbottom=True)但它不起作用。
我的代码
import networkx as nx
import matplotlib.pyplot as plt
Adj = np.random.randint(0,2,(5,5))
x = np.random.uniform(0,1,5)
y = np.random.uniform(0,1,5)
# convert to list of tuples
M_pos = list(zip(x,y))
# give each neuron a number, and put in a dictionary
nums = list(range(0,5))
pos_dict = dict(zip(nums,M_pos))
# construct the graph from the neuron positions and adjacency matrix
GR = nx.from_numpy_matrix(Adj, pos_dict);
figure(figsize=(10, 5))
plt.title('Neuron spatial location')
#nx.draw_networkx_labels(GR, pos_dict)
nx.draw(GR, pos_dict, node_size=40, node_color='b');
Run Code Online (Sandbox Code Playgroud)