예제 #1
0
def train_bot():
    rows = getRows('Blackjack')
    x = [r[0:3] for r in rows]
    y = [r[3] for r in rows]
    MLP = MLPClassifier()
    MLP = MLP.fit(x, y)
    print(MLP.predict_proba([(20, 5, 0)]) * 100)
예제 #2
0
파일: pieChart.py 프로젝트: bentolor/NetTK
def updateGraph(data):

    # Update all our plots
    for plot in plots:

        # Grab our row information
        timeStamps, isDroppedPackets, delayTimes = getRows(plot["table"],
                                                           age=plot["age"])

        # Clear image. If we don't, it gets smudgy
        plot["ax"].clear()

        # Re-set the title
        plot["ax"].set_title(plot["title"])

        # Re-draw the chart
        plot["ax"].pie([isDroppedPackets.count(0),
                        isDroppedPackets.count(1)], [0, 0.05],
                       ["Not Dropped", "Dropped"],
                       shadow=True,
                       autopct="%.0f%%",
                       startangle=45,
                       colors=[colorGood, colorBad])

        plot["ax"].relim()  # reset intern limits of the current axes
        plot["ax"].autoscale_view()  # reset axes limits

    # Draw our pie charts
    fig.canvas.draw()

    return None,
예제 #3
0
def buildGraph():
	"""
	Input:
		Nothing
	Action:
		Loops through all registered plots.
		Creates and initializes their graph.
		Updates plots global list.
	Returns:
		Nothing
	"""
	global line, fig, plots

	# Initialize ax (subplot holder)
	ax = None

	# Create as many plots as we need to
	# TODO: Allow customization of view
	fig,ax = plt.subplots(nrows=len(plots), ncols=1, sharex=sharex, sharey=sharey)

	# Loop through our registered plots
	for plot in plots:

		# Grab our row information
		timeStamps, isDroppedPacket, delayTime = getRows(plot["table"], age=plot["age"])

		# Move over our ax element. If only one registered plot, this will be ax itself, it more than one, it will be in a numpy array.
		# Make sure we're looking at a list
		if isinstance(ax,np.ndarray) == True:
			# Numpy won't let us pop. We'll grab the top, then remove it.
			plot["ax"] = ax[0]
			ax = np.delete(ax,0, axis=0)
		else:
			# This is the case where we're only plotting one thing. Just copy it over.
			plot["ax"] = ax

		# Plot our initial data points, saving the line object we will use later to update it for animations.
		# TODO: Allow customization here
		plot["line"] = plot["ax"].plot(timeStamps, delayTime, '-', linewidth=1)[0]

		# Format the background grid
		#ax.grid(color='r', linestyle='--', linewidth=1)
		# TODO: Allow customization here
		plot["ax"].grid(True, 'major')

		# Set our axis labels.
		plot["ax"].set_xlabel("time (local time)")
		plot["ax"].set_ylabel("round trip time (s)")

		# Set plot title based on plot parameters
		plot["ax"].set_title(plot["title"])

		# Add human fiendly times along the bottom
		addTimeTicks(timeStamps, plot["ax"])

	# Add the footer
	footer(plt)
예제 #4
0
파일: lineGraph.py 프로젝트: Owlz/NetTK
def buildGraph():
	"""
	Input:
		Nothing
	Action:
		Loops through all registered plots.
		Creates and initializes their graph.
		Updates plots global list.
	Returns:
		Nothing
	"""
	global line, fig, plots

	# Initialize ax (subplot holder)
	ax = None

	# Create as many plots as we need to
	# TODO: Allow customization of view
	fig,ax = plt.subplots(nrows=len(plots), ncols=1, sharex=sharex, sharey=sharey)

	# Loop through our registered plots
	for plot in plots:

		# Grab our row information
		timeStamps, isDroppedPacket, delayTime = getRows(plot["table"], age=plot["age"])

		# Move over our ax element. If only one registered plot, this will be ax itself, it more than one, it will be in a numpy array.
		# Make sure we're looking at a list
		if isinstance(ax,np.ndarray) == True:
			# Numpy won't let us pop. We'll grab the top, then remove it.
			plot["ax"] = ax[0]
			ax = np.delete(ax,0, axis=0)
		else:
			# This is the case where we're only plotting one thing. Just copy it over.
			plot["ax"] = ax

		# Plot our initial data points, saving the line object we will use later to update it for animations.
		# TODO: Allow customization here
		plot["line"] = plot["ax"].plot(timeStamps, delayTime, '-', linewidth=1)[0]

		# Format the background grid
		#ax.grid(color='r', linestyle='--', linewidth=1)
		# TODO: Allow customization here
		plot["ax"].grid(True, 'major')

		# Set our axis labels.
		plot["ax"].set_xlabel("time (local time)")
		plot["ax"].set_ylabel("round trip time (s)")

		# Set plot title based on plot parameters
		plot["ax"].set_title(plot["title"])

		# Add human fiendly times along the bottom
		addTimeTicks(timeStamps, plot["ax"])

	# Add the footer
	footer(plt)
예제 #5
0
파일: pieChart.py 프로젝트: bentolor/NetTK
def buildGraph():
    """
	Input:
		Nothing
	Action:
		Loops through all registered plots.
		Creates and initializes their graph.
		Updates plots global list.
	Returns:
		Nothing
	"""
    global line, fig, plots

    # Initialize ax (subplot holder)
    ax = None

    # Generate our figure object
    fig = plt.figure()

    # Loop through our registered plots
    for plot in plots:

        # Create the pie chart plot for this pie chart
        plot["ax"] = plt.subplot2grid((gridx, gridy),
                                      (plot["locy"], plot["locx"]),
                                      aspect=1)

        # Grab our row information
        timeStamps, isDroppedPacket, delayTime = getRows(plot["table"],
                                                         age=plot["age"])

        # Plot our initial data points, saving the line object we will use later to update it for animations.
        # TODO: Allow customization here
        plot["ax"].pie([isDroppedPacket.count(0),
                        isDroppedPacket.count(1)], [0, 0.05],
                       ["Not Dropped", "Dropped"],
                       shadow=True,
                       autopct="%.0f%%",
                       startangle=45,
                       colors=[colorGood, colorBad])

        # Set plot title based on plot parameters
        plot["ax"].set_title(plot["title"])

    # Add the footer
    footer(plt)
예제 #6
0
def updateGraph(data):
	global line

	# Update all our plots
	for plot in plots:

		# Grab our row information
		timeStamps, isDroppedPackets, delayTimes = getRows(plot["table"], age=plot["age"])
	
		# Add new data to the graph
		plot["line"].set_data(timeStamps, delayTimes)

		# Auto fit the graph
		plot["ax"].relim()		# reset intern limits of the current axes
		plot["ax"].autoscale_view()	# reset axes limits 

		# Change x ticks to be human readable
		addTimeTicks(timeStamps, plot["ax"])

	# Draw the graph
	fig.canvas.draw()

	return None,
예제 #7
0
파일: lineGraph.py 프로젝트: Owlz/NetTK
def updateGraph(data):
	global line

	# Update all our plots
	for plot in plots:

		# Grab our row information
		timeStamps, isDroppedPackets, delayTimes = getRows(plot["table"], age=plot["age"])
	
		# Add new data to the graph
		plot["line"].set_data(timeStamps, delayTimes)

		# Auto fit the graph
		plot["ax"].relim()		# reset intern limits of the current axes
		plot["ax"].autoscale_view()	# reset axes limits 

		# Change x ticks to be human readable
		addTimeTicks(timeStamps, plot["ax"])

	# Draw the graph
	fig.canvas.draw()

	return None,
예제 #8
0
파일: pieChart.py 프로젝트: Owlz/NetTK
def buildGraph():
	"""
	Input:
		Nothing
	Action:
		Loops through all registered plots.
		Creates and initializes their graph.
		Updates plots global list.
	Returns:
		Nothing
	"""
	global line, fig, plots

	# Initialize ax (subplot holder)
	ax = None

	# Generate our figure object
	fig = plt.figure()

	# Loop through our registered plots
	for plot in plots:

		# Create the pie chart plot for this pie chart
		plot["ax"] = plt.subplot2grid((gridx,gridy), (plot["locy"],plot["locx"]), aspect=1)

		# Grab our row information
		timeStamps, isDroppedPacket, delayTime = getRows(plot["table"], age=plot["age"])

		# Plot our initial data points, saving the line object we will use later to update it for animations.
		# TODO: Allow customization here
		plot["ax"].pie([isDroppedPacket.count(0),isDroppedPacket.count(1)],[0,0.05],["Not Dropped","Dropped"], shadow=True, autopct="%.0f%%", startangle=45, colors=[colorGood,colorBad])

		# Set plot title based on plot parameters
		plot["ax"].set_title(plot["title"])

	# Add the footer
	footer(plt)
예제 #9
0
파일: pieChart.py 프로젝트: Owlz/NetTK
def updateGraph(data):

	# Update all our plots
	for plot in plots:

		# Grab our row information
		timeStamps, isDroppedPackets, delayTimes = getRows(plot["table"], age=plot["age"])

		# Clear image. If we don't, it gets smudgy
		plot["ax"].clear()

		# Re-set the title
		plot["ax"].set_title(plot["title"])

		# Re-draw the chart
		plot["ax"].pie([isDroppedPackets.count(0),isDroppedPackets.count(1)],[0,0.05],["Not Dropped","Dropped"], shadow=True, autopct="%.0f%%", startangle=45, colors=[colorGood,colorBad])

		plot["ax"].relim()		# reset intern limits of the current axes
		plot["ax"].autoscale_view()	# reset axes limits 

	# Draw our pie charts
	fig.canvas.draw()

	return None,