Skip to content

Commit fce6532

Browse files
Merge branch 'obj-rel-def-removal'
# Conflicts: # core/src/main/java/network/aika/elements/activations/Activation.java # core/src/main/java/network/aika/elements/activations/CategoryActivation.java # core/src/main/java/network/aika/elements/activations/ConjunctiveActivation.java # core/src/main/java/network/aika/elements/activations/types/BindingActivation.java # core/src/main/java/network/aika/elements/links/CategoryInputLink.java # core/src/main/java/network/aika/elements/links/ConjunctiveLink.java # core/src/main/java/network/aika/elements/links/Link.java # core/src/main/java/network/aika/elements/links/types/BindingCategoryInputLink.java # core/src/main/java/network/aika/elements/links/types/InhibitoryCategoryInputLink.java # core/src/main/java/network/aika/elements/links/types/PatternCategoryInputLink.java # core/src/main/java/network/aika/elements/neurons/CategoryNeuron.java # core/src/main/java/network/aika/elements/neurons/Neuron.java # core/src/main/java/network/aika/elements/neurons/types/BindingNeuron.java # core/src/main/java/network/aika/elements/neurons/types/InhibitoryNeuron.java # core/src/main/java/network/aika/elements/neurons/types/PatternNeuron.java # core/src/main/java/network/aika/elements/synapses/ConjunctiveCategoryInputSynapse.java # core/src/main/java/network/aika/elements/synapses/ConjunctiveSynapse.java # core/src/main/java/network/aika/elements/synapses/Synapse.java # core/src/main/java/network/aika/elements/synapses/slots/SynapseOutputSlot.java # core/src/main/java/network/aika/elements/synapses/types/BindingCategoryInputSynapse.java # core/src/main/java/network/aika/elements/synapses/types/InhibitoryCategoryInputSynapse.java # core/src/main/java/network/aika/elements/synapses/types/NegativeFeedbackSynapse.java # core/src/main/java/network/aika/elements/synapses/types/OuterPositiveFeedbackSynapse.java # core/src/main/java/network/aika/elements/synapses/types/PatternCategoryInputSynapse.java # core/src/main/java/network/aika/queue/steps/Instantiation.java # debugger/src/main/java/network/aika/debugger/activations/properties/activations/ActivationPropertyPanel.java # debugger/src/main/java/network/aika/debugger/neurons/properties/neurons/NeuronPropertyPanel.java # debugger/src/main/java/network/aika/debugger/neurons/properties/synapses/SynapsePropertyPanel.java # experiments/src/main/java/experiment/logger/PatternLogger.java # fields/src/main/java/network/aika/enums/sign/Negative.java # fields/src/main/java/network/aika/fields/link/NoFieldInputs.java # text/src/main/java/network/aika/meta/Dictionary.java # text/src/main/java/network/aika/meta/NetworkMotifs.java # text/src/main/java/network/aika/meta/TemplateModel.java # text/src/main/java/network/aika/meta/entities/EntityModel.java # text/src/main/java/network/aika/meta/sequences/PhraseModel.java # text/src/main/java/network/aika/meta/sequences/SequenceModel.java # text/src/main/java/network/aika/meta/topics/TopicModel.java
2 parents 2b1862e + cd13fca commit fce6532

File tree

401 files changed

+5945
-26019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

401 files changed

+5945
-26019
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
During the past one and a half years there have been many changes to the architecture of the core algorithm. Most notably the introduction of binding-signals as the underlying mechanism for the linking process and the introduction of updatable fields which allow for a more descriptive way to implement the mathematics within the project. These changes are still work-in-progress, but will hopefully soon converge to a more stable state.
33

