当前位置: 首页>>代码示例>>C#>>正文


C# Dataset类代码示例

本文整理汇总了C#中Dataset的典型用法代码示例。如果您正苦于以下问题:C# Dataset类的具体用法?C# Dataset怎么用?C# Dataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Dataset类属于命名空间,在下文中一共展示了Dataset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test

 public virtual void Test(Dataset data)
 {
     for (int i = 0; i < data.input.Count; ++i)
     {
         Console.WriteLine("{0} -> {1},  net = {2}", data.input[i].Print(), data.output[i].Print(), Predict(data.input[i]).Print());
     }
 }
开发者ID:pragmascript,项目名称:pragma-learn,代码行数:7,代码来源:SupervisedLearner.cs

示例2: SupportVectorMachinePerformanceTest

    public void SupportVectorMachinePerformanceTest() {
      ex = null;

      var cv = new CrossValidation();
      cv.Algorithm = new SupportVectorRegression();
      var rand = new HeuristicLab.Random.MersenneTwister();
      double[,] data = GenerateData(1000, rand);
      List<string> variables = new List<string>() { "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "y" };
      Dataset ds = new Dataset(variables, data);
      cv.Problem.ProblemDataParameter.ActualValue = new RegressionProblemData(ds, variables.Take(10), variables.Last());
      cv.Folds.Value = 5;
      cv.SamplesStart.Value = 0;
      cv.SamplesEnd.Value = 999;

      cv.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(cv_ExceptionOccurred);
      cv.Stopped += new EventHandler(cv_Stopped);

      cv.Prepare();
      cv.Start();
      trigger.WaitOne();
      if (ex != null) throw ex;

      TestContext.WriteLine("Runtime: {0}", cv.ExecutionTime.ToString());

    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:25,代码来源:SupportVectorMachineTest.cs

示例3: TestMissingValues

        public void TestMissingValues()
        {
            var contact = new Contact("Jim", "Does", "[email protected]", "Lollipops", "837773");
            var dataSet = new Dataset(new Site(4, "New Site", "Tim Jones", contact, contact, new GPSCoords(0, 0, "argis")));

            var sensor = new Sensor("Dummy Sensor", "Does stuff", 10, 0, "C", 5, dataSet);

            sensor.AddState(new SensorState(sensor, DateTime.Now));
            sensor.CurrentState.Values.Add(new DateTime(1990, 5, 1, 4, 0, 0), 15);
            sensor.CurrentState.Values.Add(new DateTime(1990, 5, 1, 5, 0, 0), 15);
            sensor.CurrentState.Values.Add(new DateTime(1991, 8, 2, 0, 0, 0), 15);

            dataSet.AddSensor(sensor);

            dataSet.DataInterval = 60;

            dataSet.HighestYearLoaded = 1;

            Assert.AreEqual(60, dataSet.DataInterval);

            var missingValues = missingValuesDetector.GetDetectedValues(sensor);

            for (var i = new DateTime(1990, 5, 1, 6, 0, 0); i < new DateTime(1991, 8, 2, 0, 0, 0); i = i.AddHours(1))
            {
                Assert.Contains(new ErroneousValue(i, missingValuesDetector, sensor), missingValues);
            }
        }
开发者ID:rwlamont,项目名称:AllItUp,代码行数:27,代码来源:MissingValuesDetectorTests.cs

示例4: LegendItemBlockContainer

 public LegendItemBlockContainer(Arrangement arrangement, Dataset dataset, IComparable seriesKey)
   : base(arrangement)
 {
   LegendItemBlockContainer itemBlockContainer = this;
   this.dataset = dataset;
   this.seriesKey = seriesKey;
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:7,代码来源:LegendItemBlockContainer.cs

示例5: ImportData

    public override ITimeSeriesPrognosisProblemData ImportData(string path) {
      TableFileParser csvFileParser = new TableFileParser();
      csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path));

      Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
      string targetVar = csvFileParser.VariableNames.Last();

      IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar));

      ITimeSeriesPrognosisProblemData timeSeriesPrognosisData = new TimeSeriesPrognosisProblemData(dataset, allowedInputVars, targetVar);

      int trainingPartEnd = csvFileParser.Rows * 2 / 3;
      timeSeriesPrognosisData.TrainingPartition.Start = 0;
      timeSeriesPrognosisData.TrainingPartition.End = trainingPartEnd;
      timeSeriesPrognosisData.TestPartition.Start = trainingPartEnd;
      timeSeriesPrognosisData.TestPartition.End = csvFileParser.Rows;

      int pos = path.LastIndexOf('\\');
      if (pos < 0)
        timeSeriesPrognosisData.Name = path;
      else {
        pos++;
        timeSeriesPrognosisData.Name = path.Substring(pos, path.Length - pos);
      }
      return timeSeriesPrognosisData;
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:26,代码来源:TimeSeriesPrognosisCSVInstanceProvider.cs

