示例#1
0
        ///// <summary>
        ///// FVを0~999(*bairitu)に矯正。
        ///// </summary>
        //public static void Do_FvRange999(ref bool isRequest_ShowGohosyu, Uc_Main uc_Main, IErrorController logTag)
        //{
        //    Util_LearnFunctions.FvParamRange_PP(uc_Main.LearningData.Fv);

        //    // 局面の合法手表示の更新を要求します。
        //    isRequest_ShowGohosyu = true;
        //}


        public static void Do_OpenFvCsv(Uc_Main uc_Main)
        {
            if ("" != uc_Main.TxtFvFilepath.Text)
            {
                uc_Main.OpenFvFileDialog2.InitialDirectory = Path.GetDirectoryName(uc_Main.TxtFvFilepath.Text);
                uc_Main.OpenFvFileDialog2.FileName         = Path.GetFileName(uc_Main.TxtFvFilepath.Text);
            }
            else
            {
                uc_Main.OpenFvFileDialog2.InitialDirectory = Application.StartupPath;
            }

            DialogResult result = uc_Main.OpenFvFileDialog2.ShowDialog();

            switch (result)
            {
            case DialogResult.OK:
                uc_Main.TxtFvFilepath.Text = uc_Main.OpenFvFileDialog2.FileName;

                StringBuilder sb_result = new StringBuilder();
                // フィーチャー・ベクターの外部ファイルを開きます。
                sb_result.Append(Util_FvLoad.OpenFv(uc_Main.EngineConf, uc_Main.LearningData.Fv, uc_Main.TxtFvFilepath.Text));
                uc_Main.TxtStatus1.Text = sb_result.ToString();

                // うまくいっていれば、フィーチャー・ベクターのセットアップが終わっているはず。
                {
                    // 調整量
                    uc_Main.TyoseiryoSettings.SetSmallest(uc_Main.LearningData.Fv.TyoseiryoSmallest_NikomaKankeiPp);
                    uc_Main.TyoseiryoSettings.SetLargest(uc_Main.LearningData.Fv.TyoseiryoLargest_NikomaKankeiPp);
                    //
                    // 調整量(初期値)
                    //
                    uc_Main.TxtTyoseiryo.Text = uc_Main.LearningData.Fv.TyoseiryoInit_NikomaKankeiPp.ToString();


                    // 半径
                    float paramRange = Util_Inspection.FvParamRange(uc_Main.LearningData.Fv);
                    uc_Main.ChkAutoParamRange.Text = $"評価更新毎-{paramRange}~{paramRange}矯正";
                }

                uc_Main.BtnUpdateKyokumenHyoka.Enabled = true;

                break;

            default:
                break;
            }

            //gt_EndMethod:
            //    ;
        }
示例#2
0
        /// <summary>
        /// FVを、-999.0~999.0(*bairitu)に矯正。
        /// </summary>
        public static void FvParamRange_PP(FeatureVector fv)
        {
            //--------------------------------------------------------------------------------
            // 変換前のデータを確認。
            //--------------------------------------------------------------------------------
            Util_Inspection.Inspection1(fv);

            //--------------------------------------------------------------------------------
            // 点数を、順位に変換します。
            //--------------------------------------------------------------------------------
            Util_Ranking.Perform_Ranking(fv);

            //--------------------------------------------------------------------------------
            // トポロジー的に加工したあとのデータを確認。
            //--------------------------------------------------------------------------------
            Util_Zooming.ZoomTo_FvParamRange(fv);
        }
