本文整理汇总了Python中dataset.Dataset.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.__init__方法的具体用法?Python Dataset.__init__怎么用?Python Dataset.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__ (self, filename="93-15_top_9.npz"):
data = np.load(filename)
self.teams = data["teams"]
Dataset.__init__(self, len(self.teams))
self.pairwise_probs = data["probs"]
print(len(self.teams))
ranking = SE(len(self.teams), self.pairwise_probs)
self.order = ranking.get_ranking()
示例2: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__(self, gbtdirname=None, catalogfile=None):
"""GBTFilterbankData(gbtdirname=None, catalogfile=None)
Read in GBT filterbank data by reference to the catalog file.
"""
Dataset.__init__(self, gbtdirname, "gbtfil", '')
self.read_gbt_dir(gbtdirname, catalogfile)
self.xlabel = 'Frequency'
self.ylabel = 'Time'
示例3: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__(self, filename=None, name="UCI dataset"):
"""Dataset(filename="", name="") -> Dataset
Creates a new Dataset based on the data in filename
and with the name given.
Name is used in output filename prefixes.
This top-level class can't do anything itself,
but needs to be instantiated with one of its subclasses.
"""
Dataset.__init__(self, filename, name, "")
示例4: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__(self, filename=None, name='Floatdata'):
"""Dataset(filename="", name="") -> Dataset
Creates a new Dataset based on the data in filename
and with the name given.
Name is used in output filename prefixes.
Assumes CSV, floating point values, and no class labels.
Commented lines (with #) are ignored.
This top-level class can't do anything itself,
but needs to be instantiated with one of its subclasses.
"""
Dataset.__init__(self, filename, name, '')
示例5: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__ (self, num_players, noise):
assert 0 <= noise <= 0.5 # Because noise = 0.5 is like a coin clip. More than 0.5 would reduce the amount of noise and reverse the ordering
Dataset.__init__(self, num_players)
self.order = np.arange(num_players)
self.noise = noise
#np.random.shuffle(self.order)
for a in range(num_players):
for b in range(num_players):
a_rank = np.where(self.order == a)[0][0]
b_rank = np.where(self.order == b)[0][0]
if a_rank < b_rank:
self.pairwise_probs[a,b] = 1 - noise
else:
self.pairwise_probs[a,b] = noise
示例6: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__(self, rawdirname=None, AODdirname=None, filename=None, force_read=False):
"""MISRData(rawdirname="", AODdirname="", filename="")
Read in raw and AOD MISR data (pickled) from filename.
If it doesn't exist, read in the full data from
the appropriate dirnames, save it out, and proceed.
"""
Dataset.__init__(self, filename, "misr", '')
if (not os.path.exists(filename)) or force_read:
MISRData.read_misr_dir(rawdirname, AODdirname, filename)
# Read in the data
self.readin()
示例7: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__ (self, num_players, noise):
assert 0 <= noise <= 1
Dataset.__init__(self, num_players)
self.order = np.arange(num_players)
self.noise = noise
np.random.shuffle(self.order)
for a in range(num_players):
for b in range(num_players):
a_rank = np.where(self.order == a)[0][0]
b_rank = np.where(self.order == b)[0][0]
if a_rank < b_rank:
self.pairwise_probs[a,b] = 1 - noise
else:
self.pairwise_probs[a,b] = noise
示例8: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__(self, filepath = None, extension = None):
"""KeplerData(filepath="", extension="") -> KeplerData
Creates a new KeplerData object based on the data in the folder given by filepath
and with the extension given.
Name is used in output filename prefixes.
"""
Dataset.__init__(self, None, "kepler", '')
if filepath == 'keplerslc':
filepath = '/proj/imbue/data/kepler/sources/slc/'
if filepath == 'Q0':
filepath = '/proj/imbue/data/kepler/Q0_public/'
self.filepath = filepath
self.xlabel = 'Time (hours)'
self.ylabel = 'Flux'
self.is_fft = False
#dirname = filepath if filepath[-1] != '/' else filepath[:-1]
#self.name += "-" + dirname.split('/')[-1]
self.name += "-" + os.path.basename(filepath)
print self.name
self.data = []
self.cadence = []
self.extension = extension
self.archive = os.path.join(filepath, "kepler." + extension + ".pkl")
# Determine if we need to preprocess the data
if not os.path.exists(self.archive):
KeplerData.read_kepler_dir(self, filepath, extension)
else:
print "Found pickle at " + self.archive
self.readin()
示例9: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__ (self):
data = np.load("05-15.npz")
self.teams = data["teams"]
Dataset.__init__(self, len(self.teams))
self.pairwise_probs = data["probs"]
示例10: __init__
# 需要导入模块: from dataset import Dataset [as 别名]
# 或者: from dataset.Dataset import __init__ [as 别名]
def __init__(self, filepath='multidrcl', suffix='DRCL', extension='.IMG', lblext='.LBL', force_read=True, unit='s', feature='sh', eye='L', do_print=True, initdatadir=None, initdata=None, readintuple=None):
"""MastcamData(filepath="", extension="") -> MastcamData
Creates a new MastcamData object based on the data in the folder given by filepath
and with the extension given.
Name is used in output filename prefixes.
"""
Dataset.__init__(self, None, "mastcam")
if readintuple != None:
(self.data, self.fullimages, self.segmentation, self.labels, self.xlabel, self.ylabel, self.xvals, self.rgbdict, self.lblext) = readintuple[0:9]
if initdata != None:
self.initdata = initdata
if self.initfilename != None:
self.initfilename = initarchive
else:
self.initfilename = 'param'
return
if do_print: print filepath
if filepath == '388':
filepath = '/proj/imbue/data/msl-mastcam/sol388/'
if filepath == 'multidrcl':
filepath = '/proj/imbue/data/msl-mastcam/multispectral_drcl/'
self.filepath = filepath
self.xlabel = 'TBD'
self.ylabel = 'TBD'
#dirname = filepath[:-1]
#subsetname = dirname.split('/')[-1]
subsetname = os.path.basename(filepath)
self.name += "-" + subsetname
if len(suffix) > 0:
self.name += "-" + eye + '-' + suffix + '-' + unit + '-' + feature
if do_print: print "Dataset name: " + self.name
self.data = []
self.cadence = []
self.unit = unit
self.feature = feature
self.eye = eye
self.rgbdict = {}
self.extension = extension
self.lblext = lblext
self.suffix = suffix
self.archive = os.path.join(filepath,
subsetname + eye + "_" + suffix + '_' + unit + '_' + feature + ".pkl")
if initdata != None:
self.initdata = initdata
if self.initfilename != None:
self.initfilename = initarchive
else:
self.initfilename = 'param'
elif initdatadir != None:
print "Reading in initialization data..."
#initsubsetname = initdatadir[:-1].split('/')[-1]
initsubsetname = os.path.basename(initdatadir)
initarchive = os.path.join(initdatadir,
initsubsetname + eye + "_" + suffix + '_' + unit + '_' + feature + ".pkl")
if os.path.exists(initarchive):
with open(initarchive, 'r') as f:
self.initdata = pickle.load(f)[0]
self.initfilename = initarchive
print "...done!"
print "initdata.shape:", self.initdata.shape
else:
print "...initialization data does not exist!"
print "Desired pickle was: %s" % initarchive
# Determine if we need to preprocess the data
if (not os.path.exists(self.archive)) or force_read:
self.read_mastcam_dir(filepath, suffix, unit, feature, extension, lblext, eye)
else:
if do_print: print "Found pickle at " + self.archive
self.readin()