コード例 #1
0
ファイル: interesting.py プロジェクト: jessab/ML
def peakInfluenceSurface(peaksType):
    from tools.Tools import getDictArray
    import featuresMain as fm

    data = fm.main()
    surface = data.Surface.values

    def surfaceToInt(surface):
        if 'Woodchip' in surface:
            return 0
        if 'Asphalt' in surface:
            return 1
        if 'Track' in surface:
            return 2

    surface = map(surfaceToInt, surface)
    features = getDictArray(data.Features)

    def plot(name):
        y = [v[peaksType + '.' + name] for v in features]
        fig, ax = plt.subplots()
        ax.scatter(surface, y)
        fig.tight_layout()
        ax.set_title("surface: " + name)

    plot('varDist')
    plot('varPeak')
    plot('maxPeak')
    plot('maxDist')
    plot('minPeak')
    plot('minDist')
    plot('avPeak')
    plot('avDist')
コード例 #2
0
ファイル: interesting.py プロジェクト: jessab/ML
def peakInfluenceTrained(peaksType):
    from tools.Tools import getDictArray
    import app.featuresMain as fm

    data = fm.main()
    trained = data.Trained.values
    features = getDictArray(data.Features)

    def plot(name):
        y = [v[peaksType + '.' + name] for v in features]
        fig, ax = plt.subplots()
        ax.scatter(trained, y)
        fig.tight_layout()
        ax.set_title("trained: " + name)

    plot('varDist')
    plot('varPeak')
    plot('maxPeak')
    plot('maxDist')
    plot('minPeak')
    plot('minDist')
    plot('avPeak')
    plot('avDist')

    plt.show()
コード例 #3
0
ファイル: ClassifyMain.py プロジェクト: jessab/ML
def main(data=None, selectFeatures='all'):
    if (data is None):
        data = fm.main()


    if (showSVM):
        print("\nSVM: trained/not trained")
        evalSVM(data, True, False, selectFeatures)
        print("\nSVM: surface")
        evalSVM(data, False, True, selectFeatures)
        print("\nSVM: trained-surface")
        evalSVM(data, True, True, selectFeatures)
        pylab.show()
    if (showDT):
        print("\nDT: trained/not trained")
        evalDT(data, True, False, selectFeatures)
        print("\nDT: surface")
        evalDT(data, False, True, selectFeatures)
        print("\nDT: trained-surface")
        evalDT(data, True, True, selectFeatures)
        pylab.show()
    if (showKNN):
        print("\nKNN: trained/not trained")
        evalKNN(data, True, False, selectFeatures)
        print("\nKNN: surface")
        evalKNN(data, False, True, selectFeatures)
        print("\nKNN: trained-surface")
        evalKNN(data, True, True, selectFeatures)
        pylab.show()
    if (showLR):
        print("\nLR: trained/not trained")
        evalLR(data, True, False, selectFeatures)
        print("\nLR: surface")
        evalLR(data, False, True, selectFeatures)
        print("\nLR: trained-surface")
        evalLR(data, True, True, selectFeatures)
        pylab.show()