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


C# Client.Get方法代码示例

本文整理汇总了C#中Client.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Client.Get方法的具体用法?C# Client.Get怎么用?C# Client.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


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

示例1: Main

        static async void Main()
        {
            // New BigML client with username and API key
            Console.Write("user: "); var User = Console.ReadLine();
            Console.Write("key: "); var ApiKey = Console.ReadLine();
            // set true the development mode
            var client = new Client(User, ApiKey, true);

            // create a source
            var remoteURL = @"azure://csv/iris.csv?AccountName=bigmlpublic";
            Source.Arguments remoteArguments = new Source.Arguments();
            remoteArguments.Add("remote", remoteURL);
            var sourceFromAzure = await client.Create(remoteArguments);
            while ((sourceFromAzure = await client.Get(sourceFromAzure)).StatusMessage.NotSuccessOrFail()) await Task.Delay(10);
            Console.WriteLine(sourceFromAzure.StatusMessage.ToString());

            var dataset = await client.Create(sourceFromAzure);
            // No push, so we need to busy wait for the dataset to be processed.
            while ((dataset = await client.Get(dataset)).StatusMessage.NotSuccessOrFail()) await Task.Delay(10);
            Console.WriteLine(dataset.StatusMessage.ToString());

            // Customized cluster from dataset. 3 is the desired number of cluster. Sets cluster name: "my cluster"
            var cluster = await client.CreateCluster(dataset, "my cluster", 3);
            while ((cluster = await client.Get(cluster)).StatusMessage.NotSuccessOrFail()) await Task.Delay(10);
            Console.WriteLine(cluster.StatusMessage.ToString());
        }
开发者ID:CVertex,项目名称:bigml-csharp,代码行数:26,代码来源:DevClusterFromAzureSource.cs

示例2: CacheAloneInsert

        private static void CacheAloneInsert(Client c)
        {
            c.RemoveAll();

            c.Add("Key", 100000, typeof(int));

            List<string> keys = c.GetAllKeys();
            Assert.AreEqual(1, keys.Count);

            foreach (string key in keys)
            {
                var value = c.Get<int>(key);
                Assert.AreEqual(key, "Key");
                Assert.AreEqual(100000, value);
                var valueType = c.Get(key);
                Assert.AreEqual(key, "Key");
                Assert.AreEqual(100000, valueType);

                c.Remove(key);
            }

            System.Threading.Thread.Sleep(5000);

            keys = c.GetAllKeys();

            Assert.AreEqual(0, keys.Count);
        }
开发者ID:emiliotorrens,项目名称:MongoKeyValueClient.NET,代码行数:27,代码来源:Test.cs

示例3: Main

        static async void Main()
        {
            // New BigML client with username and API key
            Console.Write("user: "); var User = Console.ReadLine();
            Console.Write("key: "); var ApiKey = Console.ReadLine();
            var client = new Client(User, ApiKey);

            // Create a source from a file in azure storage
            var remoteURL = @"azure://csv/iris.csv?AccountName=bigmlpublic";
            Source.Arguments remoteArguments = new Source.Arguments();
            remoteArguments.Remote = remoteURL;
            remoteArguments.Name = "Iris from Azure";
            var sourceFromAzure = await client.Create(remoteArguments);
            while ((sourceFromAzure = await client.Get(sourceFromAzure)).StatusMessage.NotSuccessOrFail()) await Task.Delay(10);

            // Create a dataset from this sources
            var dataset = await client.Create(sourceFromAzure);
            while ((dataset = await client.Get(dataset)).StatusMessage.NotSuccessOrFail()) await Task.Delay(10);
            Console.WriteLine(dataset.StatusMessage.ToString());

            // Default model from this dataset
            var model = await client.Create(dataset);
            // No push, so we need to busy wait for the source to be processed.
            while ((model = await client.Get(model)).StatusMessage.NotSuccessOrFail()) await Task.Delay(10);
            Console.WriteLine(model.StatusMessage.ToString());
        }
开发者ID:CVertex,项目名称:bigml-csharp,代码行数:26,代码来源:ModelFromAzureSource.cs

示例4: Main

        static async void Main()
        {
            // New BigML client with username and API key
            Console.Write("user: "); var User = Console.ReadLine();
            Console.Write("key: "); var ApiKey = Console.ReadLine();
            var client = new Client(User, ApiKey);

            // retrieve a anomaly detector with a known ID
            Anomaly anomaly;
            string anomalyId = "anomaly/54daa82eaf447f5daa000XXY"; //Put your ID here
            if ((anomaly = await client.Get<Anomaly>(anomalyId)).StatusMessage.StatusCode != Code.Finished) {
                Console.WriteLine("Error retrieving anomaly " + anomalyId);
            } else {
                Console.WriteLine(anomaly.StatusMessage.ToString());
            }

            //Input the data and calculate the score
            var parameters = new AnomalyScore.Arguments();
            parameters.Anomaly = anomaly.Resource;
            parameters.InputData.Add("000000", 7.9);
            parameters.InputData.Add("000001", 3.8);
            parameters.InputData.Add("000002", 6.4);
            parameters.InputData.Add("000003", 2);
            parameters.InputData.Add("000004", "virginica");
            AnomalyScore score;
            while ((score = await client.Create<AnomalyScore>(parameters)).StatusMessage.StatusCode != Code.Finished) await Task.Delay(10);
            Console.WriteLine(score.StatusMessage.ToString());

        }
