예제 #1
0
#
# Stephan Schulz (I4)
# Technische Universitaet Muenchen
# Institut fuer Informatik
# Boltzmannstrasse 3
# Garching bei Muenchen
# Germany
#
# or via email (address above).

import sys
import string

import pylib_io
import pylib_eprots

pylib_io.check_argc(2)

cl = pylib_eprots.classification()
cl.parse(sys.argv[1])

fl = pylib_eprots.featurelist()
fl.parse(sys.argv[2])

for i in fl:
    try:
        tclass = cl.classify(i[0])
        print i[0], ":", string.join(i[1], ","), ":", tclass
    except KeyError:
        pass
예제 #2
0
파일: wo.py 프로젝트: kylepjohnson/sigma
import sys
import re
import string
import pylib_io

def id(string):
    return string

def firstfield(str):
    parts = string.split(str)
    if(len(parts)>0):
        return parts[0]
    return ""


def without(file_source, file_remove, abstract_fun):
    source = {}
    lines = file_remove.readlines()
    for line in lines:
        source[abstract_fun(line)] = 1;
    lines = file_source.readlines()
    for line in lines:
        if(not (abstract_fun(line) in source)):
            sys.stdout.write(line)

pylib_io.check_argc(2)
file_source = pylib_io.flexopen(sys.argv[1], "r")
file_remove = pylib_io.flexopen(sys.argv[2], "r")

without(file_source, file_remove, id)
예제 #3
0
    if o[0:2] == "-x":
        try:
            crossval = int(float(o[2:]))
        except ValueError:
            crossval = 10
    if o[0:2] == "-X":
        try:
            crossval = int(float(o[2:]))
        except ValueError:
            crossval = 10
        stratified = False
    if o=="-v":
        pylib_basics.globals.verbose = True
    if o=="-c":
        classify = True
        pylib_io.check_argc(2,args)
    if o=="-e":
        eval_tree = True
    if o=="-n":
        printtree = False
    if o=="-h":
        print __doc__
        sys.exit()
    if o[0:2] == "-S":
        seed = long(o[2:])

pylib_io.check_argc(1,None,args)

set = pylib_ml_examples.ml_exampleset()
set.parse(args[0])
예제 #4
0
    if o[0:2] == "-x":
        try:
            crossval = int(float(o[2:]))
        except ValueError:
            crossval = 10
    if o[0:2] == "-X":
        try:
            crossval = int(float(o[2:]))
        except ValueError:
            crossval = 10
        stratified = False
    if o=="-v":
        pylib_basics.globals.verbose = True
    if o=="-c":
        classify = True
        pylib_io.check_argc(2,args)
    if o=="-e":
        eval_tree = True
    if o=="-n":
        printtree = False
    if o=="-h":
        print __doc__
        sys.exit()
    if o[0:2] == "-S":
        seed = long(o[2:])

pylib_io.check_argc(1,None,args)

set = pylib_ml_examples.ml_exampleset()
set.parse(args[0])