Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEAT 0.2.0 #3

Merged
merged 27 commits into from
Feb 22, 2024
Merged
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9ed73ce
fix mutation to include negative numbers
HyperCodec Feb 12, 2024
75eb9ef
save on gh actions calls
HyperCodec Feb 12, 2024
479a361
update dep in Cargo.toml
HyperCodec Feb 13, 2024
f314ace
change function names
HyperCodec Feb 13, 2024
0325fb8
fix error with example
HyperCodec Feb 13, 2024
171736a
Merge pull request #11 from inflectrix/genetic-rs-update
HyperCodec Feb 13, 2024
4f74e87
fix addneuron and add removeneuron
HyperCodec Feb 14, 2024
e255eaf
add bias mutation
HyperCodec Feb 14, 2024
c9efe0e
implement activation function mutation
HyperCodec Feb 14, 2024
174313d
fix making ActivationFn sync
HyperCodec Feb 14, 2024
582edc0
cargo fmt
HyperCodec Feb 14, 2024
1f0bf3b
fix topology index error (runnable still an issue)
HyperCodec Feb 14, 2024
5fcfffb
restructure neuron deletion (and potentially fix)
HyperCodec Feb 16, 2024
8ea5fd7
fix index error
HyperCodec Feb 16, 2024
e821cfb
fix remaining subtraction/index errors
HyperCodec Feb 16, 2024
8dd5b68
fix is_connection_cyclic
HyperCodec Feb 20, 2024
7a8396a
cargo fmt
HyperCodec Feb 20, 2024
cf1dd51
Merge pull request #13 from inflectrix/8-more-mutations
HyperCodec Feb 20, 2024
23c7081
implement serde (untested)
HyperCodec Feb 22, 2024
bb4fe37
add docstrings
HyperCodec Feb 22, 2024
a4eba64
fix deser
HyperCodec Feb 22, 2024
34bf32d
fix clippy warnings
HyperCodec Feb 22, 2024
674ad6e
cargo fmt
HyperCodec Feb 22, 2024
0e07c57
Merge pull request #14 from inflectrix/serde
HyperCodec Feb 22, 2024
62e8876
add feature docs
HyperCodec Feb 22, 2024
c6eb622
Merge pull request #15 from inflectrix/12-feature-docs
HyperCodec Feb 22, 2024
e7f3eca
update version number
HyperCodec Feb 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ license = "MIT"

[features]
default = ["max-index"]
#crossover = ["genetic-rs/crossover"]
crossover = ["genetic-rs/crossover"]
rayon = ["genetic-rs/rayon", "dep:rayon"]
max-index = []

14 changes: 9 additions & 5 deletions src/runnable.rs
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ impl<const I: usize, const O: usize> NeuralNetwork<I, O> {
n.state.value += self.process_neuron(l) * w;
}

n.sigmoid();
n.activate();

n.state.value
}
@@ -112,7 +112,7 @@ impl<const I: usize, const O: usize> NeuralNetwork<I, O> {

let mut nw = n.write().unwrap();
nw.state.value += val;
nw.sigmoid();
nw.activate();

nw.state.value
}
@@ -240,6 +240,9 @@ pub struct Neuron {

/// The current state of the neuron.
pub state: NeuronState,

/// The neuron's activation function
pub activation: ActivationFn,
}

impl Neuron {
@@ -248,9 +251,9 @@ impl Neuron {
self.state.value = self.bias;
}

/// Applies the sigoid activation function to the state's current value.
pub fn sigmoid(&mut self) {
self.state.value = 1. / (1. + std::f32::consts::E.powf(-self.state.value))
/// Applies the activation function to the neuron
pub fn activate(&mut self) {
self.state.value = (self.activation.func)(self.state.value);
}
}

@@ -263,6 +266,7 @@ impl From<&NeuronTopology> for Neuron {
value: value.bias,
..Default::default()
},
activation: value.activation.clone(),
}
}
}
Loading