44
# About the AIKA Neural Network
5-
AIKA (**A**rtificial **I**ntelligence for **K**nowledge **A**cquisition) is a new type of artificial neural network designed to mimic the behavior of a biological brain more closely and to bridge the gap to classical AI. A key design decision in the AIKA network is to conceptually separate the activations from their neurons, meaning that there are two separate graphs. One graph consisting of neurons and synapses representing the knowledge the network has already acquired and another graph consisting of activations and links describing the information the network was able to infer about a concrete input data set. There is a one-to-many relation between the neurons and the activations. For example, there might be a neuron representing a word or a specific meaning of a word, but there might be several activations of this neuron, each representing an occurrence of this word within the input data set. A consequence of this decision is that we must give up on the idea of a fixed layered topology for the network, since the sequence in which the activations are fired depends on the input data set. Within the activation network, each activation is grounded within the input data set, even if there are several activations in between. This means links between activations server multiple purposes:
5+
AIKA (**A**rtificial **I**ntelligence for **K**nowledge **A**cquisition) is a new neuronType of artificial neural network designed to mimic the behavior of a biological brain more closely and to bridge the gap to classical AI. A key design decision in the AIKA network is to conceptually separate the activations from their neurons, meaning that there are two separate graphs. One graph consisting of neurons and synapses representing the knowledge the network has already acquired and another graph consisting of activations and links describing the information the network was able to infer about a concrete input data set. There is a one-to-many relation between the neurons and the activations. For example, there might be a neuron representing a word or a specific meaning of a word, but there might be several activations of this neuron, each representing an occurrence of this word within the input data set. A consequence of this decision is that we must give up on the idea of a fixed layered topology for the network, since the sequence in which the activations are fired depends on the input data set. Within the activation network, each activation is grounded within the input data set, even if there are several activations in between. This means links between activations server multiple purposes:
66
- They propagate the activation value.
77
- They propagate the binding-signal, that is used for the linking process.
88
- They establish an approximate causal relation through the fired timestamps of their input and output activations.

core/pom.xml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,19 @@
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

12-
<artifactId>aika</artifactId>
12+
<artifactId>aika-core</artifactId>
1313
<version>${revision}</version>
1414

1515
<properties>
16-
<maven.compiler.source>20</maven.compiler.source>
17-
<maven.compiler.target>20</maven.compiler.target>
16+
<maven.compiler.source>22</maven.compiler.source>
17+
<maven.compiler.target>22</maven.compiler.target>
1818
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1919
</properties>
2020

2121
<dependencies>
2222
<dependency>
2323
<groupId>network.aika</groupId>
24-
<artifactId>fields</artifactId>
25-
</dependency>
26-
27-
<dependency>
28-
<groupId>org.apache.commons</groupId>
29-
<artifactId>commons-math3</artifactId>
24+
<artifactId>aika-fields</artifactId>
3025
</dependency>
3126

3227
<dependency>

core/src/main/java/network/aika/Document.java

Lines changed: 22 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,15 @@
1717
package network.aika;
1818

1919

20-
import network.aika.debugger.EventListener;
21-
import network.aika.debugger.EventType;
2220
import network.aika.callbacks.InstantiationCallback;
21+
import network.aika.elements.ModelProvider;
2322
import network.aika.elements.activations.Activation;
24-
import network.aika.elements.Element;
25-
import network.aika.elements.activations.types.PatternActivation;
2623
import network.aika.elements.neurons.Neuron;
27-
import network.aika.elements.neurons.types.PatternNeuron;
2824
import network.aika.elements.PreActivation;
2925
import network.aika.elements.neurons.NeuronProvider;
30-
import network.aika.fields.Field;
3126
import network.aika.queue.Queue;
32-
import network.aika.queue.Timestamp;
27+
import network.aika.queue.QueueProvider;
3328
import network.aika.queue.Step;
34-
import network.aika.text.Range;
3529
import network.aika.text.TextReference;
3630
import org.slf4j.Logger;
3731
import org.slf4j.LoggerFactory;
@@ -41,17 +35,16 @@
4135
import java.util.function.Predicate;
4236
import java.util.stream.Collectors;
4337

44-
import static network.aika.queue.Timestamp.MIN;
45-
import static network.aika.queue.Timestamp.NOT_SET;
4638
import static network.aika.elements.activations.StateType.*;
4739