示例6: bTrainLines_Click

        private void bTrainLines_Click(object sender, EventArgs e)
        {
            data = PragmaLearn.Exampels.Datasets.Lines.Create(100000);
            var hidden = data.GetInputDimension();
            if (network.GetInputs() != data.GetInputDimension() || network.GetOutputs() != data.GetOutputDimension())
                network.Init(data.GetInputDimension(), hidden, hidden, data.GetOutputDimension());

            network.learningRate = 0.0001f;
            network.lambda = 0.0f;

            Task.Run(() =>
            {
                running = true;

                int t = 0;
                while (running)
                {
                    t++;
                    // network.Train(data);

                    var batch = genMiniBatch(100);
                    network.TrainMiniBatch(data, batch);

                    Console.WriteLine("LEARNING RATE: " + network.learningRate);
                    //if (network.learningRate > 0.0001)
                    //    network.learningRate *= 0.9998;
                    if (t % 10 == 0)
                    {
                        this.Invoke(test);

                    }

                }
            });
        }
开发者ID:pragmascript,项目名称:pragma-learn,代码行数:35,代码来源:MainForm.cs

示例7: PlatformDb

        public PlatformDb(IDbContext context)
        {
            #region Preconditions

            if (context == null)
                throw new ArgumentNullException(nameof(context));

            #endregion

            this.context = context;
            
            Apps              = new Dataset<App>(context);
            AppInstances      = new Dataset<AppInstance>(context);
            AppReleases       = new Dataset<AppRelease>(context);
            AppEvents         = new Dataset<AppEvent>(context);
            AppErrors         = new Dataset<AppError>(context);

            // Frontends
            Frontends         = new Dataset<Frontend>(context);
            FrontendBranches  = new Dataset<FrontendBranch>(context);
            FrontendReleases  = new Dataset<FrontendRelease>(context);

            // Networks
            Networks          = new Dataset<Network>(context);
            NetworkInterfaces = new Dataset<NetworkInterfaceInfo>(context);

            Hosts             = new Dataset<Host>(context);
            Volumes           = new Dataset<VolumeInfo>(context);
            Images            = new Dataset<Image>(context);
        }
开发者ID:carbon,项目名称:Platform,代码行数:30,代码来源:PlatformDb.cs

