Skip to main content

Posts

Showing posts from October, 2021

Binomial Distribution

  The binomial distribution formula is:                                                    b(x; n, P) =  n C x  * P x  * (1 – P) n – x Where: b = binomial probability x = total number of “successes” (pass or fail, heads or tails etc.) P = probability of a success on an individual trial n = number of trials Note:  The binomial distribution formula can also be written in a slightly different way, because  n C x  = n! / x!(n – x)! (this binomial distribution formula uses factorials  (What is a factorial? ). “q” in this formula is just the probability of failure (subtract your probability of success from 1). Using the First Binomial Distribution Formula The binomial distribution formula can calculate the probability of success for binomial distributions. Often you’ll be told to “plug in” the numbers to the  formul...

deploying Machine learning Model : pkl, Flask,postman

1)Create model and train          #  importing Librarys         import pandas as pd         import numpy as np         import matplotlib . pyplot as plt         import seaborn as sns         import requests         from pickle import dump , load         # Load Dataset         url = "http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"         names = [ "sepal_length" , "sepal_width" , "petal_length" , "petal_width" , "species" ]         # Loading Dataset         df = pd . read_csv ( url , names = names )         df . tail ( 11 )         df . columns         test = [         { 'sepal_length' : 5.1 , 'sepal_width' : 3.5 , 'peta...

Orders of magnitude (time)

  Orders of magnitude (time) 10 −12 1  picosecond ps One trillionth of one second 1 ps : mean lifetime of a  bottom quark ; light travels 0.3 millimeters (mm) 1 ps : typical lifetime of a  transition state 4 ps : Time to execute one machine cycle by an IBM  silicon-germanium transistor 109 ps : Period of the  photon corresponding to  the  hyperfine transition  of the ground state of  cesium-133 , and one 9,192,631,770th of one second  by definition 114.6 ps : Time for the fastest overclocked processor As of 2014 to execute one machine cycle. [9] 10 −9 1  nanosecond ns One billionth of one second 1 ns : Time to execute one machine cycle by a 1 GHz microprocessor 1 ns : Light travels 30 cm (12 in) 10 −6 1  microsecond µs One millionth of one second 1 µs : Time to execute one machine cycle by an Intel 80186 microprocessor 2.2 µs : Lifetime of a  muon 4–16 µs : Time to execute one machine cycle by a 19...

Binary Search and Linear Search

Question 1   Alice has some cards with numbers written on them. She arranges the cards in decreasing order, and lays them out face down in sequence on a table. she challenges Bob to pick out the card containging a given number by turning over as few cards as possible. Write a function to help Bob locate the card.   cards= [13, 11, 10, 7, 4, 3,8, 9, 24] query= 24 output = 4 def locate_card(cards, query): lo,hi=0,len(cards)-1 while lo query: lo=mid+1 return -1 1 def locate_card ( cards , query ): 2 lo , hi = 0 , len ( cards ) - 1 3 while lo <= hi : 4 mid = ( lo + hi ) // 2 5 mid_number = cards [ mid ] 6 7 print ( "lo" , lo , ",hi" , hi , ', mid' , mid , ',mid_number' , mid_number ) 8 9 if mid_number == query : 10 return mid 11 elif mid_number < query : 12 hi = mid - 1 13 elif mid_number > query : 14 lo...