Merge pull request #544 from microsoft/copilot/fix-29ebefe6-65da-4b28-915b-008ce65f0519

Fix ValueError in Perceptron.ipynb for NumPy 2.x compatibility
This commit is contained in:
Lee Stott 2025-10-03 14:00:33 +01:00 committed by GitHub
commit 6923c22e49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
49 changed files with 148 additions and 197 deletions

View File

@ -462,10 +462,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -477,7 +476,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]
@ -1078,4 +1077,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -462,10 +462,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -477,7 +476,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -462,10 +462,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -477,7 +476,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -458,10 +458,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -473,7 +472,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -462,10 +462,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -477,7 +476,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]

View File

@ -460,10 +460,9 @@
" neg_out = np.dot(negative_examples, weights) \n",
" pos_correct = (pos_out >= 0).sum() / float(pos_count)\n",
" neg_correct = (neg_out < 0).sum() / float(neg_count)\n",
" # make correction a list so it is homogeneous to weights list then numpy array accepts\n",
" snapshots.append((np.concatenate(weights),[(pos_correct+neg_correct)/2.0,0,0]))\n",
" snapshots.append([np.copy(weights).flatten(), (pos_correct+neg_correct)/2.0])\n",
"\n",
" return np.array(snapshots)\n",
" return np.array(snapshots, dtype=object)\n",
"\n",
"snapshots = train_graph(pos_examples,neg_examples)\n",
"\n",
@ -475,7 +474,7 @@
" pylab.plot(np.arange(len(snapshots[:,1])), snapshots[:,1])\n",
" pylab.ylabel('Accuracy')\n",
" pylab.xlabel('Iteration')\n",
" pylab.plot(step, snapshots[step,1][0], \"bo\")\n",
" pylab.plot(step, snapshots[step,1], \"bo\")\n",
" pylab.show()\n",
"def pl1(step): plotit(pos_examples,neg_examples,snapshots,step)"
]