示例8: createVisualization

	protected Visualization createVisualization(Dataset dataset, Transform parent) { 
		
		GameObject go = new GameObject();
		//string folderName = new DirectoryInfo(rootFolder).Name;
		Visualization v = go.AddComponent<Visualization>();		
		go.name = dataset.csvMetadataFile.name;			
		go.transform.parent = parent;	
		
		AutographerParser parser = go.AddComponent<AutographerParser>();
		//parser.allowInterp = this.GetComponent<AutographerParser>().allowInterp;
		//parser.imageResolution = this.GetComponent<AutographerParser>().imageResolution;		
		
		v.projectName = dataset.csvMetadataFile.name;
		v.csvMetadataFile = dataset.csvMetadataFile;
		v.imageDirectory = dataset.imageDirectory;
		v.imageExtension = dataset.imageExtension;
		//v.tb = this;
		v.targetMetadataParser = v.GetComponent<MetadataParser>();
		//v.pather = this.pather;
		//v.DoubleSidedMesh = this.DoubleSidedMesh;
		//v.quadTemplate = this.quadTemplate;
		v.quadTemplates = dataset.quadTemplates;
		v.tvisLayout = this.tvisLayout;
		v.usePhotos = this.usePhotos;
		//v.transform.parent = this.sceneParent;
		return v;
	}
开发者ID:rlawther,项目名称:AmnesiaMuseumUnity-Mobile,代码行数:27,代码来源:VisualizerManager.cs

示例9: ImportData

    public override IRegressionProblemData ImportData(string path) {
      TableFileParser csvFileParser = new TableFileParser();
      csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path));

      Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
      string targetVar = dataset.DoubleVariables.Last();

      // turn off input variables that are constant in the training partition
      var allowedInputVars = new List<string>();
      var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
      if (trainingIndizes.Count() >= 2) {
        foreach (var variableName in dataset.DoubleVariables) {
          if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 &&
            variableName != targetVar)
            allowedInputVars.Add(variableName);
        }
      } else {
        allowedInputVars.AddRange(dataset.DoubleVariables.Where(x => !x.Equals(targetVar)));
      }

      IRegressionProblemData regressionData = new RegressionProblemData(dataset, allowedInputVars, targetVar);

      var trainingPartEnd = trainingIndizes.Last();
      regressionData.TrainingPartition.Start = trainingIndizes.First();
      regressionData.TrainingPartition.End = trainingPartEnd;
      regressionData.TestPartition.Start = trainingPartEnd;
      regressionData.TestPartition.End = csvFileParser.Rows;

      regressionData.Name = Path.GetFileName(path);

      return regressionData;
    }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:32,代码来源:RegressionCSVInstanceProvider.cs

示例10: LoadData

    public override IRegressionProblemData LoadData(IDataDescriptor id) {
      var descriptor = (ResourceRegressionDataDescriptor)id;

      var instanceArchiveName = GetResourceName(FileName + @"\.zip");
      using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
        var entry = instancesZipFile.GetEntry(descriptor.ResourceName);
        NumberFormatInfo numberFormat;
        DateTimeFormatInfo dateFormat;
        char separator;
        using (Stream stream = entry.Open()) {
          TableFileParser.DetermineFileFormat(stream, out numberFormat, out dateFormat, out separator);
        }

        TableFileParser csvFileParser = new TableFileParser();
        using (Stream stream = entry.Open()) {
          csvFileParser.Parse(stream, numberFormat, dateFormat, separator, true);
        }

        Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);
        if (!descriptor.CheckVariableNames(csvFileParser.VariableNames)) {
          throw new ArgumentException("Parsed file contains variables which are not in the descriptor.");
        }

        return descriptor.GenerateRegressionData(dataset);
      }
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:26,代码来源:ResourceRegressionInstanceProvider.cs

示例11: OnExecuteActionActivated

    protected void OnExecuteActionActivated(Object sender, System.EventArgs e)
    {
        String connectionString ="Server=localhost;Database=dbprueba;User Id=dbprueba;Password=1234";
        NpgsqlCommand selectCommand = dbConnection.CreateCommand ();
        selectCommand.CommandText = "select * from categoria";
        NpgsqlDataAdapter dbDataAdapter = new NpgsqlDataAdapter();
        new NpgsqlCommandBuilder(dbDataAdapter);

            dbDataAdapter.SelectCommand = selectCommand;

        DataSet dataset = new Dataset();
        dbDataAdapter.Fill (DataSet);
        //Console.WriteLine("Tables.Count={0}", dataSet.Tables.Count);

        foreach(DataTable dataTable in dataset.Tables)
            show (dataTable);

        DataRow dataRow = dataset.Tables[0].Rows[0];
        dataRow["Nombre"] = DateTime.Now.ToString();

        Console.WriteLine("Cambios");
        show (dataset.Tables[0]);

        dbDataAdapter.Update(dataset);
    }