示例#3
0
        /// <summary>
        /// フィーチャー・ベクターの概要をデバッグ出力します。
        ///
        /// 順位を点数に変換します。
        /// </summary>
        public static void ZoomTo_FvParamRange(FeatureVector fv)
        {
            float negative_length;  // 負の数の一番小さな値の絶対値。
            float positive_length;  // 正の数の一番大きな値の絶対値。
            bool  longest_positive; // 正の方の絶対値の方が大きければ真。
            int   negative_items;   //負の項目数。平均値を求めるのに使う。
            int   positive_items;   //正の項目数
            float negative_total;   //負の合計。平均値を求めるのに使う。
            float positive_total;   //正の合計。
            float zoom;
            int   notZero;

            {
                negative_length = 0.0f;
                positive_length = 0.0f;
                negative_items  = 0;
                positive_items  = 0;
                negative_total  = 0.0f;
                positive_total  = 0.0f;
                notZero         = 0;
                for (int p1 = 0; p1 < FeatureVectorImpl.CHOSA_KOMOKU_P; p1++)
                {
                    for (int p2 = 0; p2 < FeatureVectorImpl.CHOSA_KOMOKU_P; p2++)
                    {
                        float cellValue = fv.NikomaKankeiPp_ForMemory[p1, p2];
                        if (cellValue < -negative_length)
                        {
                            negative_length = -cellValue;
                        }
                        else if (positive_length < cellValue)
                        {
                            positive_length = cellValue;
                        }

                        if (cellValue != 0.0f)
                        {
                            notZero++;
                        }

                        if (cellValue < 0.0f)
                        {
                            negative_items++;
                            negative_total += cellValue;
                        }
                        else if (0.0f < cellValue)
                        {
                            positive_items++;
                            positive_total += cellValue;
                        }
                    }
                }

                // 長いのは正負のどちらか。
                if (negative_length < positive_length)
                {
                    longest_positive = true;
                }
                else
                {
                    longest_positive = false;
                }
                Logger.Trace("topology");
                Logger.Trace($"   negative_length ={negative_length}");
                Logger.Trace($"   positive_length ={positive_length}");
                Logger.Trace($"   longest_positive={longest_positive}");
                Logger.Trace($"   negative_average={(negative_items == 0 ? 0 : negative_total / negative_items)}");
                Logger.Trace($"   positive_average={(positive_items == 0 ? 0 : positive_total / positive_items)}");
                Logger.Trace($"   notZero         ={notZero}");
                Logger.Trace("----------------------------------------");
            }


            //----------------------------------------
            // 正負の長い方 を abs 999.0(*bairitu) に合わせたい。
            //----------------------------------------
            if (longest_positive)
            {
                zoom = Util_Inspection.FvParamRange(fv) / positive_length;
            }
            else
            {
                zoom = Util_Inspection.FvParamRange(fv) / negative_length;
            }

            negative_length = 0.0f;
            positive_length = 0.0f;
            negative_items  = 0;
            positive_items  = 0;
            negative_total  = 0.0f;
            positive_total  = 0.0f;
            notZero         = 0;
            for (int p1 = 0; p1 < FeatureVectorImpl.CHOSA_KOMOKU_P; p1++)
            {
                for (int p2 = 0; p2 < FeatureVectorImpl.CHOSA_KOMOKU_P; p2++)
                {
                    float value = fv.NikomaKankeiPp_ForMemory[p1, p2] * zoom;
                    fv.NikomaKankeiPp_ForMemory[p1, p2] = value;
                    if (value < -negative_length)
                    {
                        negative_length = -value;
                    }
                    else if (positive_length < value)
                    {
                        positive_length = value;
                    }

                    if (value != 0.0d)
                    {
                        notZero++;
                    }

                    if (value < 0.0d)
                    {
                        negative_items++;
                        negative_total += value;
                    }
                    else if (0.0d < value)
                    {
                        positive_items++;
                        positive_total += value;
                    }
                }
            }

            // 長いのは正負のどちらか。
            if (negative_length < positive_length)
            {
                longest_positive = true;
            }
            else
            {
                longest_positive = false;
            }
            Logger.Trace("end");
            Logger.Trace($"   negative_length ={negative_length}");
            Logger.Trace($"   positive_length ={positive_length}");
            Logger.Trace($"   longest_positive={longest_positive}");
            Logger.Trace($"   zoom            ={zoom}");
            Logger.Trace($"   negative_average={(negative_items == 0 ? 0 : negative_total / negative_items)}");
            Logger.Trace($"   positive_average={(positive_items == 0 ? 0 : positive_total / positive_items)}");
            Logger.Trace($"   notZero         ={notZero}");
            Logger.Trace("----------------------------------------");
        }