Skip to content

Commit

Permalink
added fann_create_train_array to create train_data from array
Browse files Browse the repository at this point in the history
  • Loading branch information
steffennissen committed Oct 28, 2012
1 parent a944cc2 commit d914171
Show file tree
Hide file tree
Showing 13 changed files with 435 additions and 159 deletions.
36 changes: 36 additions & 0 deletions VS2010/fann.sln
Original file line number Diff line number Diff line change
Expand Up @@ -36,73 +36,109 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}.Debug|Win32.ActiveCfg = Debug|Win32
{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}.Debug|Win32.Build.0 = Debug|Win32
{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}.Debug|x64.ActiveCfg = Debug|x64
{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}.Debug|x64.Build.0 = Debug|x64
{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}.Release|Win32.ActiveCfg = Release|Win32
{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}.Release|Win32.Build.0 = Release|Win32
{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}.Release|x64.ActiveCfg = Release|x64
{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}.Release|x64.Build.0 = Release|x64
{BC62B048-BD91-4130-8C61-DBE48515FF13}.Debug|Win32.ActiveCfg = Debug|Win32
{BC62B048-BD91-4130-8C61-DBE48515FF13}.Debug|Win32.Build.0 = Debug|Win32
{BC62B048-BD91-4130-8C61-DBE48515FF13}.Debug|x64.ActiveCfg = Debug|Win32
{BC62B048-BD91-4130-8C61-DBE48515FF13}.Release|Win32.ActiveCfg = Release|Win32
{BC62B048-BD91-4130-8C61-DBE48515FF13}.Release|Win32.Build.0 = Release|Win32
{BC62B048-BD91-4130-8C61-DBE48515FF13}.Release|x64.ActiveCfg = Release|Win32
{7FFD0423-9EE1-4CB9-AAF0-6FC5F82535FF}.Debug|Win32.ActiveCfg = Debug|Win32
{7FFD0423-9EE1-4CB9-AAF0-6FC5F82535FF}.Debug|Win32.Build.0 = Debug|Win32
{7FFD0423-9EE1-4CB9-AAF0-6FC5F82535FF}.Debug|x64.ActiveCfg = Debug|Win32
{7FFD0423-9EE1-4CB9-AAF0-6FC5F82535FF}.Release|Win32.ActiveCfg = Release|Win32
{7FFD0423-9EE1-4CB9-AAF0-6FC5F82535FF}.Release|Win32.Build.0 = Release|Win32
{7FFD0423-9EE1-4CB9-AAF0-6FC5F82535FF}.Release|x64.ActiveCfg = Release|Win32
{80EE4A35-E029-4E6E-914D-899D409F40DF}.Debug|Win32.ActiveCfg = Debug|Win32
{80EE4A35-E029-4E6E-914D-899D409F40DF}.Debug|Win32.Build.0 = Debug|Win32
{80EE4A35-E029-4E6E-914D-899D409F40DF}.Debug|x64.ActiveCfg = Debug|Win32
{80EE4A35-E029-4E6E-914D-899D409F40DF}.Release|Win32.ActiveCfg = Release|Win32
{80EE4A35-E029-4E6E-914D-899D409F40DF}.Release|Win32.Build.0 = Release|Win32
{80EE4A35-E029-4E6E-914D-899D409F40DF}.Release|x64.ActiveCfg = Release|Win32
{A306D2FD-EE79-46BD-AE87-57FB11F82422}.Debug|Win32.ActiveCfg = Debug|Win32
{A306D2FD-EE79-46BD-AE87-57FB11F82422}.Debug|Win32.Build.0 = Debug|Win32
{A306D2FD-EE79-46BD-AE87-57FB11F82422}.Debug|x64.ActiveCfg = Debug|Win32
{A306D2FD-EE79-46BD-AE87-57FB11F82422}.Release|Win32.ActiveCfg = Release|Win32
{A306D2FD-EE79-46BD-AE87-57FB11F82422}.Release|Win32.Build.0 = Release|Win32
{A306D2FD-EE79-46BD-AE87-57FB11F82422}.Release|x64.ActiveCfg = Release|Win32
{FA767ACD-6618-4B57-98D9-B72D4A598A35}.Debug|Win32.ActiveCfg = Debug|Win32
{FA767ACD-6618-4B57-98D9-B72D4A598A35}.Debug|Win32.Build.0 = Debug|Win32
{FA767ACD-6618-4B57-98D9-B72D4A598A35}.Debug|x64.ActiveCfg = Debug|Win32
{FA767ACD-6618-4B57-98D9-B72D4A598A35}.Release|Win32.ActiveCfg = Release|Win32
{FA767ACD-6618-4B57-98D9-B72D4A598A35}.Release|Win32.Build.0 = Release|Win32
{FA767ACD-6618-4B57-98D9-B72D4A598A35}.Release|x64.ActiveCfg = Release|Win32
{BF417606-1735-4937-AD7D-C4564631151A}.Debug|Win32.ActiveCfg = Debug|Win32
{BF417606-1735-4937-AD7D-C4564631151A}.Debug|Win32.Build.0 = Debug|Win32
{BF417606-1735-4937-AD7D-C4564631151A}.Debug|x64.ActiveCfg = Debug|Win32
{BF417606-1735-4937-AD7D-C4564631151A}.Release|Win32.ActiveCfg = Release|Win32
{BF417606-1735-4937-AD7D-C4564631151A}.Release|Win32.Build.0 = Release|Win32
{BF417606-1735-4937-AD7D-C4564631151A}.Release|x64.ActiveCfg = Release|Win32
{3A55ED6A-A42D-47A4-9E4A-FB702E7B2F7B}.Debug|Win32.ActiveCfg = Debug|Win32
{3A55ED6A-A42D-47A4-9E4A-FB702E7B2F7B}.Debug|Win32.Build.0 = Debug|Win32
{3A55ED6A-A42D-47A4-9E4A-FB702E7B2F7B}.Debug|x64.ActiveCfg = Debug|Win32
{3A55ED6A-A42D-47A4-9E4A-FB702E7B2F7B}.Release|Win32.ActiveCfg = Release|Win32
{3A55ED6A-A42D-47A4-9E4A-FB702E7B2F7B}.Release|Win32.Build.0 = Release|Win32
{3A55ED6A-A42D-47A4-9E4A-FB702E7B2F7B}.Release|x64.ActiveCfg = Release|Win32
{CD6C5091-1707-45BA-B315-FAE26681273C}.Debug|Win32.ActiveCfg = Debug|Win32
{CD6C5091-1707-45BA-B315-FAE26681273C}.Debug|Win32.Build.0 = Debug|Win32
{CD6C5091-1707-45BA-B315-FAE26681273C}.Debug|x64.ActiveCfg = Debug|Win32
{CD6C5091-1707-45BA-B315-FAE26681273C}.Release|Win32.ActiveCfg = Release|Win32
{CD6C5091-1707-45BA-B315-FAE26681273C}.Release|Win32.Build.0 = Release|Win32
{CD6C5091-1707-45BA-B315-FAE26681273C}.Release|x64.ActiveCfg = Release|Win32
{993ECF93-83E8-4CD2-8F94-C33B1FB77969}.Debug|Win32.ActiveCfg = Debug|Win32
{993ECF93-83E8-4CD2-8F94-C33B1FB77969}.Debug|Win32.Build.0 = Debug|Win32
{993ECF93-83E8-4CD2-8F94-C33B1FB77969}.Debug|x64.ActiveCfg = Debug|Win32
{993ECF93-83E8-4CD2-8F94-C33B1FB77969}.Release|Win32.ActiveCfg = Release|Win32
{993ECF93-83E8-4CD2-8F94-C33B1FB77969}.Release|Win32.Build.0 = Release|Win32
{993ECF93-83E8-4CD2-8F94-C33B1FB77969}.Release|x64.ActiveCfg = Release|Win32
{F778B8E7-5F1A-4FF2-A89F-FDCCDA78D443}.Debug|Win32.ActiveCfg = Debug|Win32
{F778B8E7-5F1A-4FF2-A89F-FDCCDA78D443}.Debug|Win32.Build.0 = Debug|Win32
{F778B8E7-5F1A-4FF2-A89F-FDCCDA78D443}.Debug|x64.ActiveCfg = Debug|Win32
{F778B8E7-5F1A-4FF2-A89F-FDCCDA78D443}.Release|Win32.ActiveCfg = Release|Win32
{F778B8E7-5F1A-4FF2-A89F-FDCCDA78D443}.Release|Win32.Build.0 = Release|Win32
{F778B8E7-5F1A-4FF2-A89F-FDCCDA78D443}.Release|x64.ActiveCfg = Release|Win32
{EBF27BE8-5C32-4B56-BBF2-775C8FDD79CE}.Debug|Win32.ActiveCfg = Debug|Win32
{EBF27BE8-5C32-4B56-BBF2-775C8FDD79CE}.Debug|Win32.Build.0 = Debug|Win32
{EBF27BE8-5C32-4B56-BBF2-775C8FDD79CE}.Debug|x64.ActiveCfg = Debug|Win32
{EBF27BE8-5C32-4B56-BBF2-775C8FDD79CE}.Release|Win32.ActiveCfg = Release|Win32
{EBF27BE8-5C32-4B56-BBF2-775C8FDD79CE}.Release|Win32.Build.0 = Release|Win32
{EBF27BE8-5C32-4B56-BBF2-775C8FDD79CE}.Release|x64.ActiveCfg = Release|Win32
{D4B30644-C503-4541-9082-17A10A09C2A3}.Debug|Win32.ActiveCfg = Debug|Win32
{D4B30644-C503-4541-9082-17A10A09C2A3}.Debug|Win32.Build.0 = Debug|Win32
{D4B30644-C503-4541-9082-17A10A09C2A3}.Debug|x64.ActiveCfg = Debug|Win32
{D4B30644-C503-4541-9082-17A10A09C2A3}.Release|Win32.ActiveCfg = Release|Win32
{D4B30644-C503-4541-9082-17A10A09C2A3}.Release|Win32.Build.0 = Release|Win32
{D4B30644-C503-4541-9082-17A10A09C2A3}.Release|x64.ActiveCfg = Release|Win32
{D5BC4B59-3D19-4BDC-A036-48194D5AE648}.Debug|Win32.ActiveCfg = Debug|Win32
{D5BC4B59-3D19-4BDC-A036-48194D5AE648}.Debug|Win32.Build.0 = Debug|Win32
{D5BC4B59-3D19-4BDC-A036-48194D5AE648}.Debug|x64.ActiveCfg = Debug|Win32
{D5BC4B59-3D19-4BDC-A036-48194D5AE648}.Release|Win32.ActiveCfg = Release|Win32
{D5BC4B59-3D19-4BDC-A036-48194D5AE648}.Release|Win32.Build.0 = Release|Win32
{D5BC4B59-3D19-4BDC-A036-48194D5AE648}.Release|x64.ActiveCfg = Release|Win32
{102CE150-BE1A-4BFF-B505-FF4EDDC0AFC8}.Debug|Win32.ActiveCfg = Debug|Win32
{102CE150-BE1A-4BFF-B505-FF4EDDC0AFC8}.Debug|Win32.Build.0 = Debug|Win32
{102CE150-BE1A-4BFF-B505-FF4EDDC0AFC8}.Debug|x64.ActiveCfg = Debug|Win32
{102CE150-BE1A-4BFF-B505-FF4EDDC0AFC8}.Release|Win32.ActiveCfg = Release|Win32
{102CE150-BE1A-4BFF-B505-FF4EDDC0AFC8}.Release|Win32.Build.0 = Release|Win32
{102CE150-BE1A-4BFF-B505-FF4EDDC0AFC8}.Release|x64.ActiveCfg = Release|Win32
{F556FB08-2D23-450B-AF1F-1E226DE08421}.Debug|Win32.ActiveCfg = Debug|Win32
{F556FB08-2D23-450B-AF1F-1E226DE08421}.Debug|Win32.Build.0 = Debug|Win32
{F556FB08-2D23-450B-AF1F-1E226DE08421}.Debug|x64.ActiveCfg = Debug|Win32
{F556FB08-2D23-450B-AF1F-1E226DE08421}.Release|Win32.ActiveCfg = Release|Win32
{F556FB08-2D23-450B-AF1F-1E226DE08421}.Release|Win32.Build.0 = Release|Win32
{F556FB08-2D23-450B-AF1F-1E226DE08421}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
67 changes: 67 additions & 0 deletions VS2010/fannfloat/fannfloat.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2F0EC4B6-B3F8-4A05-A884-B935E82E1390}</ProjectGuid>
Expand All @@ -22,32 +30,59 @@
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetExt>.dll</TargetExt>
<TargetName>$(ProjectName)d</TargetName>
<OutDir>$(SolutionDir)..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetExt>.dll</TargetExt>
<TargetName>$(ProjectName)d</TargetName>
<OutDir>$(SolutionDir)..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\bin\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)..\bin\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
Expand All @@ -62,6 +97,20 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_USRDLL;FANN_DLL_EXPORTS;WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
Expand All @@ -80,6 +129,24 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_USRDLL;FANN_DLL_EXPORTS;WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\fann.c" />
<ClCompile Include="..\..\src\fann_cascade.c" />
Expand Down
Binary file modified bin/fanndouble.dll
Binary file not shown.
Binary file modified bin/fanndouble.lib
Binary file not shown.
Binary file modified bin/fannfixed.dll
Binary file not shown.
Binary file modified bin/fannfixed.lib
Binary file not shown.
Binary file modified bin/fannfloat.dll
Binary file not shown.
Binary file modified bin/fannfloat.lib
Binary file not shown.
28 changes: 28 additions & 0 deletions src/fann_train_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,34 @@ FANN_EXTERNAL struct fann_train_data * FANN_API fann_create_train(unsigned int n
return data;
}

FANN_EXTERNAL struct fann_train_data * FANN_API fann_create_train_array(unsigned int num_data, unsigned int num_input, fann_type **input, unsigned int num_output, fann_type **output)
{
unsigned int i, j;
struct fann_train_data *data;
fprintf(stderr, "***test***\n\n");
data = fann_create_train(num_data, num_input, num_output);
printf("Allocated train data at address %p\n", data);

if(data == NULL)
return NULL;

for (i = 0; i < num_data; ++i)
{
for (j = 0; j < num_input; ++j) {
printf("data->input[%d][%d] = %f\n", i, j, input[i][j]);
data->input[i][j] = input[i][j];
}

for (j = 0; j < num_output; ++j) {
printf("data->output[%d][%d] = %f\n", i, j, output[i][j]);
data->output[i][j] = output[i][j];
}
}

return data;
}


/*
* Creates training data from a callback function.
*/
Expand Down
Loading

0 comments on commit d914171

Please sign in to comment.