开发者ID:daalol,项目名称:ad,代码行数:25,代码来源:MainWindow.cs

示例12: ImportData

    public override IClusteringProblemData ImportData(string path) {
      var csvFileParser = new TableFileParser();
      csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path));

      Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values);

      // turn of input variables that are constant in the training partition
      var allowedInputVars = new List<string>();
      var trainingIndizes = Enumerable.Range(0, (csvFileParser.Rows * 2) / 3);
      if (trainingIndizes.Count() >= 2) {
        foreach (var variableName in dataset.DoubleVariables) {
          if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0)
            allowedInputVars.Add(variableName);
        }
      } else {
        allowedInputVars.AddRange(dataset.DoubleVariables);
      }

      ClusteringProblemData clusteringData = new ClusteringProblemData(dataset, allowedInputVars);

      int trainingPartEnd = trainingIndizes.Last();
      clusteringData.TrainingPartition.Start = trainingIndizes.First();
      clusteringData.TrainingPartition.End = trainingPartEnd;
      clusteringData.TestPartition.Start = trainingPartEnd;
      clusteringData.TestPartition.End = csvFileParser.Rows;

      clusteringData.Name = Path.GetFileName(path);

      return clusteringData;
    }
开发者ID:thunder176,项目名称:HeuristicLab,代码行数:30,代码来源:ClusteringCSVInstanceProvider.cs

示例13: PolhemusController

        public PolhemusController(Boolean polhemusConnected)
        {
            lastDatasetForEachStation = new Dictionary<int, Dataset>();
            //for (int i = 1; i <= Constants.numberOfPlayers; i++)
            lastDatasetForEachStation[1] = new Dataset();
            lastDatasetForEachStation[2] = new Dataset();

            if (polhemusConnected == true)
            {
                try
                {
                    Factory.CreateInstance(Debugmode.NoDebug);

                    Factory.Instance.PollingDelay = 30;
                    Factory.Instance.OnPolhemusButtonDown += new PolhemusEvent(OnPolhemusButtonDown);
                    Factory.Instance.OnPolhemusButtonUp += new PolhemusEvent(OnPolhemusButtonUp);
                    Factory.Instance.OnPolhemusMove += new PolhemusEvent(OnPolhemusMove);
                    isConnected = true;

                    Console.WriteLine("done with polhemus setup");
                }
                catch (Exception e)
                {
                    Console.WriteLine("There is no Polhemus connection: " + e);
                    isConnected = false;
                }
                sharedPolhemusController = this;
            }
        }
开发者ID:solson,项目名称:DSAE,代码行数:29,代码来源:PolhemusController.cs

示例14: addPolhemusDataset

 public void addPolhemusDataset(Dataset dataset)
 {
     polhemusDatasets.Add(dataset);
     if (polhemusDatasets.Count == 4)
     {
         setUpCalibration();
     }
 }
开发者ID:solson,项目名称:DSAE,代码行数:8,代码来源:SimpleCalibrationController.cs

示例15: DatasetVersion

 /// <summary>
 ///
 /// </summary>
 /// <remarks></remarks>
 /// <seealso cref=""/>
 /// <param name="dataset"></param>
 public DatasetVersion(Dataset   dataset)
     : this()
 {
     this.Dataset = dataset;
     //if (this.Dataset.DataStructure is UnStructuredDataStructure)
     //{
     //}
 }
开发者ID:BEXIS2,项目名称:Core,代码行数:14,代码来源:DatasetVersion.cs


注:本文中的Dataset类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。