Exemple #1
0
def repeat_main():
    repeat_num = 1

    # パラメータモジュール

#    for lm in ["LDA"]:
    for lm in ["SVM", "LDA", "ANN"]:
        for ts in ["HBX", "HBX3", "HBX1"]:
            for re in ["none"]:
#            for re in ["none", "bootstrap", "smote"]:
                for fe in ["SSSM", "SMSK", "SLICE"]:
                    
                    if re in ["bootstrap", "smote"]:
                        for rs in [20, 30, 40]:
                            for nf in [10, None]:
                                param = myParameter.myParameter()
                                # 乱数モジュール
                                param.RAND = random.Random()
                                param.LEARNING_METHOD = lm
                                param.TARGET_SIGNAL = ts
                                param.RESAMPLING_METHOD = re      
                                param.RESAMPLING_SIZE = rs
                                param.FEATURE_TYPE = fe
                                param.N_FOLD = nf
                                
                                fp = open("memo.txt", 'a')
                                fp.write(",".join([str(mm) for mm in [lm, ts, re, rs, fe, nf]]))
                                fp.write("\n")
                                fp.close()
                                
                                # 実行
                                _addfilename = lm+ts+re+str(rs)+fe+str(nf)
                                main(param, addfilename = _addfilename)
    
                    elif re == "none":  
                        rs = 0          
                        for nf in [10, None]:
                            param = myParameter.myParameter()
                            # 乱数モジュール
                            param.RAND = random.Random()
                            param.LEARNING_METHOD = lm
                            param.TARGET_SIGNAL = ts
                            param.RESAMPLING_METHOD = re      
                            param.RESAMPLING_SIZE = rs
                            param.FEATURE_TYPE = fe
                            param.N_FOLD = nf
                            
                            _addfilename = lm+ts+re+str(rs)+fe+str(nf)

                            fp = open("memo.txt", 'a')
                            fp.write(",".join([str(mm) for mm in [lm, ts, re, rs, fe, nf]]))
                            fp.write("\n")
                            fp.close()
                            
                            # 実行
                            main(param, addfilename = _addfilename)
Exemple #2
0
def repeat_main():
    repeat_num = 1

    # パラメータモジュール

    #    for lm in ["LDA"]:
    for lm in ["SVM", "LDA", "ANN"]:
        for ts in ["HBX", "HBX3", "HBX1"]:
            for re in ["none"]:
                #            for re in ["none", "bootstrap", "smote"]:
                for fe in ["SSSM", "SMSK", "SLICE"]:

                    if re in ["bootstrap", "smote"]:
                        for rs in [20, 30, 40]:
                            for nf in [10, None]:
                                param = myParameter.myParameter()
                                # 乱数モジュール
                                param.RAND = random.Random()
                                param.LEARNING_METHOD = lm
                                param.TARGET_SIGNAL = ts
                                param.RESAMPLING_METHOD = re
                                param.RESAMPLING_SIZE = rs
                                param.FEATURE_TYPE = fe
                                param.N_FOLD = nf

                                fp = open("memo.txt", 'a')
                                fp.write(",".join([
                                    str(mm) for mm in [lm, ts, re, rs, fe, nf]
                                ]))
                                fp.write("\n")
                                fp.close()

                                # 実行
                                _addfilename = lm + ts + re + str(
                                    rs) + fe + str(nf)
                                main(param, addfilename=_addfilename)

                    elif re == "none":
                        rs = 0
                        for nf in [10, None]:
                            param = myParameter.myParameter()
                            # 乱数モジュール
                            param.RAND = random.Random()
                            param.LEARNING_METHOD = lm
                            param.TARGET_SIGNAL = ts
                            param.RESAMPLING_METHOD = re
                            param.RESAMPLING_SIZE = rs
                            param.FEATURE_TYPE = fe
                            param.N_FOLD = nf

                            _addfilename = lm + ts + re + str(rs) + fe + str(
                                nf)

                            fp = open("memo.txt", 'a')
                            fp.write(",".join(
                                [str(mm) for mm in [lm, ts, re, rs, fe, nf]]))
                            fp.write("\n")
                            fp.close()

                            # 実行
                            main(param, addfilename=_addfilename)
Exemple #3
0
    """
    トライアルの開始時間を0.1[s]単位で抽出
    @param target_file: 対象となるPresentationログファイル 
    @param param: パラメータモジュール 
    @return: シナリオ開始から各タスクの開始時間のリスト 0.1[s]単位
    動作確認済
    """
    if param.FS != 10.0:
        raise NameError("This script can processing 10.0 Hz data.")
    # データの読み出しとヘッダ行を飛ばす
    cr = csv.reader(open(target_file, 'Ur'), delimiter="\t")
    for i in range(5):
        cr.next()
    # データ取り出し
    trial_start = []
    for r in cr:
        if len(r) > 0:
            _time = int(r[3])
            trial_start.append(int(round(_time / 1000.0, 0)))
        else:
            break

    return trial_start


if __name__ == "__main__":
    import myParameter
    param = myParameter.myParameter()
    target_file = "/Users/misato/Documents/eclipse/workspace/TwoChannelNIRS/dataset/presentation_log/ysakaguchi/session1.log"
    print import_log(target_file, param)
    @param param: パラメータモジュール 
    @return: シナリオ開始から各タスクの開始時間のリスト 0.1[s]単位
    動作確認済
    """
    if param.FS != 10.0:
        raise NameError("This script can processing 10.0 Hz data.")
    # データの読み出しとヘッダ行を飛ばす
    cr = csv.reader(open(target_file, "Ur"), delimiter="\t")
    for i in range(5):
        cr.next()
    # データ取り出し
    trial_start = []
    for r in cr:
        if len(r) > 0:
            _time = int(r[3])
            trial_start.append(int(round(_time / 1000.0, 0)))
        else:
            break

    return trial_start


if __name__ == "__main__":
    import myParameter

    param = myParameter.myParameter()
    target_file = (
        "/Users/misato/Documents/eclipse/workspace/TwoChannelNIRS/dataset/presentation_log/ysakaguchi/session1.log"
    )
    print import_log(target_file, param)