当前位置: 首页>>代码示例>>Python>>正文


Python DataModel.clsData方法代码示例

本文整理汇总了Python中DataModel.clsData方法的典型用法代码示例。如果您正苦于以下问题:Python DataModel.clsData方法的具体用法?Python DataModel.clsData怎么用?Python DataModel.clsData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataModel的用法示例。


在下文中一共展示了DataModel.clsData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: returnCheckerBoardFunction

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import clsData [as 别名]
    def returnCheckerBoardFunction(self, Ndata: int, nx: int, ny: int, delta: float):
        """initCheckerBoardFunction

	Generates two classes similar to a chekerBoard table. One classe would be in the same position 
	as the black part of the board and the second in the white one

	Parameters:
	INPUT:
		Ndata: number of instance of each quadrant
		nx: number of quadrants in x
		ny: number of quadrants in y
		delta: scramble factor, a lower delta means more entangled classes
	OUTPUT:
		cls1, cls2 : objects from classData with encapsulates all data from a given sub-class.

	Example:
		import LoadData
		import matplotlib.pyplot as plt
		myData = LoadData.clsWorkingData()
		cls1, cls2 = myData.initCheckerBoardFunction(50,2,2,0.5)
		plt.plot(cls1.data[:,0],cls1.data[:,1],'g*')
		plt.plot(cls2.data[:,0],cls2.data[:,1],'rd'),
		plt.show()

	Modified:
		(LEO) : 17/01/2016

	Version:
		v0.1

"""

        cls1 = DataModel.clsData(1, 1, 0)
        cls2 = DataModel.clsData(0, 1, 0)
        data1 = []
        data2 = []
        i1 = 0
        i2 = 0

        for k in range(0, Ndata):
            for i in range(0, nx):
                for j in range(0, ny):
                    if divmod(i + j, 2)[1] == 1:
                        dx = -delta + 2.0 * delta * random.random()
                        dy = -delta + 2 * delta * random.random()
                        data1.append([i + dx, j + dy])
                        i1 += 1
                    else:
                        dx = -delta + 2.0 * delta * random.random()
                        dy = -delta + 2.0 * delta * random.random()
                        data2.append([i + dx, j + dy])
                        i2 += 1

        data1 = np.matrix(data1)
        data2 = np.matrix(data2)

        cls1.setData(data1)
        cls2.setData(data2)

        return cls1, cls2
开发者ID:lmhonorio,项目名称:PySGS,代码行数:62,代码来源:DataManagement.py

示例2: returnBananaDataset

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import clsData [as 别名]
    def returnBananaDataset(self, N: (int, int), p: (float, float), r: float, s: float):
        """initCheckerBoardFunction

	Generates two classes similar to two bananas - semi-circle classes. One classe is mirrowed and shifted related to another.

	Parameters:
	INPUT:
		N: (int,int) tuple, indicating the number of instances of each class
		p: (float,float) a tuple responsible for shifting the center of each class
		r: the ray of the "bananas"
		s: scramble factor, a higher s means more entangled classes
	OUTPUT:
		cls1, cls2 : objects from classData with encapsulates all data from a given sub-class.

	Example:
		import LoadData
		import matplotlib.pyplot as plt
		myData = LoadData.clsWorkingData()
		cls1, cls2 = myData.returnBananaDataset((200,200), (1.0,1.0), 1.7, 0.2)
		plt.plot(cls1.data[:,0],cls1.data[:,1],'g*')
		plt.plot(cls2.data[:,0],cls2.data[:,1],'rd'),
		plt.show()

	Modified:
		(LEO) : 17/01/2016

	Version:
		v0.1

"""
        cls1 = DataModel.clsData(1, 1, 0)
        cls2 = DataModel.clsData(0, 1, 0)

        domaina = np.array(0.125 * np.pi + np.random.rand(N[0], 1) * 1.25 * np.pi)
        data1 = np.matrix(np.column_stack((r * np.sin(domaina), r * np.cos(domaina)))) + np.matrix(
            np.random.rand(N[0], 2)
        )
        cls1.setData(data1)

        domainb = np.array(0.375 * np.pi - np.random.rand(N[0], 1) * 1.25 * np.pi)
        data2 = np.matrix(np.column_stack((r * np.sin(domainb) - p[0], r * np.cos(domainb) - p[1]))) + np.matrix(
            np.random.rand(N[0], 2)
        )
        cls2.setData(data2)

        return cls1, cls2