40+
4841
/**
4942
* The {@code Document} class represents a single document which may be either used for processing a text or as
5043
* training input. A document consists of the raw text, the interpretations and the activations.
5144
*
5245
* @author Lukas Molzberger
5346
*/
54-
public class Document extends Queue implements Element {
47+
public class Document extends Queue implements ModelProvider, QueueProvider {
5548

5649
protected static final Logger LOG = LoggerFactory.getLogger(Document.class);
5750

@@ -71,7 +64,7 @@ public class Document extends Queue implements Element {
7164
private long visitorCounter = 0;
7265

7366
private final TreeMap<Integer, Activation> activationsById = new TreeMap<>();
74-
private final Map<NeuronProvider, PreActivation<? extends Activation>> actsPerNeuron = new HashMap<>();
67+
private final Map<NeuronProvider, PreActivation> actsPerNeuron = new HashMap<>();
7568
private final Set<EventListener> eventListeners = new HashSet<>();
7669

7770
private InstantiationCallback instantiationCallback;
@@ -101,7 +94,7 @@ public Long getId() {
10194
}
10295

10396
@Override
104-
public long getTimeout() {
97+
public Long getTimeout() {
10598
return getConfig().getTimeout();
10699
}
107100

@@ -125,18 +118,6 @@ public Step getCurrentStep() {
125118
return currentStep;
126119
}
127120

128-
public void queueEvent(EventType et, Step s) {
129-
callEventListener(el ->
130-
el.onQueueEvent(et, s)
131-
);
132-
}
133-
134-
public void onElementEvent(EventType et, Element e) {
135-
callEventListener(el ->
136-
el.onElementEvent(et, e)
137-
);
138-
}
139-
140121
public InstantiationCallback getInstantiationCallback() {
141122
return instantiationCallback;
142123
}
@@ -165,7 +146,7 @@ public void register(Activation act) {
165146
activationsById.put(act.getId(), act);
166147
}
167148

168-
public void register(Neuron n, PreActivation<? extends Activation> acts) {
149+
public void register(Neuron n, PreActivation acts) {
169150
PreActivation existingPreAct = actsPerNeuron.put(n.getProvider(), acts);
170151

171152
if(existingPreAct != null)
@@ -209,6 +190,11 @@ public Queue getQueue() {
209190
return this;
210191
}
211192

193+
@Override
194+
public boolean isNextRound() {
195+
return false;
196+
}
197+
212198
public String activationsToString() {
213199
return getActivations()
214200
.stream()
@@ -248,47 +234,24 @@ public String getTextSegment(Range range) {
248234
return content.substring((int) r.getBegin(), (int) r.getEnd());
249235
}
250236

251-
public static String getText(Activation<?> act) {
237+
public static String getText(Activation act) {
252238
return act.getDocument().getTextSegment(act.getTextReference().getCharRange());
253239
}
254240

255-
public PatternActivation addToken(PatternNeuron n, TextReference textReference) {
241+
public Activation addToken(Neuron n, TextReference textReference) {
256242
return addToken(n, textReference, n.getTargetNet());
257243
}
258244

259-
public PatternActivation addToken(PatternNeuron n, TextReference textReference, double inputNet) {
260-
PatternActivation act = n.createActivation(this);
245+
public Activation addToken(Neuron n, TextReference textReference, double inputNet) {
246+
Activation act = n.createActivation(this);
261247

262248
act.updateRanges(textReference);
263249

264-
disconnectNetFields(act);
265-
266250
act.setNet(INNER_FEEDBACK, inputNet);
267251

268252
return act;
269253
}
270254

271-
private void disconnectNetFields(Activation act) {
272-
disconnectAndBlock(act.getNet(PRE_FEEDBACK));
273-
disconnectAndBlock(act.getNet(OUTER_FEEDBACK));
274-
disconnectAndBlock(act.getNet(INNER_FEEDBACK));
275-
}
276-
277-
private void disconnectAndBlock(Field f) {
278-
f.disconnectInputs(false);
279-
f.setBlocked(true);
280-
}
281-
282-
@Override
283-
public Timestamp getCreated() {
284-
return MIN;
285-
}
286-
287-
@Override
288-
public Timestamp getFired() {
289-
return NOT_SET;
290-
}
291-
292255
public String docToString() {
293256
StringBuilder sb = new StringBuilder(content);
294257
sb.append("\n");
@@ -306,4 +269,10 @@ public String toString() {
306269
);
307270
return sb.toString();
308271
}
272+
273+
public String dumpActivations() {
274+
return activationsById.values().stream()
275+
.map(act -> act.dumpObject(0))
276+
.collect(Collectors.joining("\n"));
277+
}
309278
}

core/src/main/java/network/aika/Model.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Model(SuspensionCallback sc) {
7171
}
7272

7373
@Override
74-
public long getTimeout() {
74+
public Long getTimeout() {
7575
return config.getTimeout();
7676
}
7777

core/src/main/java/network/aika/elements/Element.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,18 @@
1616
*/
1717
package network.aika.elements;
1818

19-
import network.aika.Config;
20-
import network.aika.Model;
21-
import network.aika.fields.FieldObject;
19+
2220
import network.aika.queue.Timestamp;
2321

2422
/**
2523
* An Element is either a node (Activation) or an edge (Link) in the Activation graph.
2624
*
2725
* @author Lukas Molzberger
2826
*/
29-
public interface Element extends FieldObject {
27+
public interface Element {
3028

3129
Timestamp getCreated();
3230

3331
Timestamp getFired();
3432

35-
Model getModel();
36-
37-
default Config getConfig() {
38-
return getModel().getConfig();
39-
}
4033
}

text/src/main/java/network/aika/tokenizer/Tokenizer.java renamed to core/src/main/java/network/aika/elements/ModelProvider.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package network.aika.tokenizer;
17+
package network.aika.elements;
1818

19-
import network.aika.Context;
20-
import network.aika.Document;
19+
import network.aika.Config;
20+
import network.aika.Model;
2121

2222
/**
23-
*
24-
* @author Lukas Molzberger
23+
* @author Lukas Molzberger
2524
*/
26-
public interface Tokenizer {
25+
public interface ModelProvider {
2726

28-
void tokenize(Document doc, TokenConsumer tokenConsumer);
27+
Model getModel();
2928

29+
default Config getConfig() {
30+
return getModel().getConfig();
31+
}
3032
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package network.aika.elements;
22

3-
public enum Type {
3+
public enum NeuronType {
44

55
PATTERN,
66
BINDING,
7-
INHIBITORY
7+
INHIBITORY,
8+
CATEGORY
89
}

core/src/main/java/network/aika/elements/PreActivation.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
import network.aika.Document;
2121
import network.aika.elements.activations.Activation;
2222
import network.aika.elements.neurons.Neuron;
23-
import network.aika.elements.neurons.NeuronProvider;
24-
import network.aika.elements.neurons.RefType;
2523
import network.aika.enums.direction.Direction;
26-
import network.aika.text.Range;
24+
import network.aika.Range;
2725
import network.aika.text.TextReference;
2826
import network.aika.text.TokenPositionKey;
2927

@@ -38,13 +36,13 @@
3836
*
3937
* @author Lukas Molzberger
4038
*/
41-
public class PreActivation<A extends Activation> {
39+
public class PreActivation {
4240

4341
private Document doc;
4442

4543
private Neuron neuron;
4644

47-
private SortedSet<A> activations = new TreeSet<>();
45+
private SortedSet<Activation> activations = new TreeSet<>();
4846

4947
private NavigableMap<TokenPositionKey, Activation> tokenPosBeginIndex = new TreeMap<>();
5048

@@ -60,7 +58,7 @@ public PreActivation(Document doc, Neuron neuron) {
6058
doc.register(neuron, this);
6159
}
6260

63-
public SortedSet<A> getActivations() {
61+
public SortedSet<Activation> getActivations() {
6462
return activations;
6563
}
6664

@@ -76,7 +74,7 @@ public NavigableMap<TokenPositionKey, Activation> getTokenPosEndIndex() {
7674
return tokenPosEndIndex;
7775
}
7876

79-
public void addActivation(A act) {
77+
public void addActivation(Activation act) {
8078
activations.add(act);
8179
}
8280

0 commit comments

Comments
 (0)