public static DataPartition ToData(CdmDataPartitionDefinition instance, ResolveOptions resOpt, CopyOptions options) { var argumentsCopy = new List <Argument>(); foreach (var argumentList in instance.Arguments) { foreach (var argumentValue in argumentList.Value) { argumentsCopy.Add(new Argument() { Name = argumentList.Key, Value = argumentValue } ); } } var result = new DataPartition { Name = instance.Name, Location = instance.Location, LastFileStatusCheckTime = TimeUtils.GetFormattedDateString(instance.LastFileStatusCheckTime), LastFileModifiedTime = TimeUtils.GetFormattedDateString(instance.LastFileModifiedTime), ExhibitsTraits = CopyDataUtils.ListCopyData(resOpt, instance.ExhibitsTraits?.Where(trait => !trait.IsFromProperty)?.ToList(), options), Arguments = argumentsCopy, SpecializedSchema = instance.SpecializedSchema }; return(result); }
//tells the cells their data (by default, reset previous data) public void SetData(List <Vector2> newdata, bool reset = true) { try { DataPartition dp = new DataPartition(newdata); } catch { Debug.Log("SOMETHING WENT WRONG, PROBS OUT OF BOUNDS"); } }
public override void Parse() { base.Parse(); int playerPos, teamPos; int playerLenth, teamLength; DataPartition = UniSpyEncoding.GetString(RawRequest.Skip(5).ToArray()); playerPos = DataPartition.IndexOf("player_\0", StringComparison.Ordinal); teamPos = DataPartition.IndexOf("team_t\0", StringComparison.Ordinal); if (playerPos != -1 && teamPos != -1) { ReportType = HeartBeatReportType.ServerTeamPlayerData; playerLenth = teamPos - playerPos; teamLength = DataPartition.Length - teamPos; var serverDataStr = DataPartition.Substring(0, playerPos - 4); ParseServerData(serverDataStr); var playerDataStr = DataPartition.Substring(playerPos - 1, playerLenth - 2); ParsePlayerData(playerDataStr); var teamDataStr = DataPartition.Substring(teamPos - 1, teamLength); ParseTeamData(teamDataStr); } else if (playerPos != -1) { //normal heart beat ReportType = HeartBeatReportType.ServerPlayerData; playerLenth = DataPartition.Length - playerPos; var serverDataStr = DataPartition.Substring(0, playerPos - 4); ParseServerData(serverDataStr); var playerDataStr = DataPartition.Substring(playerPos - 1, playerLenth); ParsePlayerData(playerDataStr); } else if (playerPos == -1 && teamPos == -1) { ReportType = HeartBeatReportType.ServerData; var serverDataStr = DataPartition; ParseServerData(serverDataStr); } else { throw new QRException("HeartBeat request is invalid."); } }
// main program, which calls whatever is needed for the analysis static void Main(string[] args) { DateTime GlobalClock = DateTime.Now; Console.WriteLine("I N I Z I O _ P R O G R A M M A.\n\n\n"); // a dictionary is used to match input files names and integers that are required to the user Dictionary<int, string> dict = new Dictionary<int, string> { { 0, "WineDS" }, { 1, "BioMechDS" }, { 2, "IrisDS" } }; // being InOutStream static, it need no instantiation InOutStreams.GoToFolder(); Console.WriteLine(InOutStreams.GetPathOut()); Console.WriteLine("Scelta del DataSet:\nWine DataSet: premere 0\nBioMechanical DataSet: premere 1\nIris DataSet: premere 2"); int FlagDataSet = Convert.ToInt32(Console.ReadLine()); InOutStreams.DirectoryManager(FlagDataSet, dict); // is worth note that even if DataObject is the heart of the data modelling, prior instantiation // of the class containing the methds for import is necessary, then the DataObject is instantiated // and filled in with the data read by the DataSetImport methods DataSetImport DSImp = new DataSetImport(); DataObject DataSet = DSImp.FeaturesImport(); Console.WriteLine("\n\nPreprocessare i dati? (PCA):\nNo: premere 0\nSi: premere 1"); int FlagProcessing = Convert.ToInt32(Console.ReadLine()); if (FlagProcessing == 1) { DataProcessing process = new DataProcessing(); DataSet = process.DoThePCA(DataSet); DataProcessing.SetFlagProcessing(FlagProcessing); } // NOTE: in DataWorkTable.DataProcessing two static field are located. Here, according to the // user choice to preprocess or not, the if () statement above is considered (or not), BUT to // the information about data preprocessing choice must be in any case remembered, thus, in the // if() body the DataProcessing class is instantiated, and eventually the static field about choice // and number of PCs stored, but if the if() is not executed, such choices are not even present, // and they are needed in the following. So the static field initialised to 0 is anyway present // and solves this problem Console.WriteLine("\n\nPartizione del DataSet?"); Console.WriteLine("TrainingSet = 90% del DataSet e TestSet = 10% del DataSet: premere 0"); Console.WriteLine("TrainingSet = 66% del DataSet e TestSet = 33% del DataSet: premere 1"); int FlagPartition = Convert.ToInt32(Console.ReadLine()); InOutStreams.DirectoryCreation(FlagPartition, DataProcessing.GetFlagProcessing(), DataProcessing.GetPrincipalComponentsNumber()); Console.WriteLine("\n\nDrop folder: \n" + InOutStreams.GetPathOut()); Console.WriteLine("\n\nSingle run o ciclo? (inserire 1 per single run, altrimenti numero di iterazioni)"); int iter = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < iter; i++) { if (iter > 1) { Console.WriteLine("Iterazione {0} / {1}", i + 1, iter); } DataPartition Partition = new DataPartition(DataSet, FlagPartition); DataObject[] SetsData = Partition.TestSetExtraction(DataSet); Partition.PrintPartition(SetsData); Console.WriteLine("\n\n"); LearningAlgorithmsClass la = new LearningAlgorithmsClass(SetsData, FlagPartition, DataProcessing.GetFlagProcessing(), DataProcessing.GetPrincipalComponentsNumber()); // given all the previous choices, the whole learning machinery is deployed la.SVMGaussianKernel(); Console.WriteLine("\n\n"); la.SVMPolinomialKernel(); Console.WriteLine("\n\n"); la.TreeLearning(); Console.WriteLine("\n\n"); } Console.WriteLine("\n\n"); Console.WriteLine("\n\n\nTempo di esecuzione: " + (DateTime.Now - GlobalClock).TotalSeconds + " secondi."); Console.WriteLine("\nF I N E _ P R O G R A M M A."); Console.WriteLine("Premi qualsiasi tasto per uscire."); Console.ReadKey(); }