Skip to content

Commit

Permalink
merge tm-parallel into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Damir Dobric committed Jan 8, 2021
2 parents 1498eb5 + 3b3faf8 commit 59b6136
Show file tree
Hide file tree
Showing 25 changed files with 795 additions and 327 deletions.
7 changes: 7 additions & 0 deletions NeoCortexApi/AkkaSb.Net/AkkaSb.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile></DocumentationFile>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 10 additions & 0 deletions NeoCortexApi/HtmAkkaHost/HtmAkkaHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Akka.Remote" Version="1.3.13" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
Expand Down
18 changes: 15 additions & 3 deletions NeoCortexApi/NeoCortexApi.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions NeoCortexApi/NeoCortexApi/HomeostaticPlasticityController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ protected HomeostaticPlasticityController()

}

/// <summary>
/// Creates the instance of HomeostaticPlasticityController.
/// </summary>
/// <param name="htmMemory">The HTM memory.</param>
/// <param name="minCycles">The minimum calls to the Learn method until HPC algorithm is activated. When this number is reached the HPC will disable boosting in SP. </param>
/// <param name="onStabilityStatusChanged">Action invoked when the SP status is changed from stable t unstable and vise versa.</param>
/// <param name="numOfCyclesToWaitOnChange">How many cycles all seen patterns must not change to declare SP as stable. Using smaller numbers might cause frequent status change.
/// Higher numbers ensure more stable SP, but it takes longer time to enter the stable stabe.</param>
public HomeostaticPlasticityController(Connections htmMemory, int minCycles, Action<bool, int, double, int> onStabilityStatusChanged, int numOfCyclesToWaitOnChange = 50)
{
this.m_OnStabilityStatusChanged = onStabilityStatusChanged;
Expand Down
10 changes: 10 additions & 0 deletions NeoCortexApi/NeoCortexApi/NeoCortexApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>7.3</LangVersion>
<DefineConstants>TRACE;USE_AKKA</DefineConstants>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Expand Down Expand Up @@ -61,6 +68,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AkkaSb.Net\AkkaSb.Net.csproj" >
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
<ProjectReference Include="..\DistributedComputeLib\DistributedComputeLib.csproj">
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
Expand Down
18 changes: 15 additions & 3 deletions NeoCortexApi/NeoCortexApi/NeoCortexApi.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions NeoCortexApi/NeoCortexApi/Network/CortexLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ public TOUT Compute(TIN input, bool learn)

int i = 0;

foreach (var moduleKeyPair in this.HtmModules)
var keys = this.HtmModules.Keys;

foreach (var key in new List<string>(keys))
{
dynamic module = moduleKeyPair.Value;
dynamic module = this.HtmModules[key];

dynamic moduleInput = (i == 0) ? input : moduleOutput;

moduleOutput = module.Compute(moduleInput, learn);

SetResult(moduleKeyPair.Key, moduleOutput);
SetResult(key, moduleOutput);

i++;
}
Expand Down
11 changes: 3 additions & 8 deletions NeoCortexApi/NeoCortexApi/Network/HtmClassifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,15 @@ public TIN GetPredictedInputValue(Cell[] predictiveCells)
// bool x = false;
double maxSameBits = 0;
TIN predictedValue = default;
//int[] arr = new int[predictiveCells.Length];
//for (int i = 0; i < predictiveCells.Length; i++)
//{
// arr[i] = predictiveCells[i].Index;
//}


if (predictiveCells.Length != 0)
{
int indxOfMatchingInp = 0;
Debug.WriteLine($"Item length: {predictiveCells.Length}\t Items: {this.m_ActiveMap2.Keys.Count}");
int n = 0;

List<int> sortedMatches = new List<int>();
int indx = 0;

var celIndicies = GetCellIndicies(predictiveCells);

Debug.WriteLine($"Predictive cells: {celIndicies.Length} \t {Helpers.StringifyVector(celIndicies)}");
Expand All @@ -136,7 +131,7 @@ public TIN GetPredictedInputValue(Cell[] predictiveCells)
else
Debug.WriteLine($"<indx:{n}\tinp/len: {pair.Key}/{pair.Value.Length} = similarity {numOfSameBitsPct}\t {Helpers.StringifyVector(pair.Value)}");

indx++;
n++;
}
}

Expand Down
Loading

0 comments on commit 59b6136

Please sign in to comment.