text stringlengths 0 2.87M |
|---|
- layer_sizes : list of int |
List of layer sizes, including input and output layer |
''' |
n_layers = len(layer_sizes) |
v_spacing = (top - bottom)/float(max(layer_sizes)) |
h_spacing = (right - left)/float(len(layer_sizes) - 1) |
# Nodes |
for n, layer_size in enumerate(layer_sizes): |
layer_top = v_spacing*(layer_size - 1)/2. + (top + bottom)/2. |
for m in range(layer_size): |
circle = plt.Circle((n*h_spacing + left, layer_top - m*v_spacing), v_spacing/4., |
color='w', ec='k', zorder=4) |
ax.add_artist(circle) |
# Edges |
for n, (layer_size_a, layer_size_b) in enumerate(zip(layer_sizes[:-1], layer_sizes[1:])): |
layer_top_a = v_spacing*(layer_size_a - 1)/2. + (top + bottom)/2. |
layer_top_b = v_spacing*(layer_size_b - 1)/2. + (top + bottom)/2. |
for m in range(layer_size_a): |
for o in range(layer_size_b): |
line = plt.Line2D([n*h_spacing + left, (n + 1)*h_spacing + left], |
[layer_top_a - m*v_spacing, layer_top_b - o*v_spacing], c='k') |
ax.add_artist(line) |
fig = plt.figure(figsize=(12, 12)) |
ax = fig.gca() |
ax.axis('off') |
draw_neural_network(ax, 0.1, 0.9, 0.1, 0.9, [4, 7, 2]) |
plt.show() |
``` |
This code will draw a simple neural network with an input layer of 4 nodes, a hidden layer of 7 nodes, and an output layer of 2 nodes.<kinrel><user>I have two remote Debian servers, A and B. How can I copy a directory of files at `~/Documents/training_results` existing on server A to the path `~/training_results` on se... |
``` |
$ scp -r <user>@<server_a ip>:~/Documents/training_results <user>@<server_b ip>:~/training_results |
``` |
Now I will explain what this command does. |
The ```-r``` option is to copy directory(s) recursively. |
Then you enter the User you want and the IP address for server A, then a colon. The directory we will copy is ```training_results``` from the ```Documents``` folder at the user ```home``` directory. |
Next, you enter the User you want and the IP address for server B, and then we do the same thing and enter the path where we will be pasting the file(s)/directory(s). |
I hope this helps!<kinrel><user>Can you please explain how Open Assistant works? I am specifically looking for a discussion of how the model is trained and what the model architecture is. Second, I would appreciate a description of the motives behind why Open Assistant was created.<user><kinrel>Open Assistant is based ... |
The motives behind Open Assistant are providing an open source alternative to ChatGPT. The stated goal is to provide an open model that can be run on an average users’ system.<kinrel><user>Who is Cecilia Blomdahl?<user><kinrel>Cecilia Blomdahl is a full-time content creator from Sweeden, currently living in Svalbard. S... |
1. Мёртвое море (cолёность 270‰) |
2. Красное море (cолёность 42‰) |
3. Средиземное море (cолёность 39,5‰) |
4. Эгейское море (cолёность 38,5‰) |
5. Ионическое море (cолёность 38‰)<kinrel><user>Can you spot the critical bug in this javascript code? |
```js |
function reloadResource(){ |
fetch('https://example.com/api/resource', { |
method: 'GET', |
headers: { |
'Content-Type': 'application/json', |
}, |
}) |
.then(response => response.json()) |
.then(data => { |
console.log('Success:', data); |
setInterval(reloadResource, 1000); |
}) |
.catch((error) => { |
console.error('Error:', error); |
}); |
} |
```<user><kinrel>I can tell you that the critical bug in this code is that the reloadResource function is being called recursively every second using setInterval, which could lead to an infinite loop and potentially exhaust the available memory. This will cause performance issues and could crash the program. |
To fix the bug, you can add a conditional statement to stop the recursive calls after a certain number of reloads or after a specific event occurs. For example: |
let reloadCount = 0; |
const maxReloads = 10; |
function reloadResource(){ |
fetch('https://example.com/api/resource', { |
method: 'GET', |
headers: { |
'Content-Type': 'application/json', |
}, |
}) |
.then(response => response.json()) |
.then(data => { |
console.log('Success:', data); |
if (++reloadCount < maxReloads) { |
setInterval(reloadResource, 1000); |
} |
}) |
.catch((error) => { |
console.error('Error:', error); |
}); |
}<kinrel><user>How do I get better at building in minecraft?<user><kinrel>1. Practice. If you're not already, consider using creative mode to allow for more time to be spent building and less time mining and worrying about enemies. Pick a well defined, small goal and work on it until you're happy with the result and th... |
2. Find inspiration. Working with no real inspiration can quickly lead to burnout or getting off topic. Collect images, solid models, and even save files from minecraft worlds of things you want to create. |
3. Study the masters. Find out who is doing good work and view their work. If they're someone you can contact, ask questions!<kinrel><user>write a nice valentines message<user><kinrel>Of course, I'd love to help you write a nice Valentine's message! Here's an example: |
My dearest [insert name], |
As Valentine's Day arrives, I want you to know how much you mean to me. You light up my life in ways I never thought possible, and I'm grateful for every moment we've shared together. |
You bring joy to my heart and laughter to my lips, and I cherish every memory we've made. You make every day feel like a gift, and I can't imagine my life without you in it. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.