コード例 #1
0
    'Unknown classifier type ' + clfrType

# Check can write these files.
if outfile != None:
    f = open(outfile, 'w')
    f.close()

clfr = None
labs = None
ftrs = None

# Load the features and labels
if infileFtrs.endswith('.pkl'):
    ftrs = pomio.unpickleObject(infileFtrs)
else:
    ftrs = pomio.readMatFromCSV(infileFtrs)
D = ftrs.shape[1]
print 'Feature dimensionality = ', D

if infileLabs.endswith('.pkl'):
    labs = pomio.unpickleObject(infileLabs)
else:
    labs = pomio.readMatFromCSV(infileLabs).astype(np.int32)

n = len(labs)
assert n == ftrs.shape[0], 'Error: there are %d labels and %d training examples' \
    % ( n, ftrs.shape[0] )

assert np.all(np.isfinite(ftrs))

print 'There are %d unique labels in range [%d,%d]' % (len(
コード例 #2
0
parser.add_argument('--nstart', type=int, default=0,\
                      help='Index of feature to start at')

args = parser.parse_args()

import amntools
import matplotlib.pyplot as plt
import pomio

plt.interactive(1)

# Load the features and labels
if args.ftrs.endswith('.pkl'):
    ftrs = pomio.unpickleObject( args.ftrs )
else:
    ftrs = pomio.readMatFromCSV( args.ftrs )
N = ftrs.shape[0]
D = ftrs.shape[1]
print '%d feature vectors of dimensionality = %d' % (N,D)

if args.labs == None:
  labs = None
else:
  if args.labs.endswith('.pkl'):
      labs = pomio.unpickleObject( args.labs )
  else:
      labs = pomio.readMatFromCSV( args.labs ).astype(np.int32)


# show labels
if labs != None:
コード例 #3
0
# Check can write these files.
if outfile != None:
    f=open(outfile,'w')
    f.close()


clfr = None
labs = None
ftrs = None


# Load the features and labels
if infileFtrs.endswith('.pkl'):
    ftrs = pomio.unpickleObject( infileFtrs )
else:
    ftrs = pomio.readMatFromCSV( infileFtrs )
D = ftrs.shape[1]
print 'Feature dimensionality = ', D

if infileLabs.endswith('.pkl'):
    labs = pomio.unpickleObject( infileLabs )
else:
    labs = pomio.readMatFromCSV( infileLabs ).astype(np.int32)

n = len(labs)
assert n == ftrs.shape[0], 'Error: there are %d labels and %d training examples' \
    % ( n, ftrs.shape[0] )

assert np.all( np.isfinite( ftrs ) )

print 'There are %d unique labels in range [%d,%d]' % ( len(np.unique(labs)), np.min(labs), np.max(labs) )
コード例 #4
0
parser.add_argument('--nstart', type=int, default=0,\
                      help='Index of feature to start at')

args = parser.parse_args()

import amntools
import matplotlib.pyplot as plt
import pomio

plt.interactive(1)

# Load the features and labels
if args.ftrs.endswith('.pkl'):
    ftrs = pomio.unpickleObject(args.ftrs)
else:
    ftrs = pomio.readMatFromCSV(args.ftrs)
N = ftrs.shape[0]
D = ftrs.shape[1]
print '%d feature vectors of dimensionality = %d' % (N, D)

if args.labs == None:
    labs = None
else:
    if args.labs.endswith('.pkl'):
        labs = pomio.unpickleObject(args.labs)
    else:
        labs = pomio.readMatFromCSV(args.labs).astype(np.int32)

# show labels
if labs != None:
    plt.figure()