Skip to content

Extension methods from TimeSeriesStatic.cs (A Typo and A Missing Nuget for Static Time Series) #3203

Closed
@esso23

Description

@esso23

System information

  • Windows 10 Pro
  • .NET 4.6.1

Issue

  • What did you do?
    I am trying to use extension method DetectSpikeBySsa from class SsaSpikeDetecotStaticExtensions (there's a typo in the name btw). I'm using static API and TimeSeries package.

  • What happened?
    The extension method (and any other extension methods from that namespace) is not available to use on Scalar<float> type.
    I am using SsaSpikeDetection() test from TimeSeriesStaticTests.cs as a reference.

  • What did you expect?
    Expected usage (from the referenced test):

var staticLearningPipeline = staticData.MakeNewEstimator()
                .Append(r => r.Value.DetectSpikeBySsa(80, ChangeHistoryLength, TrainingWindowSize, SeasonalityWindowSize));

but DetectSpikeBySsa is not available on my Scalar<float>.

Source code / logs

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.ML;
using Microsoft.ML.Data;
using Microsoft.ML.Transforms;
using Microsoft.ML.Transforms.TimeSeries;
using Microsoft.ML.StaticPipe;
using Microsoft.ML.Trainers;

namespace xxx.Modules.Data.ML.Dev
{
    public class DataLoader
    {
        private sealed class SpikePrediction
        {
            [VectorType(3)]
            public double[] Data;
        }

        private class DataObject
        {
            public float Gain { get; set; }
        }

        public DataLoader()
        {
            MLContext mlContext = new MLContext(seed: 0);
            var loader = mlContext.Data.CreateTextLoader(ctx => (
                    Id: ctx.LoadText(0),
                    Begin: ctx.LoadText(1),
                    End: ctx.LoadText(2),
                    Gain: ctx.LoadFloat(3),
                    Confidence: ctx.LoadFloat(4)
                ), separator: ',', hasHeader: true);

            var data = loader.Load("output_intervals.csv");

            var preview = data.AsDynamic.Preview();

            var learningPipeline = loader.MakeNewEstimator()
                .Append(r => (
                    r.Gain.DetectSpikeBySsa(80, 800 / 4, 800 / 2, 800 / 8) // Cannot resolve symbol...
                ));
        }
    }
}

Included packages:

<packages>
  <package id="Castle.Core" version="4.2.1" targetFramework="net461" />
  <package id="Microsoft.ML" version="1.0.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.CpuMath" version="1.0.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.DataView" version="1.0.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.Experimental" version="0.12.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.FastTree" version="1.0.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.ImageAnalytics" version="1.0.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.Mkl.Redist" version="1.0.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.Recommender" version="0.12.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.StaticPipe" version="0.12.0-preview" targetFramework="net461" />
  <package id="Microsoft.ML.TimeSeries" version="0.12.0-preview" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
  <package id="NLog" version="4.6.1" targetFramework="net461" />
  <package id="System.Buffers" version="4.4.0" targetFramework="net461" />
  <package id="System.CodeDom" version="4.4.0" targetFramework="net461" />
  <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
  <package id="System.Drawing.Common" version="4.5.0" targetFramework="net461" />
  <package id="System.Memory" version="4.5.1" targetFramework="net461" />
  <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net461" />
  <package id="System.Reactive" version="4.0.0" targetFramework="net461" />
  <package id="System.Reflection.Emit.Lightweight" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net461" />
  <package id="System.Threading.Tasks.Dataflow" version="4.8.0" targetFramework="net461" />
  <package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
  <package id="WampSharp" version="19.3.1" targetFramework="net461" />
</packages>

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestnitNeeds a really small fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions