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


Python Utils.createTitleForFeatures方法代码示例

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


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

示例1: authCurves

# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import createTitleForFeatures [as 别名]
	def authCurves(self, network, orgs=None, dests=None, flights=None, 
					cabins=None, bcs=None, date_ranges=None):
		""" Plots AUTH curves for some subset of the data.
		
		AUTH is stated at the level of a cabin-booking class.  AUTH changes
		with time starting from the opening of ticket sales and ending close 
		to departure.   Note that you only have to look at two booking 
		classes (BC) for purpose of overbooking: Y class for Y cabin and J 
		class for J cabin. This is because those classes always have the
		maximum AUTH among all classes in a cabin at a given point of time 
		(they are at the top in hierarchy). 
	
		"""

		df = network.f.getDrillDown(orgs=orgs, dests=dests, flights=flights,
							cabins=cabins, bcs=bcs, date_ranges=date_ranges)

		fltbk = network.f.getUniqueFlightsAndBookings(df)

		plt.figure()
		for g, d in fltbk:
			AUTH = np.array(d.sort(columns='KEYDAY', ascending=False)['AUTH'])
			KEYDAY = np.array(-d.sort(columns='KEYDAY', ascending=False)['KEYDAY'])

			plt.plot(KEYDAY, AUTH)

		title = Utils.createTitleForFeatures(orgs,dests,flights,cabins,bcs,date_ranges)
		plt.title(title)
		plt.xlabel('-KEYDAY')
		plt.ylabel('AUTH')
		plt.show()
开发者ID:kmcconnaughay,项目名称:ICF-Project,代码行数:33,代码来源:Visualizer.py

示例2: bookingCurves

# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import createTitleForFeatures [as 别名]
	def bookingCurves(self, network, orgs=None, dests=None, flights=None, 
						cabins=None, bcs=None, date_ranges=None):
		""" Plots booking curves for some subset of the data.
		
		A booking curve tracks the number of seats booked over time, starting 
		from the opening of ticket sales and ending close to departure
	
		"""

		df = network.f.getDrillDown(orgs=orgs, dests=dests, flights=flights,
							cabins=cabins, bcs=bcs, date_ranges=date_ranges)
		fltbk = network.f.getUniqueFlightsAndBookings(df)

		plt.figure()
		for g, d in fltbk:
			BKD = list(d.sort(columns='KEYDAY', ascending=False)['BKD'])
			KEYDAY = list(-d.sort(columns='KEYDAY', ascending=False)['KEYDAY'])

			ID = d['DATE'].first
			BC = d['BC'].first
				
			plt.plot(KEYDAY, BKD)
			
		title = Utils.createTitleForFeatures(orgs,dests,flights,cabins,bcs,date_ranges)
		plt.title(title)
		plt.xlabel('-KEYDAY')
		plt.ylabel('BKD')
		plt.show()
开发者ID:kmcconnaughay,项目名称:ICF-Project,代码行数:30,代码来源:Visualizer.py

示例3: overbookingCurves

# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import createTitleForFeatures [as 别名]
	def overbookingCurves(self, network, orgs=None, dests=None, flights=None, 
						cabins=None, bcs=None, date_ranges=None, normalized=True):
		""" Plots overbooking curves for some subset of the data.
		
		Overbooking is defined where AUTH > CAP.  We plot overbooking as a 
		ratio between AUTH and CAP.  Overbooking varies with time.
	
		"""
		df = network.f.getDrillDown(orgs=orgs, dests=dests, flights=flights,
							cabins=cabins, bcs=bcs, date_ranges=date_ranges)

		fltbk = network.f.getUniqueFlightsAndBookings(df)

		plt.figure()
		
		if normalized:
			for g, d in fltbk:
				# normalized AUTH == OVERBOOKED
				AUTH = np.array(d.sort(columns='KEYDAY', ascending=False)['AUTH'])
				
				# ignore time series that are not overbooked
				if not Utils.isOverbooked(AUTH):
					continue

				KEYDAY = np.array(-d.sort(columns='KEYDAY', ascending=False)['KEYDAY'])
				
				plt.plot(KEYDAY, AUTH)
		else:
			for g, d in fltbk:
				AUTH = np.array(d.sort(columns='KEYDAY', ascending=False)['AUTH'])
				CAP = float(d.iloc[0]['CAP'])
				OVRBKD = AUTH/CAP

				# ignore time series that are not overbooked
				if not Utils.isOverbooked(OVRBKD):
					continue

				KEYDAY = np.array(-d.sort(columns='KEYDAY', ascending=False)['KEYDAY'])
				
				plt.plot(KEYDAY, OVRBKD)

		title = Utils.createTitleForFeatures(orgs,dests,flights,cabins,bcs,date_ranges)
		plt.title(title)
		plt.xlabel('-KEYDAY')
		plt.ylabel('Percentage Overbooked: AUTH / CAP')
		plt.show()
开发者ID:kmcconnaughay,项目名称:ICF-Project,代码行数:48,代码来源:Visualizer.py

示例4: stackedBookingCurve

# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import createTitleForFeatures [as 别名]
	def stackedBookingCurve(self, network, orgs=None, dests=None, 
		                     flights=None, cabins=None, bcs=None, 
		                     date_ranges=None):
		"""
		Generate a summative booking curve for a given flight. In order for this
		function to work properly the arguments must specify one specific flight
		(or a subset of the booking classes on a specific flight). Additionally,
		the network must have been create using a normalized data set.
		"""

		first_flights = network.f.getDrillDown(orgs=orgs, dests=dests, 
											   flights=flights, cabins=cabins, 
											   bcs=bcs, date_ranges=date_ranges)
		groupedByBookings = network.f.getUniqueFlightsAndBookings(first_flights)
		xvals = np.linspace(-1, 0, 101) # Increments of .01 from -1 -> 0
		interps = None
		labels = [g[4] for g, d in groupedByBookings]

		for g, d in groupedByBookings:
			keydays = -d['KEYDAY'] 
			booked = d['BKD']
			yvals = network.interp(xvals, keydays, booked)
			if interps == None:
				interps = yvals
			else:
				interps = np.vstack((interps, yvals))

		# interps is my matrix
		m, n = interps.shape
		interps_sum = np.zeros((m,n))
		for i in range(m-1):
			for j in range(i+1, m):
				interps_sum[j] += interps[i]

		for i in range(m):
			plt.plot(xvals, interps_sum[i])

		plt.legend(labels, loc=6, prop={'size': 14})
		plt.title('Summative Booking Curve\n' + Utils.createTitleForFeatures(orgs, dests, flights, cabins, bcs, date_ranges))
		plt.xlabel('Normalized Keyday')
		plt.ylabel('Normalized Booked')
		plt.show()
开发者ID:kmcconnaughay,项目名称:ICF-Project,代码行数:44,代码来源:Visualizer.py

示例5: overbookingVsCabinLoadFactor

# 需要导入模块: from Utils import Utils [as 别名]
# 或者: from Utils.Utils import createTitleForFeatures [as 别名]
	def overbookingVsCabinLoadFactor(self, network, orgs=None, dests=None, flights=None, 
									cabins=None, bcs=None, date_ranges=None, 
									normalized=True, subplots=True):
		""" Plots how overbooking varies with Cabin load factor.  Final Cabin Load Factor
		for a particular flight booking class is binned into three separate categories:
		
		Overbooked: CLF > 1
		Underbooked: CLF < .8
		Optimumly booked: .8 < CLF < 1
		
		"""
		df = network.f.getDrillDown(orgs=orgs, dests=dests, flights=flights,
							cabins=cabins, bcs=bcs, date_ranges=date_ranges)

		fltbk = network.f.getUniqueFlightsAndBookings(df)
		# TODO: allow for countFinalCabinLoadFactor to use normalized data		
		CLF_dict = network.countFinalCabinLoadFactor()

		fig = plt.figure()
		# preparing to capture the legend handles
		legend_over = None
		legend_under = None
		legend_optimum = None
		n_over = 0
		n_under = 0
		n_optimum = 0

		if normalized:
			for g, d in fltbk:
				# normalized AUTH == OVERBOOKED
				AUTH = np.array(d.sort(columns='KEYDAY', ascending=False)['AUTH'])
				
				# ignore time series that are not overbooked
				if not Utils.isOverbooked(AUTH):
					continue

				KEYDAY = np.array(-d.sort(columns='KEYDAY', ascending=False)['KEYDAY'])
				DATE = d.iloc[0]['DATE']
				FLT = d.iloc[0]['FLT']
				ORG = d.iloc[0]['ORG']
				DES = d.iloc[0]['DES']
				
				#TODO: See CLF_dict (above)
				CABIN_LOAD_FACTOR = CLF_dict[(DATE, FLT, ORG, DES)]

				if CABIN_LOAD_FACTOR > 1:
					plt.plot(KEYDAY, AUTH, 'r')
				elif CABIN_LOAD_FACTOR < .95: 
					plt.plot(KEYDAY, AUTH, 'y')
				else:
					plt.plot(KEYDAY, AUTH, 'g')
		else:
			for g, d in fltbk:
				
				AUTH = np.array(d.sort(columns='KEYDAY', ascending=False)['AUTH'])
				CAP = float(d.iloc[0]['CAP'])
				OVRBKD = AUTH/CAP

				# ignore time series that are not overbooked
				if not Utils.isOverbooked(OVRBKD):
					continue

				KEYDAY = np.array(-d.sort(columns='KEYDAY', ascending=False)['KEYDAY'])
				DATE = d.iloc[0]['DATE']
				FLT = d.iloc[0]['FLT']
				ORG = d.iloc[0]['ORG']
				DES = d.iloc[0]['DES']

				CABIN_LOAD_FACTOR = CLF_dict[(DATE, FLT, ORG, DES)]

				


				if CABIN_LOAD_FACTOR > 1:
					plt.subplot(311) if subplots else None
					if not legend_over:
						legend_over, = plt.plot(KEYDAY, OVRBKD , 'r')
					else:
						plt.plot(KEYDAY, OVRBKD , 'r')
					n_over += 1

				elif CABIN_LOAD_FACTOR < .95: 
					plt.subplot(313) if subplots else None
					if not legend_under:
						legend_under, = plt.plot(KEYDAY, OVRBKD, 'y')
					else:
						plt.plot(KEYDAY, OVRBKD, 'y')
					n_under += 1

				else:
					plt.subplot(312) if subplots else None
					if not legend_optimum:
						legend_optimum, = plt.plot(KEYDAY, OVRBKD, 'g')
					else:
						plt.plot(KEYDAY, OVRBKD, 'g')
					n_optimum += 1

		title = Utils.createTitleForFeatures(orgs,dests,flights,cabins,bcs,date_ranges)
		plt.subplot(311) if subplots else None
		plt.suptitle(title)
#.........这里部分代码省略.........
开发者ID:kmcconnaughay,项目名称:ICF-Project,代码行数:103,代码来源:Visualizer.py


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