Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13928


Ignore:
Timestamp:
06/20/16 16:38:54 (8 years ago)
Author:
gkronber
Message:

#745: first version of elastic-net alg that runs in HL

Location:
branches/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4

    • Property svn:ignore set to
      .vs
      bin
      *.user
      obj
      Plugin.cs
  • branches/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4/ElasticNetLinearRegression.cs

    r13927 r13928  
    5858      var nCoeff = coeff.GetLength(1);
    5959      var dataRows = new DataRow[nCoeff];
     60      var allowedVars = Problem.ProblemData.AllowedInputVariables.ToArray();
    6061      for (int i = 0; i < nCoeff; i++) {
    61         var coeffId = string.Format("c_{0}", i);
    62         dataRows[i] = new DataRow(coeffId, coeffId, Enumerable.Range(0, nLambdas).Select(r => coeff[r, i]).ToArray());
     62        var coeffId = allowedVars[i];
     63        var path = Enumerable.Range(0, nLambdas).Select(r => coeff[r, i]).ToArray();
     64        dataRows[i] = new DataRow(coeffId, coeffId, path);
    6365        coeffTable.Rows.Add(dataRows[i]);
    6466      }
     
    6870      var rsqTable = new DataTable("R-Squared", "Path of R² values over different lambda values");
    6971      rsqTable.Rows.Add(new DataRow("R-Squared", "Path of R² values over different lambda values", rsq));
    70       Results.Add(new Result(rsqTable.Name, rsqTable.Description, coeffTable));
    71     }
    72 
    73     //     private static void TestTower() {
    74     //       var prov = new HeuristicLab.Problems.Instances.DataAnalysis.RegressionRealWorldInstanceProvider();
    75     //       var towerDesc = prov.GetDataDescriptors().Where(dd => dd.Name.Contains("Tower")).Single();
    76     //       try {
    77     //         var problemData = prov.LoadData(towerDesc);
    78     //
    79     //         double[] lambda;
    80     //         double[] rsq;
    81     //         double[,] coeff;
    82     //         double[] intercept;
    83     //         RunElasticNetLinearRegression(problemData, 0.5, out lambda, out rsq, out coeff, out intercept);
    84     //
    85     //         for (int i = 0; i < rsq.Length; i++) {
    86     //           Console.WriteLine(rsq[i]);
    87     //         }
    88     //
    89     //         double rsq0;
    90     //         CreateElasticNetLinearRegressionSolution(problemData, 0.5, lambda.Skip(20).First(), out rsq0);
    91     //
    92     //         CreateElasticNetLinearRegressionSolution(problemData, 0.5, lambda.Skip(20).Take(10).ToArray(), out rsq);
    93     //
    94     //
    95     //       }
    96     //       catch (Exception e) {
    97     //       }
    98     //     }
     72      Results.Add(new Result(rsqTable.Name, rsqTable.Description, rsqTable));
     73    }
    9974
    10075    public static double[] CreateElasticNetLinearRegressionSolution(IRegressionProblemData problemData, double penalty, double lambda,
  • branches/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4/HeuristicLab.Algorithms.DataAnalysis.Glmnet.csproj

    r13927 r13928  
    99    <AppDesignerFolder>Properties</AppDesignerFolder>
    1010    <RootNamespace>HeuristicLab.Algorithms.DataAnalysis.Glmnet</RootNamespace>
    11     <AssemblyName>HeuristicLab.Algorithms.DataAnalysis.Glmnet</AssemblyName>
     11    <AssemblyName>HeuristicLab.Algorithms.DataAnalysis.Glmnet-3.4</AssemblyName>
    1212    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    1313    <FileAlignment>512</FileAlignment>
     
    4545  </PropertyGroup>
    4646  <ItemGroup>
    47     <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4">
     47    <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    4848      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.DataAnalysis-3.4.dll</HintPath>
     49      <SpecificVersion>False</SpecificVersion>
     50      <Private>False</Private>
    4951    </Reference>
    50     <Reference Include="HeuristicLab.Analysis-3.3">
     52    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    5153      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     54      <SpecificVersion>False</SpecificVersion>
     55      <Private>False</Private>
    5256    </Reference>
    5357    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     58      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
    5459      <SpecificVersion>False</SpecificVersion>
    55       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     60      <Private>False</Private>
    5661    </Reference>
    57     <Reference Include="HeuristicLab.Common-3.3">
     62    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    5863      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     64      <SpecificVersion>False</SpecificVersion>
     65      <Private>False</Private>
    5966    </Reference>
    60     <Reference Include="HeuristicLab.Core-3.3">
     67    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    6168      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     69      <SpecificVersion>False</SpecificVersion>
     70      <Private>False</Private>
    6271    </Reference>
    63     <Reference Include="HeuristicLab.Data-3.3">
     72    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    6473      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     74      <SpecificVersion>False</SpecificVersion>
     75      <Private>False</Private>
    6576    </Reference>
    6677    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     78      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
    6779      <SpecificVersion>False</SpecificVersion>
    68       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     80      <Private>False</Private>
    6981    </Reference>
    70     <Reference Include="HeuristicLab.Parameters-3.3">
     82    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    7183      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     84      <SpecificVersion>False</SpecificVersion>
     85      <Private>False</Private>
    7286    </Reference>
    7387    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     88      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
    7489      <SpecificVersion>False</SpecificVersion>
    75       <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     90      <Private>False</Private>
    7691    </Reference>
    77     <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
     92    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    7893      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     94      <SpecificVersion>False</SpecificVersion>
     95      <Private>False</Private>
    7996    </Reference>
    80     <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
     97    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    8198      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
     99      <SpecificVersion>False</SpecificVersion>
     100      <Private>False</Private>
    82101    </Reference>
    83     <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec" />
     102    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     103      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     104      <SpecificVersion>False</SpecificVersion>
     105      <Private>False</Private>
     106    </Reference>
    84107    <Reference Include="System" />
    85108    <Reference Include="System.Core" />
     
    93116  </ItemGroup>
    94117  <ItemGroup>
     118    <None Include="Build.cmd" />
    95119    <None Include="HeuristicLab.snk" />
    96120    <None Include="Plugin.cs.frame" />
     121    <None Include="PreBuildEvent.cmd" />
    97122    <None Include="Properties\AssemblyInfo.cs.frame" />
    98123  </ItemGroup>
    99124  <ItemGroup>
     125    <Content Include="glmnet-license-gpl2.txt" />
    100126    <Content Include="glmnet-x64.dll">
    101127      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     
    107133  <ItemGroup>
    108134    <Compile Include="ElasticNetLinearRegression.cs" />
     135    <Compile Include="Plugin.cs">
     136      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     137    </Compile>
     138    <Compile Include="Properties\AssemblyInfo.cs" />
    109139  </ItemGroup>
    110140  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     
    116146  </Target>
    117147  -->
     148  <PropertyGroup>
     149    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     150set ProjectDir=$(ProjectDir)
     151set SolutionDir=$(SolutionDir)
     152set Outdir=$(Outdir)
     153
     154call PreBuildEvent.cmd
     155</PreBuildEvent>
     156    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     157export ProjectDir=$(ProjectDir)
     158export SolutionDir=$(SolutionDir)
     159
     160$SolutionDir/PreBuildEvent.sh
     161</PreBuildEvent>
     162  </PropertyGroup>
    118163</Project>
  • branches/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4/Plugin.cs.frame

    r13927 r13928  
    2626  /// Plugin class for HeuristicLab.Algorithms.DataAnalysis.Glmnet plugin which wraps the glmnet implementation by Jerome Friedman, Trevor Hastie, Noah Simon, Rob Tibshirani, see https://cran.r-project.org/web/packages/glmnet/index.html
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Algorithms.DataAnalysis.Glmnet", "/// Plugin class for HeuristicLab.Algorithms.DataAnalysis.Glmnet plugin which wraps the glmnet implementation by Jerome Friedman, Trevor Hastie, Noah Simon, Rob Tibshirani, see https://cran.r-project.org/web/packages/glmnet/index.html", "3.4.1.$WCREV$")]
     28  [Plugin("HeuristicLab.Algorithms.DataAnalysis.Glmnet", "Plugin class for HeuristicLab.Algorithms.DataAnalysis.Glmnet plugin which wraps the glmnet implementation by Jerome Friedman, Trevor Hastie, Noah Simon, Rob Tibshirani, see https://cran.r-project.org/web/packages/glmnet/index.html", "3.4.1.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Algorithms.DataAnalysis.Glmnet-3.4.dll", PluginFileType.Assembly)]
    3030  [PluginFile("glmnet-x86.dll", PluginFileType.NativeDll)]
    3131  [PluginFile("glmnet-x64.dll", PluginFileType.NativeDll)]
     32  [PluginFile("glmnet-license-gpl2.txt", PluginFileType.License)]
     33  [PluginDependency("HeuristicLab.Algorithms.DataAnalysis", "3.4")]
     34  [PluginDependency("HeuristicLab.Analysis", "3.3")]
     35  [PluginDependency("HeuristicLab.Collections", "3.3")]
     36  [PluginDependency("HeuristicLab.Common", "3.3")]
     37  [PluginDependency("HeuristicLab.Core", "3.3")]
     38  [PluginDependency("HeuristicLab.Data", "3.3")]
     39  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     40  [PluginDependency("HeuristicLab.Parameters", "3.3")]
     41  [PluginDependency("HeuristicLab.Persistence", "3.3")]
     42  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
     43  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
    3244  public class HeuristicLabAlgorithmsDataAnalysisGlmnetPlugin : PluginBase {
    3345  }
  • branches/HeuristicLab.Algorithms.DataAnalysis.Glmnet/3.4/Properties

    • Property svn:ignore set to
      AssemblyInfo.cs
Note: See TracChangeset for help on using the changeset viewer.