Esempio n. 1
0
 public TaskInfo(Matrix <T> m1, Matrix <T> m2, Trials trials, Matrix <T> result)
 {
     M1     = m1;
     M2     = m2;
     Result = result;
     Trials = trials;
 }
Esempio n. 2
0
 public override void Save(Session session)
 {
     base.Save(session);
     ((SpellerParadigm)session.Paradigm).Config.Test.StimulationPatterns?
     .JsonSerializeToFile(session.GetDataFileName(FrequenciesFile), JsonUtils.PrettyFormat, Encoding.UTF8);
     Trials?.JsonSerializeToFile(session.GetDataFileName(TrialsFile), JsonUtils.PrettyFormat, Encoding.UTF8);
 }
Esempio n. 3
0
 /// <summary>
 /// Get currently active trial. When not in a trial, gets previous trial.
 /// </summary>
 /// <returns>Currently active trial.</returns>
 public Trial GetTrial()
 {
     if (currentTrialNum == 0)
     {
         throw new NoSuchTrialException("There is no trial zero. If you are the start of the experiment please use nextTrial to get the first trial");
     }
     return(Trials.ToList()[currentTrialNum - 1]);
 }
 /// <summary>
 /// Get currently active trial. When not in a trial, gets previous trial.
 /// </summary>
 /// <returns>Currently active trial.</returns>
 public Trial GetTrial()
 {
     if (currentTrialNum == 0)
     {
         throw new NoSuchTrialException("There is no trial zero. Did you try to perform operations on the current trial before the first one started? If you are the start of the experiment please use NextTrial to get the first trial. ");
     }
     return(Trials.ToList()[currentTrialNum - 1]);
 }
