neuralplex 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuralplex
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: An object oriented neural network implementation.
5
5
  Project-URL: Homepage, https://github.com/faranalytics/neuralplex
6
6
  Project-URL: Issues, https://github.com/faranalytics/neuralplex/issues
@@ -22,12 +22,12 @@ An object oriented neural network implementation.
22
22
 
23
23
  **Neural-pleX** is an intuitive object oriented neural network implementation. The Neural-pleX API consists of Network, Layer, and Neuron constructors. The networks can be easily [visualized](#visualizations-of-the-network-before-and-after-training) using a visualization library.
24
24
 
25
- ## Table of Contents
25
+ ## Table of contents
26
26
 
27
27
  - [Installation](#installation)
28
28
  - [Usage](#usage)
29
- - [Examples](#examples)
30
- - [Tests](#tests)
29
+ - [Example](#example)
30
+ - [Test](#test)
31
31
 
32
32
  ## Installation
33
33
 
@@ -39,21 +39,23 @@ pip install neuralplex
39
39
 
40
40
  This implementation demonstrates each component of the API. A 3 layer neural network is constructed that has a 4 neuron input Layer and a 1 neuron output layer. The hidden layer has 8 neurons.
41
41
 
42
- ### Instructions
42
+ ### Implement a 3 layer neural network
43
43
 
44
- Import the Network, Layer, and Neuron classes.
44
+ #### Import the Network, Layer, and Neuron classes.
45
45
 
46
46
  ```python
47
47
  from neuralplex import Network, Layer, Neuron
48
48
  ```
49
49
 
50
- Set a step.
50
+ #### Set a step.
51
51
 
52
52
  ```python
53
53
  STEP = 1e-4
54
54
  ```
55
55
 
56
- Construct a neural network by specifying the Neurons for each Layer and adding the Layers to a Network. The resulting neural network will have 4 inputs and 1 ouput.
56
+ #### Construct a neural network by specifying the Neurons for each Layer and adding the Layers to a Network.
57
+
58
+ The resulting neural network will have 4 input neurons, 1 ouput neuron, and 8 neurons in the hidden layer.
57
59
 
58
60
  ```python
59
61
  l1 = Layer(neurons=[Neuron(m=random()) for i in range(0, 4)], step=STEP)
@@ -62,7 +64,9 @@ l3 = Layer(neurons=[Neuron(m=random())], step=STEP)
62
64
  n1 = Network([l1, l2, l3])
63
65
  ```
64
66
 
65
- With the `Network` define, you can train the network. Here the network is trained to recognize the nibble 1111 as the decimal number 15.
67
+ #### With the Network defined, you can train the network.
68
+
69
+ Here the network is trained to recognize the nibble 1111 as the decimal number 15.
66
70
 
67
71
  ```python
68
72
  n1.train([1,1,1,1], [15])
@@ -75,13 +79,13 @@ prediction = n1.predict([1,1,1,1])
75
79
  print(prediction)
76
80
  ```
77
81
 
78
- ## Examples
82
+ ## Example
79
83
 
80
- ### Train and Visualize a Neural-pleX Network
84
+ ### Train and visualize a Neural-pleX network
81
85
 
82
86
  In this example you will use [D3](https://d3js.org/) and [D3Blocks](https://d3blocks.github.io/d3blocks/pages/html/index.html) in order to visualize a neural network _before_ and _after_ training.
83
87
 
84
- Import the necessary dependencies.
88
+ #### Import the necessary dependencies.
85
89
 
86
90
  ```python
87
91
  from random import random, randint
@@ -90,7 +94,7 @@ from neuralplex import Network, Layer, Neuron, get_edge_data
90
94
  from d3blocks import D3Blocks
91
95
  ```
92
96
 
93
- Implement a function that will visualize the network.
97
+ #### Implement a function that will visualize the network.
94
98
 
95
99
  ```python
96
100
  def visualize(n):
@@ -117,25 +121,25 @@ def visualize(n):
117
121
  d3.D3graph.show(save_button=True, filepath='./Neural-pleX.html')
118
122
  ```
119
123
 
120
- Set a step.
124
+ #### Set a step.
121
125
 
122
126
  ```python
123
127
  STEP = 1e-5
124
128
  ```
125
129
 
126
- Construct a network.
130
+ #### Construct a network.
127
131
 
128
132
  ```python
129
133
  n = Network([Layer(neurons=[Neuron(m=random(), name=f'l{layer}-p{i}') for i in range(1, size+1)], step=STEP) for layer, size in zip([1,2,3], [4, 8, 1])])
130
134
  ```
131
135
 
132
- Use D3 and D3Blocks in order to visualize the network _before_ training.
136
+ #### Use D3 and D3Blocks in order to visualize the network _before_ training.
133
137
 
134
138
  ```python
135
139
  visualize(n)
136
140
  ```
137
141
 
138
- Train the network.
142
+ #### Train the network.
139
143
 
140
144
  ```python
141
145
  for i in range(0, int(1e5)):
@@ -146,53 +150,51 @@ for i in range(0, int(1e5)):
146
150
  n.train(b, [rn])
147
151
  ```
148
152
 
149
- Use D3 and D3Blocks in order to visualize the network _after_ training.
153
+ #### Use D3 and D3Blocks in order to visualize the network _after_ training.
150
154
 
151
155
  ```python
152
156
  visualize(n)
153
157
  ```
154
158
 
155
- #### Visualizations of the network before and after training:
159
+ ##### Visualizations of the network before and after training:
156
160
 
157
161
  The green nodes comprise the inputs, the red nodes comprise the hidden layer, and the yellow node is the output. The size of the Neuron is proportional to its coefficient and dependent on its random initialization and subsequent training.
158
162
 
159
163
  | Before Training | After Training |
160
164
  | :----------------------------------------------------------------------: | :--------------------------------------------------------------------: |
161
- | ![Neural-pleX Before Training](./images/Neural-pleX_before_training.png) | ![Neural-pleX After Training](./images/Neural-pleX_after_training.png) |
162
-
163
- ## Tests
165
+ | ![Neural-pleX Before Training](https://raw.githubusercontent.com/faranalytics/neuralplex/refs/heads/main/images/Neural-pleX_before_training.png) | ![Neural-pleX After Training](https://github.com/faranalytics/neuralplex/blob/main/images/Neural-pleX_after_training.png?raw=true) |
164
166
 
165
- ### The Nibble Challenge
167
+ ## Test
166
168
 
167
- #### Clone the repository and run the test.
169
+ ### How to run the Nibble Challenge
168
170
 
169
171
  A model is trained that estimates a decimal value given a binary nibble.
170
172
 
171
- Clone the repository.
173
+ #### Clone the repository.
172
174
 
173
175
  ```bash
174
176
  git clone https://github.com/faranalytics/neuralplex.git
175
177
  ```
176
178
 
177
- Change directory into the repository.
179
+ #### Change directory into the repository.
178
180
 
179
181
  ```bash
180
182
  cd neuralplex
181
183
  ```
182
184
 
183
- Install the package in editable mode.
185
+ #### Install the package in editable mode.
184
186
 
185
187
  ```bash
186
188
  pip install -e .
187
189
  ```
188
190
 
189
- Run the tests.
191
+ #### Run the tests.
190
192
 
191
193
  ```bash
192
194
  python -m unittest -v
193
195
  ```
194
196
 
195
- #### Output
197
+ ##### Output
196
198
 
197
199
  ```bash
198
200
  test_nibbles (tests.test.Test.test_nibbles) ... Training the model.
@@ -231,6 +233,6 @@ OK
231
233
  ```
232
234
 
233
235
  ## Support
234
- If you have a feature request or run into any issues, feel free to submit an [issue](https://github.com/faranalytics/neuralplex/issues) or start a [discussion](https://github.com/faranalytics/neuralplex/discussions). You’re also welcome to reach out directly to one of the authors at any time.
236
+ If you have a feature request or run into any issues, feel free to submit an [issue](https://github.com/faranalytics/neuralplex/issues) or start a [discussion](https://github.com/faranalytics/neuralplex/discussions). You’re also welcome to reach out directly to one of the authors.
235
237
 
236
238
  - [Adam Patterson](https://github.com/adamjpatterson)
@@ -6,12 +6,12 @@ An object oriented neural network implementation.
6
6
 
7
7
  **Neural-pleX** is an intuitive object oriented neural network implementation. The Neural-pleX API consists of Network, Layer, and Neuron constructors. The networks can be easily [visualized](#visualizations-of-the-network-before-and-after-training) using a visualization library.
8
8
 
9
- ## Table of Contents
9
+ ## Table of contents
10
10
 
11
11
  - [Installation](#installation)
12
12
  - [Usage](#usage)
13
- - [Examples](#examples)
14
- - [Tests](#tests)
13
+ - [Example](#example)
14
+ - [Test](#test)
15
15
 
16
16
  ## Installation
17
17
 
@@ -23,21 +23,23 @@ pip install neuralplex
23
23
 
24
24
  This implementation demonstrates each component of the API. A 3 layer neural network is constructed that has a 4 neuron input Layer and a 1 neuron output layer. The hidden layer has 8 neurons.
25
25
 
26
- ### Instructions
26
+ ### Implement a 3 layer neural network
27
27
 
28
- Import the Network, Layer, and Neuron classes.
28
+ #### Import the Network, Layer, and Neuron classes.
29
29
 
30
30
  ```python
31
31
  from neuralplex import Network, Layer, Neuron
32
32
  ```
33
33
 
34
- Set a step.
34
+ #### Set a step.
35
35
 
36
36
  ```python
37
37
  STEP = 1e-4
38
38
  ```
39
39
 
40
- Construct a neural network by specifying the Neurons for each Layer and adding the Layers to a Network. The resulting neural network will have 4 inputs and 1 ouput.
40
+ #### Construct a neural network by specifying the Neurons for each Layer and adding the Layers to a Network.
41
+
42
+ The resulting neural network will have 4 input neurons, 1 ouput neuron, and 8 neurons in the hidden layer.
41
43
 
42
44
  ```python
43
45
  l1 = Layer(neurons=[Neuron(m=random()) for i in range(0, 4)], step=STEP)
@@ -46,7 +48,9 @@ l3 = Layer(neurons=[Neuron(m=random())], step=STEP)
46
48
  n1 = Network([l1, l2, l3])
47
49
  ```
48
50
 
49
- With the `Network` define, you can train the network. Here the network is trained to recognize the nibble 1111 as the decimal number 15.
51
+ #### With the Network defined, you can train the network.
52
+
53
+ Here the network is trained to recognize the nibble 1111 as the decimal number 15.
50
54
 
51
55
  ```python
52
56
  n1.train([1,1,1,1], [15])
@@ -59,13 +63,13 @@ prediction = n1.predict([1,1,1,1])
59
63
  print(prediction)
60
64
  ```
61
65
 
62
- ## Examples
66
+ ## Example
63
67
 
64
- ### Train and Visualize a Neural-pleX Network
68
+ ### Train and visualize a Neural-pleX network
65
69
 
66
70
  In this example you will use [D3](https://d3js.org/) and [D3Blocks](https://d3blocks.github.io/d3blocks/pages/html/index.html) in order to visualize a neural network _before_ and _after_ training.
67
71
 
68
- Import the necessary dependencies.
72
+ #### Import the necessary dependencies.
69
73
 
70
74
  ```python
71
75
  from random import random, randint
@@ -74,7 +78,7 @@ from neuralplex import Network, Layer, Neuron, get_edge_data
74
78
  from d3blocks import D3Blocks
75
79
  ```
76
80
 
77
- Implement a function that will visualize the network.
81
+ #### Implement a function that will visualize the network.
78
82
 
79
83
  ```python
80
84
  def visualize(n):
@@ -101,25 +105,25 @@ def visualize(n):
101
105
  d3.D3graph.show(save_button=True, filepath='./Neural-pleX.html')
102
106
  ```
103
107
 
104
- Set a step.
108
+ #### Set a step.
105
109
 
106
110
  ```python
107
111
  STEP = 1e-5
108
112
  ```
109
113
 
110
- Construct a network.
114
+ #### Construct a network.
111
115
 
112
116
  ```python
113
117
  n = Network([Layer(neurons=[Neuron(m=random(), name=f'l{layer}-p{i}') for i in range(1, size+1)], step=STEP) for layer, size in zip([1,2,3], [4, 8, 1])])
114
118
  ```
115
119
 
116
- Use D3 and D3Blocks in order to visualize the network _before_ training.
120
+ #### Use D3 and D3Blocks in order to visualize the network _before_ training.
117
121
 
118
122
  ```python
119
123
  visualize(n)
120
124
  ```
121
125
 
122
- Train the network.
126
+ #### Train the network.
123
127
 
124
128
  ```python
125
129
  for i in range(0, int(1e5)):
@@ -130,53 +134,51 @@ for i in range(0, int(1e5)):
130
134
  n.train(b, [rn])
131
135
  ```
132
136
 
133
- Use D3 and D3Blocks in order to visualize the network _after_ training.
137
+ #### Use D3 and D3Blocks in order to visualize the network _after_ training.
134
138
 
135
139
  ```python
136
140
  visualize(n)
137
141
  ```
138
142
 
139
- #### Visualizations of the network before and after training:
143
+ ##### Visualizations of the network before and after training:
140
144
 
141
145
  The green nodes comprise the inputs, the red nodes comprise the hidden layer, and the yellow node is the output. The size of the Neuron is proportional to its coefficient and dependent on its random initialization and subsequent training.
142
146
 
143
147
  | Before Training | After Training |
144
148
  | :----------------------------------------------------------------------: | :--------------------------------------------------------------------: |
145
- | ![Neural-pleX Before Training](./images/Neural-pleX_before_training.png) | ![Neural-pleX After Training](./images/Neural-pleX_after_training.png) |
146
-
147
- ## Tests
149
+ | ![Neural-pleX Before Training](https://raw.githubusercontent.com/faranalytics/neuralplex/refs/heads/main/images/Neural-pleX_before_training.png) | ![Neural-pleX After Training](https://github.com/faranalytics/neuralplex/blob/main/images/Neural-pleX_after_training.png?raw=true) |
148
150
 
149
- ### The Nibble Challenge
151
+ ## Test
150
152
 
151
- #### Clone the repository and run the test.
153
+ ### How to run the Nibble Challenge
152
154
 
153
155
  A model is trained that estimates a decimal value given a binary nibble.
154
156
 
155
- Clone the repository.
157
+ #### Clone the repository.
156
158
 
157
159
  ```bash
158
160
  git clone https://github.com/faranalytics/neuralplex.git
159
161
  ```
160
162
 
161
- Change directory into the repository.
163
+ #### Change directory into the repository.
162
164
 
163
165
  ```bash
164
166
  cd neuralplex
165
167
  ```
166
168
 
167
- Install the package in editable mode.
169
+ #### Install the package in editable mode.
168
170
 
169
171
  ```bash
170
172
  pip install -e .
171
173
  ```
172
174
 
173
- Run the tests.
175
+ #### Run the tests.
174
176
 
175
177
  ```bash
176
178
  python -m unittest -v
177
179
  ```
178
180
 
179
- #### Output
181
+ ##### Output
180
182
 
181
183
  ```bash
182
184
  test_nibbles (tests.test.Test.test_nibbles) ... Training the model.
@@ -215,6 +217,6 @@ OK
215
217
  ```
216
218
 
217
219
  ## Support
218
- If you have a feature request or run into any issues, feel free to submit an [issue](https://github.com/faranalytics/neuralplex/issues) or start a [discussion](https://github.com/faranalytics/neuralplex/discussions). You’re also welcome to reach out directly to one of the authors at any time.
220
+ If you have a feature request or run into any issues, feel free to submit an [issue](https://github.com/faranalytics/neuralplex/issues) or start a [discussion](https://github.com/faranalytics/neuralplex/discussions). You’re also welcome to reach out directly to one of the authors.
219
221
 
220
222
  - [Adam Patterson](https://github.com/adamjpatterson)
@@ -0,0 +1 @@
1
+ __version__ = "0.1.2"
@@ -1 +0,0 @@
1
- __version__ = "0.1.0"
File without changes
File without changes
File without changes
File without changes
File without changes