开发者ID:lmhonorio,项目名称:PySGS,代码行数:48,代码来源:DataManagement.py

示例3: returnLineSegmentDataset

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import clsData [as 别名]
    def returnLineSegmentDataset(self, p: (float, float), r: float):
        """initCheckerBoardFunction


		v0.1

"""
        cls1 = DataModel.clsData(1, 1, 0)
        cls2 = DataModel.clsData(0, 1, 0)

        x = np.array(np.arange(p[0], p[1], r)).transpose()
        n = x.shape[0]
        y = np.array(x) + np.random.rand(1, n) * r
        data = np.vstack((x, y))

        cls1.setData(data.transpose())

        return cls1
开发者ID:lmhonorio,项目名称:PySGS,代码行数:20,代码来源:DataManagement.py

示例4: __init__

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import clsData [as 别名]
	def __init__(self, set_id = 0, in_collision = 0, breaks = 0, data = [], obj_data = DataModel.clsData()):

		if len(obj_data.data)==0:
			DataModel.clsData.__init__(self,set_id,in_collision,breaks,data)
		else:
			DataModel.clsData.__init__(self,obj_data.set_id,obj_data.in_collision,obj_data.breaks,obj_data.data)
		
				
		self.projections = Projections.clsProjectionOverAxis(self.data,self.word_ref_center,self.pi)
开发者ID:lmhonorio,项目名称:PySGS,代码行数:11,代码来源:OrientedBoundHyperBox.py

示例5: returnPointsDataset

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import clsData [as 别名]
    def returnPointsDataset(self):
        """initCheckerBoardFunction


		v0.1

"""
        cls1 = DataModel.clsData(1, 1, 0)
        cls2 = DataModel.clsData(0, 1, 0)

        px = [-2.0, -2.0, 2.0, 2.0]
        py = [-2.0, 2.0, -2.0, 2.0]

        x = np.array(px).transpose()
        n = x.shape[0]
        y = np.array(py).transpose()
        data = np.vstack((x, y))

        cls1.setData(data.transpose())

        return cls1, cls1
开发者ID:lmhonorio,项目名称:PySGS,代码行数:23,代码来源:DataManagement.py

示例6: breakThisBondingBoxUsingKDE

# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import clsData [as 别名]
	def breakThisBondingBoxUsingKDE(self):
		idx_max_lambda =  np.argmax(self.Lambda)
		c_axis = np.array(self.projections.projection_over_pi[idx_max_lambda])
		i_break = self.kernelDensityEstimation()

		new_data_1 = []
		new_data_2 = []
		for i in range(0,self.dataLen):
			if c_axis[i] < i_break:
				new_data_1.append(self.data[i,:])
			else:
				new_data_2.append(self.data[i,:])


		pcls1 = DataModel.clsData(self.set_id,1,self.breaks)
		pcls2 = DataModel.clsData(self.set_id,1,self.breaks)

		pcls1.setData(new_data_1)
		pcls2.setData(new_data_2)

		new_obb_1 = clsOBHB(obj_data = pcls1)	
		new_obb_2 = clsOBHB(obj_data = pcls2)

		return new_obb_1,new_obb_2
开发者ID:lmhonorio,项目名称:PySGS,代码行数:26,代码来源:OrientedBoundHyperBox.py


注:本文中的DataModel.clsData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。