开发者ID:CVertex,项目名称:bigml-csharp,代码行数:29,代码来源:ScoreAfterRetrieveAnomaly.cs

示例5: ObjectViewerLoad

        private void ObjectViewerLoad(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                var cacheClient = new Client(Prefix);
                tbKey.Text = Key;
                object data = cacheClient.Get(Key);
                Text = string.Format("Object Viewer | Key : {0} | Lenght: ", Key);

                if (ConfigurationManager.AppSettings["ObjectViewerMode"] == "JSON")
                {
                    richTbXml.Text = BeautifyJson(data.ToJson());
                }
                else
                {
                    string strdata = ToXml(data);
                    //AddColouredText(IndentXml(strdata));
                    IndentXml(strdata);
                    richTbXml.Clear();
                    richTbXml.AppendText(strdata);
                }
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
开发者ID:emiliotorrens,项目名称:MongoKeyValueClient.NET,代码行数:28,代码来源:ObjectViewer.cs

示例6: Main

 // test entry point
 public static void Main(string[] args)
 {
     Client.SetTrace(true);
     string[] nodes = { "192.168.137.236:7080" };
     Client client = new Client(nodes);
     client.SetMasterTimeout(3 * 1000);
     client.SetGlobalTimeout(10 * 1000);
     client.UseDatabase("testdb");
     client.UseTable("testtable");
     client.Set("key", "value");
     string value = client.Get("key");
 }
开发者ID:rokiCode,项目名称:scaliendb,代码行数:13,代码来源:Test.cs

示例7: Main

        static async void Main()
        {
            // New BigML client with username and API key
            Console.Write("user: "); var User = Console.ReadLine();
            Console.Write("key: "); var ApiKey = Console.ReadLine();
            var client = new Client(User, ApiKey);

            Model model;
            string modelId = "model/575085112275c16672016XXX";
            while ((model = await client.Get<Model>(modelId)).StatusMessage.StatusCode != Code.Finished) await Task.Delay(10);
            Model.LocalModel localModel = model.ModelStructure;

            Dictionary<string, dynamic> inputData = new Dictionary<string, dynamic>();
            inputData.Add("000000", 1.6);
            inputData.Add("000002", 5);
            inputData.Add("000003", 1.6);
            Model.Node prediction = localModel.predict(inputData);

        }
开发者ID:bigmlcom,项目名称:bigml-csharp,代码行数:19,代码来源:RetrieveModelPredictLocally.cs

示例8: Main

        static async void Main()
        {
            // New BigML client in production mode with username and API key
            Console.Write("user: "); var User = Console.ReadLine();
            Console.Write("key: "); var ApiKey = Console.ReadLine();
            var client = new Client(User, ApiKey);

            // change the id to your model, ensemble or logisticregression
            string modelId = "ensemble/54ad6d0558a27e2ddf000XXX";
            string datasetId = "dataset/54ad6d0558a27e2ddf000YYY";

            var parameters = new BatchPrediction.Arguments();
            // "model" parameter can be a model, an ensemble or a logisticregression
            parameters.Add("model", modelId);
            parameters.Add("dataset", datasetId);
            parameters.Add("output_dataset", true);
            BatchPrediction batchPrediction;
            batchPrediction = await client.CreateBatchPrediction(parameters);
            string batchPredictionId = batchPrediction.Resource;
            // wait for finish
            while ((batchPrediction = await client.Get<BatchPrediction>(batchPredictionId)).StatusMessage.NotSuccessOrFail()) await Task.Delay(10);
            Console.WriteLine(batchPrediction.OutputDatasetResource);
        }
开发者ID:bigmlcom,项目名称:bigml-csharp,代码行数:23,代码来源:CreatesBatchPredition.cs

示例9: KeySize

        private static void KeySize(Client c)
        {
            try
            {
                List<string> keys = new List<string>(5010);
                System.Threading.Tasks.Parallel.For(0, 5000, index => keys.Add("THIS_IS_A_CACHE_KAYE" + index.ToString()));

                c.Get(keys);
            }
            catch (Exception e)
            {
                Assert.AreEqual(e.GetBaseException().GetType().ToString(), typeof(System.IO.FileFormatException).ToString());
            }
        }
开发者ID:emiliotorrens,项目名称:MongoKeyValueClient.NET,代码行数:14,代码来源:Test.cs

示例10: CacheInsert

        private static void CacheInsert(Client c)
        {
            c.RemoveAll();

            System.Threading.Tasks.Parallel.For(0, 1000, index => c.Add(index.ToString(), index , typeof(int)));

            List<string> keys = c.GetAllKeys();

            Assert.AreEqual(1000, keys.Count);

            foreach (string key in keys)
            {
                var value = c.Get<int>(key);
                Assert.AreEqual(key, value.ToString());

                c.Remove(key);
            }

            System.Threading.Thread.Sleep(5000);

            keys = c.GetAllKeys();

            Assert.AreEqual(0, keys.Count);
        }
开发者ID:emiliotorrens,项目名称:MongoKeyValueClient.NET,代码行数:24,代码来源:Test.cs


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