public void StandardNetworkBuilderExtensionsBuildsSoftmaxActivation() { var network = new StandardNetworkBuilder() .With.ANewLayerOfInputUnits(2) .ConnectedTo.ANewLayerOfHiddenUnits(2).With.SoftmaxActivation() .ConnectedTo.ANewLayerOfOutputUnits(2).With.SoftmaxActivation() .And.Build().And.GetNetwork(); network.ElementAt(1).Select(u => u.UnitActivation).Should().AllBeOfType <SoftmaxUnitActivation <IUnit, IConnection, IUnitActivationCreatable <IUnit> > >(); }
public void StandardNetworkBuilderExtensionsBuildsHyperbolicTangentActivation() { var network = new StandardNetworkBuilder() .With.ANewLayerOfInputUnits(2) .ConnectedTo.ANewLayerOfHiddenUnits(2).With.HyperbolicTangentActivation() .ConnectedTo.ANewLayerOfOutputUnits(2).With.HyperbolicTangentActivation() .And.Build().And.GetNetwork(); network.ElementAt(1).Select(u => u.UnitActivation).Should().AllBeOfType <HyperbolicTangentUnitActivation <IUnit> >(); }
public ICollection <ICollection <ITraversableUnit <IUnit, IConnection, IUnitActivationCreatable <IUnit> > > > CreateNetwork(double bias = 0d, double slopeMultiplier = 1d) { var network = new StandardNetworkBuilder().With.ANewLayerOfInputUnits(NumberOfInputUnits) .ConnectedTo.ANewLayerOfHiddenUnits(NumberOfHiddenUnits) .With.UnitActivation <IdentityUnitActivation <IUnit> >() .ConnectedTo.ANewLayerOfOutputUnits(NumberOfOutputUnits) .With.OutputUnitActivation <IdentityUnitActivation <IUnit> >() .And.Bias(bias) .And.SlopeMultiplier(slopeMultiplier) .And.Build() .And.GetNetwork(); return(network); }