Beispiel #1
0
    def exe(self, script_w):
        params = {}
        params["iFile"] = self.fName_w.value
        params["oPath"] = self.oPath_w.value + "/" + self.oDir_w.value

        if not wlib.iFileCheck(params["iFile"], self.parent.msg_w):
            return False
        if not wlib.blankCheck(self.oDir_w.value, "出力dir名", self.parent.msg_w):
            return False
        if not wlib.oPathCheck(params["oPath"], self.parent.msg_w):
            return False

        deepOutput = self.parent.deepOutput_w.value

        params["id_"] = self.id_w.getValue()
        params["y"] = self.y_w.getValue()
        params["nums"] = list(self.num_w.getValue())
        params["cats"] = list(self.cat_w.getValue())
        params["minSamplesLeaf"] = self.minSamplesLeaf_w.value

        if params["y"] in params["nums"] or params["y"] in params["cats"]:
            self.parent.msg_w.value = "##ERROR: 説明変数に目的変数が含まれています:%s" % params[
                "y"]
            return False

        script1 = wlib.readSource("nysol.mining.ctree", "ctree", deepOutput)
        script2 = wlib.readSource("nysol.mining.csv2df")
        script3 = """
print("#### START")
# 出力ディレクトリを作成する
os.makedirs("{oPath}",exist_ok=True)

# pandasデータを作成する
df,ds=csv2df("{iFile}", "{id_}", {nums}, ["{y}"], {cats})

xNames=ds.columns.to_list()
xNames.remove("{y}")
y=pd.DataFrame(ds.loc[:,"{y}"])
x=ds.loc[:,xNames]

config=dict()
config["max_depth"]=10
config["min_samples_leaf"]={minSamplesLeaf}
model=ctree(x,y,config)

model.build()
print("cv_minFunc",model.cv_minFun)
print("cv_minX",model.cv_minX)
print("score",model.score)
model.visualize()
model.save("{oPath}/model")

pred=model.predict(x)
pred.evaluate(y)
pred.save("{oPath}/pred")
print("#### END")
""".format(**params)

        script_w.value = script1 + script2 + script3
        return True
Beispiel #2
0
    def exe(self, script_w):
        params = {}
        params["iFile"] = self.iName_w.value
        params["oPath"] = self.oPath_w.value + "/" + self.oDir_w.value

        if not wlib.iFileCheck(params["iFile"], self.parent.msg_w):
            return False
        if not wlib.blankCheck(self.oDir_w.value, "出力dir名", self.parent.msg_w):
            return False
        if not wlib.oPathCheck(params["oPath"], self.parent.msg_w):
            return False
        params["minFreq"] = self.minFreq_w.value

        script1 = wlib.readSource("nysol.widget.songs.lib.features")
        script2 = """
import os
print("#### START")

oPath="{oPath}"
os.makedirs(oPath,exist_ok=True)
features("{iFile}",oPath,{minFreq})

print("#### END")
""".format(**params)

        # script tabにセット
        script_w.value = script1 + script2
        return True
Beispiel #3
0
    def exe(self, script_w):
        params = {}
        params["iFile"] = self.iName_w.value
        params["oPath"] = self.oPath_w.value
        params["oFile"] = self.oFile_w.value

        if not wlib.iFileCheck(params["iFile"], self.parent.msg_w):
            return False
        if not wlib.blankCheck(params["oFile"], "出力ファイル名", self.parent.msg_w):
            return False
        if not wlib.oPathCheck(params["oPath"], self.parent.msg_w):
            return False

        script1 = wlib.readSource("nysol.widget.songs.lib.parsing", "parsing")
        script2 = """
import os
print("#### START")

oPath="{oPath}"
os.makedirs(oPath,exist_ok=True)
parsing_count("{iFile}","%s/{oFile}"%(oPath)) 

print("#### END")
""".format(**params)

        # script tabにセット
        script_w.value = script1 + script2
        return True
Beispiel #4
0
    def exe(self, script_w):
        params = {}
        params["iFile"] = self.iName_w.value
        params["oPath"] = self.oPath_w.value
        params["oFile"] = self.oFile_w.value

        if not wlib.iFileCheck(params["iFile"], self.parent.msg_w):
            return False
        if not wlib.blankCheck(params["oFile"], "出力ファイル名", self.parent.msg_w):
            return False
        if not wlib.oPathCheck(params["oPath"], self.parent.msg_w):
            return False

        params["tid"] = self.tid_w.getValue()
        params["item"] = self.item_w.getValue()
        params["agg"] = self.agg_w.getValue()
        params["klass"] = self.klass_w.getValue()
        params["null"] = self.null_w.value
        params["dummy"] = self.dummy_w.value
        params["stat"] = self.stat_w.value

        script1 = wlib.readSource("nysol.mining.tra2tbl")
        script2 = """
print("#### START")

iFile="{iFile}"
oFile="{oPath}/{oFile}"
tidFld="{tid}"
itemFld="{item}"
null={null}
dummy={dummy}
aggFld="{agg}"
aggStat="{stat}"
klassFld="{klass}"

tra2tbl(iFile,oFile,tidFld,itemFld,null=null,dummy=dummy,aggFld=aggFld,aggStat=aggStat,klassFld=klassFld)
print("#### END")
""".format(**params)

        script_w.value = script1 + script2
        return True