Esempio n. 5
0
        /// <summary>
        /// Gets information about learning neural network process
        /// </summary>
        /// <returns>List of string array</returns>
        public List <String[]> GetInformation()
        {
            List <String[]> list = new List <String[]>();

            list.Add(new String[] { "Liczba wejść", Info.ni.ToString() });
            list.Add(new String[] { "Liczba wyjść", Info.no.ToString() });
            list.Add(new String[] { "Liczba neuronów", Info.nn.ToString() });
            list.Add(new String[] { "Liczba wzorców", Info.np.ToString() });
            list.Add(new String[] { "Liczba wag", Info.nw.ToString() });
            list.Add(new String[] { "MU - wielkość o jaką mogą się zmieniać wagi", Settings.MU.ToString() });
            list.Add(new String[] { "Dolna granica MU", Settings.MUL.ToString() });
            list.Add(new String[] { "Górna granica MU", Settings.MUH.ToString() });
            list.Add(new String[] { "Skala", Settings.Scale.ToString() });
            list.Add(new String[] { "Maksymalna liczba iteracji", Settings.MaxIterations.ToString() });
            list.Add(new String[] { "Maksymalny błąd uczenia", Settings.MaxError.ToString() });
            String tmp = "";

            foreach (var t in Topo)
            {
                tmp += t.ToString() + ", ";
            }
            tmp = tmp.TrimEnd(new char[] { ' ', ',' });
            list.Add(new String[] { "Topografia sieci", tmp });

            tmp = "";
            foreach (var t in TopoIndex)
            {
                tmp += t.ToString() + ", ";
            }
            tmp = tmp.TrimEnd(new char[] { ' ', ',' });
            list.Add(new String[] { "Indeksy topografii sieci", tmp });

            tmp = "";
            FunctionChoice fc = (FunctionChoice)ActivationFunction[0];

            switch (fc)
            {
            case FunctionChoice.BipolarElliotNeuron: tmp = "dwubiegunowa Elliota"; break;

            case FunctionChoice.BipolarNeuron: tmp = "dwubiegunowa"; break;

            case FunctionChoice.LinearNeuron: tmp = "liniowa"; break;

            case FunctionChoice.UnipolarElliotNeuron: tmp = "jednobiegunowa Elliota"; break;

            case FunctionChoice.UnipolarNeuron: tmp = "jednobiegunowa"; break;

            default: tmp = ""; break;
            }
            list.Add(new String[] { "Funkcja aktywacji", tmp });
            list.Add(new String[] { "Liczba prób uczenia/testowania", Trials.ToString() });
            list.Add(new String[] { "Średnia błędów uczenia (RMSE)", FinalRMSE.ToString() });
            list.Add(new String[] { "Średnia błędów testowania (RMSE)", TestRMSE.ToString() });
            list.Add(new String[] { "Średni czas uczenia", AverageLearnTime });
            list.Add(new String[] { "Średni czas testowania", AverageTestTime });
            return(list);
        }
 /// <summary>
 /// Get previous Trial.
 /// </summary>
 /// <returns></returns>
 Trial GetPrevTrial()
 {
     try
     {
         // non zero indexed
         return(Trials.ToList()[currentTrialNum - 2]);
     }
     catch (ArgumentOutOfRangeException)
     {
         throw new NoSuchTrialException("There is no previous trial. Probably, currently at the start of session.");
     }
 }
 /// <summary>
 /// Get next Trial
 /// </summary>
 /// <returns></returns>
 Trial GetNextTrial()
 {
     // non zero indexed
     try
     {
         return(Trials.ToList()[currentTrialNum]);
     }
     catch (ArgumentOutOfRangeException)
     {
         throw new NoSuchTrialException("There is no next trial. Reached the end of trial list. If you are at the start of the session, perhaps you tried to start the next trial before generating your trials? If you are at the end, you can use BeginNextTrialSafe to do nothing if there is no next trial.");
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Get next Trial
 /// </summary>
 /// <returns></returns>
 Trial GetNextTrial()
 {
     // non zero indexed
     try
     {
         return(Trials.ToList()[currentTrialNum]);
     }
     catch (ArgumentOutOfRangeException)
     {
         throw new NoSuchTrialException("There is no next trial. Reached the end of trial list.");
     }
 }
Esempio n. 9
0
 private void UpdateTrial(int n)
 {
     if (n <0 | n> MainForm.allTrials.Count - 1)
     {
         return;
     }
     trialListIdx          = n;
     trial                 = MainForm.allTrials.ElementAt(trialListIdx);
     n_label.Text          = (trialListIdx + 1).ToString() + "/" + MainForm.allTrials.Count.ToString();
     congruence_label.Text = "Congruence: " + trial.congruence.ToString();
     answer_label.Text     = "Response  : " + trial.response.ToString();
     this.Refresh();
 }
Esempio n. 10
0
 protected void UpdateStatusValues()
 {
     if (StatusValues != null)
     {
         StatusValues[0] = Trials.ToString();
         StatusValues[1] = BoundMass_MeV.ToString("G12");
         StatusValues[2] = Param.SoftScale_MeV.ToString("G12");
         StatusValues[3] = Param.Energy_MeV.ToString("G12");
         StatusValues[4] = Param.GammaDamp_MeV.ToString("G12");
         StatusValues[5] = ComplexMath.Abs(WaveFunction_fm[0])
                           .ToString("G4");
         StatusValues[6] = NumberExtrema.ToString();
     }
 }
Esempio n. 11
0
        void SaveResults()
        {
            List <ResultsDictionary> results = Trials.Select(t => t.result).ToList();
            string        fileName           = "trial_results.csv";
            WriteFileInfo fileInfo           = new WriteFileInfo(
                WriteFileType.Trials,
                BasePath,
                experimentName,
                ppid,
                FolderName,
                fileName
                );

            fileIOManager.ManageInWorker(() => fileIOManager.WriteTrials(results, fileInfo));
        }
Esempio n. 12
0
    void Update()
    {
        rewardText.text = "Reward: " + Reward.Get();

        if (task.Success())
        {
            task.Reset();

            if (task.Done(Trials.GetSuccess(), Trials.GetFailure()))
            {
                task.Finish();

                PlayerPrefs.SetInt("Success Count", 0);
                PlayerPrefs.SetInt("Failure Count", 0);
                EditorSceneManager.LoadScene(Scenes.Next());
                return;
            }

            Trials.AddSuccess();

            PlayerPrefs.SetInt("Success Count", Trials.GetSuccess());
            PlayerPrefs.SetInt("Failure Count", Trials.GetFailure());
            EditorSceneManager.LoadScene(EditorSceneManager.GetActiveScene().name);
            return;
        }

        if (task.Failure())
        {
            if (Automator.Enabled())
            {
                Debug.LogError("You have enabled autorun but task has failed: check your automation sequence for task '" + PlayerPrefs.GetString("Task Name") + "'");
            }

            task.Reset();

            Trials.AddFailure();

            PlayerPrefs.SetInt("Success Count", Trials.GetSuccess());
            PlayerPrefs.SetInt("Failure Count", Trials.GetFailure());
            EditorSceneManager.LoadScene(EditorSceneManager.GetActiveScene().name);
            return;
        }

        elapsed += 1;

        PlayerPrefs.SetInt("Elapsed Time", elapsed);
    }
Esempio n. 13
0
 // Running trials thread, stops with ESC key
 private void TrialsRunningThread()
 {
     while (Thread.CurrentThread.IsAlive)
     {
         currentTrial = new Trials();
         GeneratePolygon();
         trialState = 1;
         Thread.Sleep(1000);
         Invoke(new Action(() =>
         {
             this.Refresh();
         }));
         stopwatch.Restart();
         while (trialState == 1)
         {
             _recognizer.Recognize();
         }
     }
 }
        void SaveResults()
        {
            // generate list of all headers possible
            // hashset keeps unique set of keys
            HashSet <string> resultsHeaders = new HashSet <string>();

            foreach (Trial t in Trials)
            {
                if (t.result != null)
                {
                    foreach (string key in t.result.Keys)
                    {
                        resultsHeaders.Add(key);
                    }
                }
            }

            UXFDataTable table = new UXFDataTable(Trials.Count(), resultsHeaders.ToArray());

            foreach (Trial t in Trials)
            {
                if (t.result != null)
                {
                    UXFDataRow row = new UXFDataRow();
                    foreach (string h in resultsHeaders)
                    {
                        if (t.result.ContainsKey(h) && t.result[h] != null)
                        {
                            row.Add((h, t.result[h]));
                        }
                        else
                        {
                            row.Add((h, string.Empty));
                        }
                    }
                    table.AddCompleteRow(row);
                }
            }

            SaveDataTable(table, "trial_results", dataType: UXFDataType.TrialResults);
        }
Esempio n. 15
0
    void Start()
    {
        task = GetComponent <Task>();

        if (Automator.Enabled())
        {
            Automator.Setup(task.AutomationSequence());
        }

        Reward.Set(0.0F);

        if (!PlayerPrefs.HasKey("Task Name"))
        {
            PlayerPrefs.SetString("Task Name", task.Name());
            Trials.Reset();
        }

        if (PlayerPrefs.GetString("Task Name") != task.Name())
        {
            PlayerPrefs.SetString("Task Name", task.Name());
            Trials.Reset();
        }

        PlayerPrefs.SetInt("Elapsed Time", elapsed);

        int successCount = Trials.GetSuccess();
        int failureCount = Trials.GetFailure();

        task.Initialize(successCount, failureCount);

        if (Automator.Enabled())
        {
            Automator.Setup(task.AutomationSequence());
        }

        taskText.text    = PlayerPrefs.GetString("Task Name");
        successText.text = "Success: " + successCount;
        failureText.text = "Failure: " + failureCount;
        rewardText.text  = "Reward: 0";
    }
Esempio n. 16
0
        private static IEnumerable <Trials> getTrials(int rows, int trialSize)
        {
            var trials        = new List <Trials>();
            var rowsPerThread = rows / trialSize;
            int start         = 0;

            for (var i = 0; i < trialSize; i++)
            {
                trials.Add(new Trials(start, start + rowsPerThread));
                start += rowsPerThread;
            }

            if (rows % trialSize == 0)
            {
                return(trials);
            }

            var lastTrial = trials[(int)trialSize - 1];

            trials[(int)trialSize - 1] = new Trials(lastTrial.RowStart, rows);

            return(trials);
        }
 /// <summary>
 /// Get trial by trial number (non zero indexed)
 /// </summary>
 /// <returns></returns>
 public Trial GetTrial(int trialNumber)
 {
     return(Trials.ToList()[trialNumber - 1]);
 }
Esempio n. 18
0
    // public methods

    public bool Load(string aFileNamePrefix = "")
    {
        _trials = new Trials <PlayingLadyTrial>(aFileNamePrefix + TRIALS_FILENAME, BLOCK_SIZE, VARIABLE_COUNT);
        return(_trials.IsValid);
    }
Esempio n. 19
0
 public void OpenTrial(string name)
 {
     Trials.Add(InstantiateTrial(name));
 }
Esempio n. 20
0
 public virtual void AddTrial(Trial trial)
 {
     trial.Session = this;
     Trials.Add(trial);
 }