text stringlengths 1 3.55k | source stringlengths 24 207 | emb listlengths 1.02k 1.02k |
|---|---|---|
exponentially weighted 2013 1848. 36 2014 2058. 9 2015 2043. 94 2016 2238. 83 table 5. 5 ema models ( source : adapted from https : / / www. nasdaq. com / market - activity / index / spx / historical ) 248 5 • time series and forecasting access for free at openstax. org year s & p index at year - end exponentially weig... | openstax_principles-of-data-science-web | [
0.008603131398558617,
0.04549229517579079,
-0.0003220244834665209,
0.033416926860809326,
0.009673004038631916,
0.012585458345711231,
0.00036442754208110273,
-0.012288508005440235,
0.02923782728612423,
0.0517437681555748,
0.02522541768848896,
0.027758631855249405,
-0.0186576209962368,
-0.01... |
4769. 83 2024 table 5. 5 ema models ( source : adapted from https : / / www. nasdaq. com / market - activity / index / spx / historical ) therefore, we find estimates of 4, 349 and 4, 541 for the s & p value at the end of 2024, by ema models with and, respectively. note that larger values of emphasize the most recent d... | openstax_principles-of-data-science-web | [
0.023492446169257164,
0.06703339517116547,
0.0028906906954944134,
0.02101091668009758,
0.008265582844614983,
0.013411127962172031,
-0.01143899280577898,
-0.023440221324563026,
0.008150032721459866,
0.05771629884839058,
0.018172163516283035,
-0.021636513993144035,
-0.023488055914640427,
-0.... |
5. 3 • time series forecasting methods 249 year s & p index at year - end ema estimate 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 n / a table 5. 6 ema smoothing for the s & p index time series ( source : adapted from https : / / www. nasdaq. com / market - activity / index / spx / historical ) accordin... | openstax_principles-of-data-science-web | [
0.0004061701474711299,
0.05639946833252907,
-0.0031531048007309437,
0.02139613777399063,
0.012329226359724998,
0.007869302295148373,
-0.007440316025167704,
-0.01575724594295025,
0.01728072017431259,
0.03944387286901474,
0.020152581855654716,
-0.025092726573348045,
-0.0032988525927066803,
-... |
creating dataframe df = pd. dataframe ( data ) alpha = 0. 75 df ['ema'] = df ['sp500']. ewm ( span = 2 / alpha - 1, adjust = false ). mean ( ) print ( df ['ema'] ) the resulting output will look like this : 0 1848. 360000 1 2006. 265000 2 2034. 521250 3 2187. 752812 4 2552. 145703 5 2518. 173926 6 3052. 628481 7 3580. ... | openstax_principles-of-data-science-web | [
0.02184971049427986,
0.007931391708552837,
0.010166644118726254,
-0.019169840961694717,
-0.03975965455174446,
0.015377290546894073,
0.0025135010946542025,
-0.0060249026864767075,
-0.005966354627162218,
0.05309422314167023,
0.012006805278360844,
-0.024293838068842888,
0.00799098052084446,
-... |
4576. 634213 name : ema, dtype : float64 autoregressive integrated moving average ( arima ) in this section, we develop a very powerful tool that combines multiple models together and is able to capture trend and seasonality. the method is called autoregressive integrated moving average, or arima for short, and it cons... | openstax_principles-of-data-science-web | [
-0.004245562944561243,
0.058734480291604996,
-0.04100295156240463,
-0.013936983421444893,
0.0053454372100532055,
0.0026673635002225637,
-0.017988773062825203,
-0.03622716665267944,
0.04628528282046318,
0.10623549669981003,
0.024402737617492676,
0.0033749002031981945,
-0.003322249511256814,
... |
5. 3 • time series forecasting methods 251 which refers to a time series in which the variance is relatively constant over time, an overall upward or downward trend cannot be found, and no seasonal patterns exist. white noise is an example of a stationary time series ; however, the term stationary is a bit more general... | openstax_principles-of-data-science-web | [
-0.005926990881562233,
0.06245560199022293,
-0.004492084961384535,
-0.03478027507662773,
-0.01177749689668417,
-0.007010681089013815,
-0.01695152372121811,
-0.02984366938471794,
0.021343214437365532,
0.10324955731630325,
0.034288596361875534,
-0.011447601020336151,
-0.008619041182100773,
-... |
values of each weight c, but we do not need to delve into those specifics in this text as we will rely on software to do the work of finding the parameters for us. integrative component the “ i ” in arima stands for integrative, which is closely related to the word integral in calculus. now if you have seen some calcul... | openstax_principles-of-data-science-web | [
-0.013531500473618507,
0.03989141806960106,
-0.020453637465834618,
-0.010324112139642239,
-0.023647490888834,
0.005389229394495487,
0.006042202468961477,
-0.020969023928046227,
0.027741020545363426,
0.10608137398958206,
0.019099129363894463,
0.006400488782674074,
0.001792448223568499,
-0.0... |
). again, there are a multitude of parameters that need to be chosen in order for the model to make 252 5 • time series and forecasting access for free at openstax. org sense. we will rely on software to handle this in general. arima model in python the full arima model,, incorporates all three components — autoregress... | openstax_principles-of-data-science-web | [
0.005037570372223854,
0.024007346481084824,
-0.029974408447742462,
-0.0075783212669193745,
-0.010982012376189232,
-0.008463678881525993,
-0.008504088968038559,
0.0041419812478125095,
0.032601021230220795,
0.11148203909397125,
0.0005342545919120312,
-0.01976703479886055,
0.022582536563277245,... |
' adf statistic : ', result [ 0 ] ) print ('p - value : ', result [ 1 ] ) the resulting output will look like this : d = 0 adf statistic : - 1. 174289795062662 p - value : 0. 6845566772896323 d = 1 adf statistic : - 1. 7838215415905252 p - value : 0. 38852291349101137 python code | openstax_principles-of-data-science-web | [
0.011350981891155243,
-0.015401315875351429,
0.030559895560145378,
0.002197042340412736,
-0.026989564299583435,
-0.03822322189807892,
0.01890973374247551,
-0.014180746860802174,
0.019612371921539307,
0.05856141820549965,
0.009801947511732578,
-0.03460802510380745,
0.021148063242435455,
0.0... |
5. 3 • time series forecasting methods 253 d = 2 adf statistic : - 8. 578323839498081 p - value : 7. 852009937900099e - 14 here, a p - value of indicates that the second - order difference is stationary, so we will set in the arima model. an acf plot of the second difference can be used to determine. # import libraries... | openstax_principles-of-data-science-web | [
0.004638326354324818,
0.06076520308852196,
-0.010336510837078094,
-0.012799419462680817,
-0.011451140977442265,
-0.005449941381812096,
-0.009597635827958584,
-0.01717364974319935,
0.04468446597456932,
0.1049191951751709,
-0.008339278399944305,
-0.022540558129549026,
0.01520391646772623,
-0... |
arima ( df ['value'], order = ( p, d, q ) ) results = model. fit ( ) # make forecasts fc = results. forecast ( steps = 24 ) # plot the results plt. figure ( figsize = ( 10, 6 ) ) # plot original time series plt. plot ( df ['value'], label ='original time series') # plot fitted and forecasted values plt. plot ( results.... | openstax_principles-of-data-science-web | [
-0.004227871540933847,
-0.00949565414339304,
0.008912065997719765,
-0.024559304118156433,
-0.003781083971261978,
0.0012290960876271129,
-0.01456406619399786,
-0.006592756137251854,
0.0504225492477417,
0.07581053674221039,
-0.0025193740148097277,
-0.022594166919589043,
0.026186790317296982,
... |
5. 4 forecast evaluation methods learning outcomes by the end of this section, you should be able to : • 5. 4. 1 explain the nature of error in forecasting a time series. • 5. 4. 2 compute common error measures for time series models. • 5. 4. 3 produce prediction intervals in a forecasting example. a time series foreca... | openstax_principles-of-data-science-web | [
-0.01266935933381319,
0.05665430799126625,
-0.011868005618453026,
-0.033825889229774475,
-0.020936403423547745,
-0.02335767261683941,
-0.004215769935399294,
-0.0007681304705329239,
0.008796097710728645,
0.0945180207490921,
0.036185313016176224,
-0.0009551428374834359,
0.01253938302397728,
... |
build the model using only a portion of the known data, and then the model ’ s accuracy can be tested on the remaining data that was held out. to discuss the accuracy of a model, we should ask the complementary question : how far away are the predictions from the true values? in other words, we should try to quantify t... | openstax_principles-of-data-science-web | [
0.00826086476445198,
0.06969070434570312,
-0.012211764231324196,
-0.027760745957493782,
-0.019462736323475838,
0.029570605605840683,
0.021539928391575813,
-0.01782866008579731,
0.029674585908651352,
0.06364833563566208,
0.0020867239218205214,
0.016233133152127266,
0.013383230194449425,
-0.... |
should be used for data that is measured on a scale containing 0 and negative numbers. for example, it would not be wise to use mape or smape as a measure of error for a time series model of celsius temperature readings. for all of these measures of error, lower values indicate less error and hence more accuracy of the... | openstax_principles-of-data-science-web | [
0.005484397988766432,
0.070309117436409,
0.0008718800963833928,
-0.010325813665986061,
-0.04281860217452049,
0.02432585321366787,
0.018540440127253532,
-0.0322093591094017,
0.007991963066160679,
0.08079194277524948,
0.022347038611769676,
0.01470594760030508,
0.022829683497548103,
-0.041403... |
494827. 83 0. 187 0. 207 2021 4766. 18 3580. 21 1185. 97 1406524. 84 0. 249 0. 284 2022 3839. 5 4469. 69 630. 19 397139. 44 0. 164 0. 152 2023 4769. 83 3997. 05 772. 78 597188. 93 0. 162 0. 176 n / a n / a average : 453. 52 339008. 62 0. 127 | openstax_principles-of-data-science-web | [
0.015951666980981827,
0.022259213030338287,
-0.0060193040408194065,
0.013741828501224518,
-0.038112714886665344,
-0.0007829262176528573,
0.03795253485441208,
0.012247315607964993,
0.017263615503907204,
0.10231080651283264,
0.039078664034605026,
0.008282965049147606,
-0.025637703016400337,
... |
0. 137 table 5. 7 data needed to compute the mae, rmse, mape, and smape for ema smoothing model. ( predicted values are [ on average ] about 450 units away from true values. ). ( the errors between predicted and average values have a standard deviation of about 580 from the ideal error of 0. ). ( predicted values are [... | openstax_principles-of-data-science-web | [
-0.017186306416988373,
0.04996997490525246,
-0.016478225588798523,
-0.022240102291107178,
-0.028172528371214867,
-0.014334038831293583,
0.014917739666998386,
-0.019163968041539192,
0.00601572310552001,
0.09496695548295975,
0.03410080820322037,
-0.00347704766318202,
0.007260688114911318,
-0... |
org # # # please run all code from previous section before running this # # # # set alpha to 0. 2 for 80 % confidence interval forecast _ steps = 24 forecast _ results = results. get _ forecast ( steps = forecast _ steps, alpha = 0. 2 ) # extract forecast values and confidence intervals forecast _ values = forecast _ r... | openstax_principles-of-data-science-web | [
0.006900320760905743,
-0.0038421540521085262,
0.018861794844269753,
-0.028169261291623116,
-0.012229016982018948,
0.006136820185929537,
-0.010035991668701172,
-0.0037441819440573454,
0.03767095506191254,
0.053507864475250244,
0.008467568084597588,
-0.02898235432803631,
0.03830425813794136,
... |
5. 4 • forecast evaluation methods 259 the forecast data ( dashed curve ) is now surrounded by a shaded region. with 80 % probability, all future observations should fit into the shaded region. of course, the further into the future we try to go, the more uncertain our forecasts will be, which is indicated by the wider... | openstax_principles-of-data-science-web | [
-0.023199157789349556,
0.04700760543346405,
-0.015037489123642445,
0.0015542006585747004,
-0.011187862604856491,
0.00043187447590753436,
0.01335161179304123,
-0.02482696995139122,
0.028210926800966263,
0.09201879054307938,
0.021557997912168503,
-0.005209042690694332,
0.009848853573203087,
... |
measures of error ( or measures of fit ) the metrics used to assess how well a model's predictions align with observed data multiplicative decomposition time series decomposition into the product of its components naive ( or flat ) forecasting method using only the last observed value of a time series to predicting the... | openstax_principles-of-data-science-web | [
-0.032320111989974976,
0.03287224844098091,
0.0002912496856879443,
-0.020527826622128487,
0.004791992250829935,
0.010683838278055191,
0.016030726954340935,
-0.024697139859199524,
0.044991787523031235,
0.0777168944478035,
0.025290081277489662,
0.0172712504863739,
-0.0031805953476577997,
-0.... |
error ; 5 • key terms 261 terms in mathematics, the individual values of a sequence time series data that has a time component, or an ordered sequence of data points time series analysis the examination of data points collected at specific time intervals, enabling the identification of trends, patterns, and seasonal va... | openstax_principles-of-data-science-web | [
-0.0018693699967116117,
0.047510478645563126,
-0.0017759271431714296,
0.006364964880049229,
0.017969073727726936,
-0.004519440233707428,
-0.0013685410376638174,
-0.03614293783903122,
0.005796677432954311,
0.11565277725458145,
-0.005821160040795803,
-0.018458304926753044,
-0.01692852564156055... |
produce sma trendlines with window sizes 10, 30, 60, and 120. graph the trendlines on the same set of axes as the original graph and describe the results. what happens to the trendline as the window size increases? b. produce ema trendlines with and. graph the trendlines on the same set of axes as the original graph an... | openstax_principles-of-data-science-web | [
0.020119354128837585,
0.056434936821460724,
-0.015772052109241486,
-0.02168857306241989,
-0.010258193127810955,
0.0011733232531696558,
-0.03686096519231796,
0.0009156542946584523,
0.016624299809336662,
0.09091842919588089,
0.01764470338821411,
0.013665888458490372,
-0.001809080014936626,
-... |
the vital statistics of a cancer patient taken right before a major surgery ii. the monthly expenses of a small company recorded over a period of five years iii. daily temperature, rainfall, humidity, and wind speeds measured at a particular location over a few months iv. student final grades in all sections of a cours... | openstax_principles-of-data-science-web | [
0.010543259792029858,
0.050428468734025955,
0.004774698056280613,
-0.014823419973254204,
0.002308425959199667,
0.008097046986222267,
-0.009712472558021545,
-0.02811465784907341,
0.013752131722867489,
0.09581776708364487,
0.009516752324998379,
0.008613754995167255,
0.012932131998240948,
-0.... |
a seasonal variation in sales exists, what would be the most likely period of the seasonal variation? 2. consider the time series given in the table as shown. 264 5 • quantitative problems access for free at openstax. org month value 1 880. 7 2 727. 2 3 798. 5 4 504. 1 5 888. 4 6 725. 8 7 793. 4 8 499. 0 9 891. 7 10 72... | openstax_principles-of-data-science-web | [
-0.009853160008788109,
0.024353325366973877,
-0.010318300686776638,
0.012018757872283459,
-0.00043228676076978445,
-0.028549866750836372,
-0.0056752595119178295,
0.03715186566114426,
-0.008086022920906544,
0.10181333869695663,
0.0056227268651127815,
0.03610929101705551,
-0.028151370584964752... |
501. 6 table 5. 9 time series a. identify the period of the seasonal component. b. using a centered simple moving average ( sma ) of window size equal to the period you found in part a, identify a trend - cycle component,, in the data. c. detrend the data by subtracting the sma you found in part b. d. identify the seas... | openstax_principles-of-data-science-web | [
-0.014811353757977486,
0.04047444462776184,
-0.004790682811290026,
0.013079690746963024,
-0.017315424978733063,
-0.0029421879444271326,
-0.018084993585944176,
0.015289032831788063,
-0.010703559033572674,
0.08385930210351944,
-0.0027229944244027138,
0.01050350908190012,
-0.019199267029762268,... |
/ 9 / 2021 tuesday 5297 table 5. 10 sample of covid - 19 data cases within 23 days ( source : https : / / data. cdc. gov / case - surveillance ) a. what is the most appropriate window size to use for centered sma to address the issue of missing data in their analysis of covid - 19 data from the cdc? b. perform the sma ... | openstax_principles-of-data-science-web | [
0.017179977148771286,
0.022767366841435432,
0.0010329551296308637,
0.02825213596224785,
0.007197665516287088,
0.00011063383863074705,
-0.011304633691906929,
0.009134571067988873,
-0.017743472009897232,
0.07042544335126877,
-0.003530365414917469,
0.007296695839613676,
-0.0062082791700959206,
... |
of work " humanoid robot uprising " by steve jurvetson / flickr, cc by 2. 0 ) chapter outline 6. 1 what is machine learning? 6. 2 classification using machine learning 6. 3 machine learning in regression analysis 6. 4 decision trees | openstax_principles-of-data-science-web | [
0.011350052431225777,
0.013073909096419811,
-0.016259899362921715,
-0.03587920963764191,
0.031676847487688065,
-0.012012503109872341,
0.012976981699466705,
0.0007986261625774205,
-0.0028432244434952736,
0.06308097392320633,
-0.00034210036392323673,
0.02456599846482277,
-0.012071357108652592,... |
6. 5 other machine learning techniques introduction imagine a world in which your face is your passport. no need for keys, cards, or passwords ; your identity is simply your unique appearance. in this world, machine learning plays the role of gatekeeper, using the visible features of your face to identify you and grant... | openstax_principles-of-data-science-web | [
0.018344806507229805,
0.023013127967715263,
0.01861998625099659,
-0.028383666649460793,
0.012463918887078762,
-0.009549153968691826,
-0.004969770088791847,
-0.008892497047781944,
-0.015699103474617004,
0.05030549317598343,
0.005883532110601664,
-0.009976065717637539,
0.007703669834882021,
... |
6. 1 what is machine learning? learning outcomes by the end of this section, you should be able to : • 6. 1. 1 summarize the differences between supervised and unsupervised learning in machine learning. • 6. 1. 2 describe the roles of training and testing datasets. • 6. 1. 3 use common measures of accuracy and error to... | openstax_principles-of-data-science-web | [
0.003350274870172143,
0.004087545443326235,
-0.008813820779323578,
-0.04502482712268829,
0.007676030043512583,
-0.0027198120951652527,
-0.01147887110710144,
-0.02399972453713417,
-0.0021975175477564335,
0.05391022562980652,
0.031347911804914474,
0.017671724781394005,
-0.00023341475753113627,... |
learning life cycle typically follows these steps : 1. problem formulation / identification : clearly state the problem you want the model to solve. 2. data collection and preparation : collect relevant data and clean it for analysis. 3. feature selection / engineering : choose important aspects of the data for the mod... | openstax_principles-of-data-science-web | [
0.026040177792310715,
0.021817348897457123,
0.018280334770679474,
-0.023724021390080452,
-0.005436161532998085,
-0.018970564007759094,
-0.022783473134040833,
-0.02177666500210762,
-0.005272442940622568,
0.05351534113287926,
0.01996525004506111,
-0.0022406568750739098,
0.05890348553657532,
... |
making using machine learning basics access for free at openstax. org different kinds of tanks used by both countries. although the ml model produced very accurate results on the training and test sets, it performed terribly out in the field. apparently, most of the pictures of russian tanks were low quality and blurry... | openstax_principles-of-data-science-web | [
0.005277053453028202,
0.00036581119638867676,
-0.00428811414167285,
-0.029640424996614456,
0.0017610194627195597,
-0.02891494520008564,
0.0023182162549346685,
-0.028272904455661774,
-0.037828825414180756,
0.05211242288351059,
0.027087852358818054,
0.0006700361263938248,
0.04596924036741257,
... |
way may then be used to determine the best labels for future ( unlabeled ) data. supervised learning supervised learning is analogous to a student learning from an instructor. at first, the student may answer many questions incorrectly, but the instructor is there to correct the student each time. when the student give... | openstax_principles-of-data-science-web | [
-0.008024615235626698,
0.012254553847014904,
0.012955809943377972,
-0.028794817626476288,
0.006270313169807196,
-0.013196364045143127,
-0.023319188505411148,
-0.006892141420394182,
-0.008698955178260803,
0.03905489295721054,
0.03338675945997238,
0.007988997735083103,
0.036644212901592255,
... |
6. 1 • what is machine learning? 271 kinds of neural networks. linear regression may not seem like a machine learning algorithm because there are no correction steps. a formula simply produces the line of best fit. however, the regression formula itself represents an optimization that reduces the error in the values pr... | openstax_principles-of-data-science-web | [
-0.010480224154889584,
0.045694075524806976,
-0.007773440796881914,
-0.03602123260498047,
0.029026919975876808,
-0.0012148789828643203,
-0.02429424412548542,
-0.010073838755488396,
-0.012614420615136623,
0.08595249056816101,
0.030006639659404755,
0.022020379081368446,
0.006560454610735178,
... |
topics of pca and tda are outside the scope of this text. variations and hybrid models although we will only cover supervised and unsupervised models, it is important to note that there are some additional models of machine learning. when some of the data in a dataset has labels and some does not, a semi - supervised l... | openstax_principles-of-data-science-web | [
-0.0005169552750885487,
0.011068272404372692,
0.0124852005392313,
-0.03413603454828262,
0.001118078245781362,
-0.009637081064283848,
-0.0020835630130022764,
-0.0006652442971244454,
-0.019215501844882965,
0.05775491148233414,
-0.009863955900073051,
0.012998432852327824,
-0.004255860112607479,... |
maps. in practice, we do not expect that our model can capture the function with 272 6 • decision - making using machine learning basics access for free at openstax. org 100 % accuracy. instead, we should find a model such that predicted values are close enough to. in most cases, the metric we use to determine the fitn... | openstax_principles-of-data-science-web | [
0.011876794509589672,
0.054676249623298645,
0.005546852946281433,
-0.007198362145572901,
-0.006725516635924578,
-0.0031986425165086985,
0.013365279883146286,
-0.004591485485434532,
0.011023279279470444,
0.050374794751405716,
0.009213891811668873,
0.021092327311635017,
0.01526373066008091,
... |
positives. recall is the ratio of true positive predictions to the total number of actual positives ( true positive plus false negative predictions. this is useful when the response variable is true / false and we want to minimize false negatives. f1 score is a combination of precision and recall. 2. regression ( compa... | openstax_principles-of-data-science-web | [
0.004107857123017311,
0.06490673124790192,
0.010503171011805534,
-0.021592669188976288,
-0.022221345454454422,
0.005931995343416929,
0.008545715361833572,
-0.009168170392513275,
-0.012906430289149284,
0.052602142095565796,
0.00830638688057661,
0.034937839955091476,
0.0201317947357893,
-0.0... |
6. 1 • what is machine learning? 273 example 6. 1 problem a test for covid - 19 was applied to 1, 000 patients. two hundred thirty - five tested positive for covid - 19, while the remaining 765 tested negative. of those that tested positive, 198 turned out to carry the covid - 19 virus, and 37 did not have the virus. o... | openstax_principles-of-data-science-web | [
0.01691731996834278,
0.008741664700210094,
-0.006700186524540186,
0.01612924225628376,
-0.0012210068525746465,
-0.007978592067956924,
0.008401921950280666,
0.029432186856865883,
-0.010363198816776276,
0.0780172348022461,
0.019547369331121445,
-0.013424666598439217,
-0.002377387834712863,
0... |
training data : ( 9. 8, 83. 0 ), ( 8. 2, 87. 7 ), ( 5. 2, 61. 6 ), ( 8. 0, 77. 8 ), ( 2. 1, 42. 2 ), ( 6. 8, 62. 1 ), ( 2. 3, 30. 9 ), ( 9. 5, 94. 4 ) the linear regression model that best fits the training data is. ( see correlation and linear regression analysis for details on linear regression. ) we will compute mae... | openstax_principles-of-data-science-web | [
0.007669028826057911,
0.05981873720884323,
0.012893079780042171,
0.00539581011980772,
-0.052908025681972504,
-0.002903599990531802,
0.012445350177586079,
-0.018777288496494293,
0.006013805046677589,
0.06120821833610535,
0.0019049715483561158,
0.059689585119485855,
0.02554956264793873,
-0.0... |
5. 25 table 6. 1 test set • 274 6 • decision - making using machine learning basics access for free at openstax. org •, or 14. 3 % • mse for cubic model : • rmse for cubic model : the mae and rmse both show that the model ’ s predictions are off by an average of about 6. 2 points from actual values. the mape suggests t... | openstax_principles-of-data-science-web | [
0.021380634978413582,
0.040127500891685486,
0.024990199133753777,
-0.028844479471445084,
-0.008376835845410824,
-0.007952731102705002,
0.025255337357521057,
-0.025937514379620552,
0.004892266355454922,
0.06780309230089188,
0.050494901835918427,
0.007278477307409048,
0.0073867072351276875,
... |
training data ; however, such “ perfect ” models are usually terrible at making predictions about data not in the training set. it is best to explain this idea by example. suppose we want to create a model for the relationship between x and y based on the given dataset, how would we go about creating the model? we migh... | openstax_principles-of-data-science-web | [
0.02658727392554283,
0.02894159033894539,
0.025144249200820923,
-0.001916941604577005,
-0.01933738961815834,
0.021601837128400803,
0.018827734515070915,
0.01725837029516697,
0.04349253326654434,
0.05700181797146797,
0.04824616014957428,
0.017012404277920723,
0.007671135012060404,
-0.052809... |
6. 1 • what is machine learning? 275 figure 6. 3 data points along a cubic model and a linear model. the four data points in can be fitted onto a cubic curve ( 0 % error ), but it does poorly on additional data from the testing data,. the cubic curve overfits the training data. the regression line does not fit the trai... | openstax_principles-of-data-science-web | [
0.004744550213217735,
0.014918562024831772,
0.026319151744246483,
-0.03223292902112007,
-0.028329450637102127,
0.022414598613977432,
0.02140056900680065,
0.0012190632987767458,
0.05200522765517235,
0.06663979589939117,
0.05487794801592827,
0.037934690713882446,
-0.0041854544542729855,
-0.0... |
1. 2 table 6. 3 mape and rmse calculated for each model • mape for cubic model :, or • rmse for cubic model : • mape for linear model :, or • rmse for linear model : the mape and rmse values for the linear model are much lower than their respective values for the cubic model even though the latter predicts four values ... | openstax_principles-of-data-science-web | [
0.024943292140960693,
0.03912609815597534,
0.032640524208545685,
-0.03152560070157051,
-0.03869326040148735,
0.035049159079790115,
0.008619762025773525,
-0.016638265922665596,
0.023542022332549095,
0.06782808899879456,
0.05569910630583763,
0.05626819655299187,
0.0039788116700947285,
-0.070... |
1. 7 table 6. 4 homework set completion times solution there is a definitive downward trend in the data. a simple linear regression model for this data is : however, the line of best fit does not seem to fit the data all that well. there is no way that a linear function can bend the way the data points seem to do in th... | openstax_principles-of-data-science-web | [
0.04099996015429497,
0.008308329619467258,
0.011630197055637836,
-0.007346967700868845,
-0.015223633497953415,
-0.003827502951025963,
0.02389664389193058,
0.010719438083469868,
0.02547345496714115,
0.08754940330982208,
0.03342462703585625,
0.009451711550354958,
0.00578744662925601,
-0.0372... |
6. 2 classification using machine learning learning outcomes by the end of this section, you should be able to : • 6. 2. 1 perform logistic regression on datasets and interpret the results. • 6. 2. 2 perform k - means clustering on datasets. • 6. 2. 3 define the concept of density - based clustering and use dbscan on d... | openstax_principles-of-data-science-web | [
0.008243352174758911,
0.029758671298623085,
0.010314688086509705,
-0.029753142967820168,
-0.011512380093336105,
0.001923829666338861,
0.0037333290092647076,
0.010240817442536354,
-0.0013421237235888839,
0.06417883932590485,
0.021581722423434258,
-0.009639048017561436,
0.012569432146847248,
... |
##defined genres. alternatively, an unsupervised model such as k - means clustering could be used to group similar - sounding songs together without necessarily adhering to a concept of genre. this section will focus on logistic regression techniques and clustering algorithms such as k - means and dbscan. we ’ ll use m... | openstax_principles-of-data-science-web | [
0.03042633831501007,
0.05580391734838486,
0.018346039578318596,
-0.0026197682600468397,
0.0064732907339930534,
0.0061613693833351135,
-0.028626929968595505,
-0.008823542855679989,
0.0005534429801627994,
0.08103872090578079,
0.05536241456866264,
-0.007377201225608587,
0.006487888749688864,
... |
. as complicated as this formula may seem at first, it is built up from simple elements. the presence of suggests that there may be a linear regression lurking in the background. indeed, if we solve to find the inverse function of, we can use it to isolate, which in turns allows us to use standard linear regression tec... | openstax_principles-of-data-science-web | [
-0.01537378877401352,
0.03102337382733822,
-0.004332542885094881,
-0.024828720837831497,
0.0012300439411774278,
0.015653638169169426,
-0.036947719752788544,
0.06251548230648041,
0.013659371063113213,
0.05665032938122749,
0.07716474682092667,
0.010413776151835918,
-0.01336884219199419,
-0.0... |
6. 2 • classification using machine learning 279 in the final line, we used the power property of logarithms,, with power. the function we ’ ve just obtained is called the logit function. the key property of the logit function is that it is the inverse function of. recall from algebra, if is the inverse function of, th... | openstax_principles-of-data-science-web | [
0.022579243406653404,
0.016642635688185692,
-0.011269797571003437,
-0.021987581625580788,
0.004910237155854702,
-0.014935653656721115,
-0.011738722212612629,
0.033556681126356125,
-0.01239976566284895,
0.09219233691692352,
0.06771201640367508,
0.003973834216594696,
-0.003235539421439171,
-... |
). example 6. 4 problem at a particular college, it has been found that in - state students are more likely to graduate than out - of - state students. roughly 75 % of in - state students end up graduating, while only about 30 % of out - of - state students do so. build a discrete logistic regression model based on thi... | openstax_principles-of-data-science-web | [
0.038656771183013916,
-0.00426272489130497,
0.010836862958967686,
-0.019939225167036057,
0.005875842180103064,
-0.006463680416345596,
0.013095359317958355,
0.02330837771296501,
0.012339470908045769,
0.07787686586380005,
0.05600723251700401,
0.013889439404010773,
0.01703593134880066,
-0.028... |
model, the predicted likelihoods are,,, and. since and 2 have label 0, while and 4 have label 1, we compute : for model, the predicted likelihoods are,,, and. thus, model is the better of the two models on this data. how does one find the model that has maximum likelihood? the exact method for finding the coefficients ... | openstax_principles-of-data-science-web | [
0.033377427607774734,
-0.02651696465909481,
0.008443744853138924,
0.0030967409256845713,
0.017689285799860954,
0.002004065550863743,
0.005455071572214365,
0.020866503939032555,
-0.006540753412991762,
0.05445820093154907,
0.05468196049332619,
-0.004035219084471464,
0.014025349169969559,
-0.... |
0. 5 n table 6. 5 gpa vs. college completion data figure 6. 7 shows the data in graphical form. figure 6. 7 graph of gpa ( x - axis ) and college completion ( y - axis ). this uses values 0 for non - completion and 1 for completion. the graph suggests that higher gpas tend to predict completion of a degree. the logisti... | openstax_principles-of-data-science-web | [
0.023330947384238243,
-0.017750462517142296,
0.04426839202642441,
0.02463703230023384,
-0.007506557274609804,
-0.003496477846056223,
0.010760478675365448,
0.02294299565255642,
-0.0023318950552493334,
0.06958873569965363,
0.02186594530940056,
0.024881631135940552,
0.010259718634188175,
-0.0... |
build the logistic model lmodel = logisticregression ( ) lmodel. fit ( x, y ) # display the coefficients of the logistic regression ( a, b ) = ( lmodel. intercept _ [ 0 ], lmodel. coef _ [ 0, 0 ] ) print ( " coefficients : ", ( round ( a, 3 ), round ( b, 3 ) ) ) # display the accuracy of the model s = lmodel. score ( x... | openstax_principles-of-data-science-web | [
0.017261425033211708,
0.04213438555598259,
-0.003153773956000805,
-0.02156105451285839,
0.00986979715526104,
-0.0021693820599466562,
-0.027300022542476654,
0.00965900532901287,
0.021718377247452736,
0.06436696648597717,
0.005995995365083218,
0.013438607566058636,
-0.006089500151574612,
-0.... |
6. 2 • classification using machine learning 283 issue by iterating the algorithm through many values of and evaluating which k - value produced the best results. the trade - off is the time it takes to run the algorithm using multiple values of and interpreting the results using. the so - called elbow method is often ... | openstax_principles-of-data-science-web | [
0.0031755100935697556,
0.042117372155189514,
0.008726564235985279,
0.0035849737469106913,
0.0253650713711977,
-0.023732051253318787,
0.01580139808356762,
-0.0007312379311770201,
0.0007363261538557708,
0.07010314613580704,
0.034883949905633926,
-0.019028063863515854,
0.01219667587429285,
-0... |
is found by the formula values of lie between 1 and 1, with values close to 1 indicating well - separated clusters, values close to 0 indicating clusters are ambiguous, and values close to 1 indicating poor clustering with points assigned to clusters arbitrarily. fortunately, statistical software packages that can do k... | openstax_principles-of-data-science-web | [
0.004015384707599878,
0.026952968910336494,
0.024920769035816193,
-0.020967038348317146,
-0.030882319435477257,
-0.005163706839084625,
0.03297160193324089,
0.018685851246118546,
0.02185356430709362,
0.04522330313920975,
0.050802845507860184,
0.012982580810785294,
0.008976359851658344,
-0.0... |
##ids. to make things simple, we will just pick the first three data points ( 101. 7, 51. 1 ), ( 109. 2, 66. 7 ), and ( 33. 2, 54. 1 ), which we will color red, green, and blue, respectively. now color all the data points red, green, and blue according to which of these three points it lies closest to. the initial grou... | openstax_principles-of-data-science-web | [
0.019305741414427757,
-0.009245376102626324,
0.01945662871003151,
-0.002747846068814397,
-0.020507261157035828,
-0.02076052874326706,
0.010632171295583248,
0.00157523388043046,
0.007645118050277233,
0.07412918657064438,
-0.0032791513949632645,
0.03891061246395111,
0.02311377413570881,
0.00... |
6. 2 • classification using machine learning 285 figure 6. 10 graph with large dots indicating the initial choices of centroids. data points are colored according to which centroid they are closest to. next, we find the centroids of each of the colored groups. in practice, this is all done automatically by software, bu... | openstax_principles-of-data-science-web | [
0.012943209148943424,
0.003952357918024063,
0.02869499661028385,
0.013919055461883545,
0.00003198501144652255,
-0.022711463272571564,
-0.006069897208362818,
0.001380388392135501,
0.0007244230946525931,
0.047053221613168716,
0.016914002597332,
-0.005730433855205774,
0.021696176379919052,
-0... |
, the next iteration is stable. are the clusters where you thought they might end up? this example highlights the fact that k - means may be quite sensitive to initial choice of centroids. running the algorithm again with different initial centroids may produce different clusters, as figure 6. 12 shows. | openstax_principles-of-data-science-web | [
-0.013445542193949223,
0.027644507586956024,
0.023839512839913368,
-0.0033153232652693987,
-0.004652229603379965,
-0.03361569717526436,
-0.03336505964398384,
0.026103703305125237,
0.03076102025806904,
0.030212007462978363,
0.022555537521839142,
-0.011605261825025082,
0.017761558294296265,
... |
6. 2 • classification using machine learning 287 figure 6. 12 graph with different initial centroids. using initial centroids of ( 110, 70 ), ( 60, 80 ), and ( 40, 40 ), the k - means algorithm produces a different clustering. the final position of the centroids are ( 110. 2, 60. 5 ), ( 67. 0, 77. 2 ), and ( 32. 4, 46.... | openstax_principles-of-data-science-web | [
0.0032202284783124924,
0.004154719412326813,
0.021240949630737305,
-0.014089042320847511,
-0.003497765865176916,
-0.011766760610044003,
0.0029565971344709396,
-0.0013451633276417851,
0.008286654017865658,
0.06997267156839371,
0.027827197685837746,
-0.012941994704306126,
0.008215532638132572,... |
plt # # for data visualization from sklearn. cluster import kmeans from sklearn. metrics import silhouette _ score # read data data = pd. read _ csv ('funguslocations. csv'). dropna ( ) # build k - means model with 3 clusters km = kmeans ( n _ clusters = 3, n _ init ='auto') km. fit ( data ) # calculate silhouette scor... | openstax_principles-of-data-science-web | [
0.010933727957308292,
0.008933030068874359,
-0.0072260028682649136,
-0.03333144262433052,
-0.027927061542868614,
-0.0048371111042797565,
0.02396475151181221,
0.000023707845684839413,
0.006010846700519323,
0.051430247724056244,
0.008028589189052582,
-0.003982415422797203,
0.030428795143961906... |
6. 2 • classification using machine learning 289 with a silhouette score of about 0. 77, the separation of data points into three clusters seems appropriate. exploring further centroids versus other means instead of using centroids ( which are computed using arithmetic means, or averages ), other means may be employed,... | openstax_principles-of-data-science-web | [
0.0168769434094429,
0.014068081974983215,
0.02198428101837635,
0.004059629049152136,
-0.010777340270578861,
0.013782080262899399,
-0.015119817107915878,
-0.013175970874726772,
-0.012671628966927528,
0.08252949267625809,
0.034505683928728104,
0.003656603628769517,
0.006309670861810446,
-0.0... |
the dataset at all, then the parameters and will need to be adjusted. ) 2. add all core points that are close ( less than a distance of ) to the first point into the first cluster. keep adding to the cluster in this way until there are no more core points close enough to the first cluster. 3. if there are any core poin... | openstax_principles-of-data-science-web | [
0.0029109613969922066,
0.030580561608076096,
0.030635803937911987,
-0.00015734744374640286,
-0.00162320991512388,
-0.03573347255587578,
0.011936169117689133,
-0.004252187442034483,
-0.011912125162780285,
0.05703055486083031,
0.058456167578697205,
-0.00437187310308218,
0.04287935420870781,
... |
. 0, 4. 0 ) k : ( 12. 4, 5. 4 ) l : ( 13. 2, 2. 5 ) note : in practice, dbscan would never be done by hand, but the steps shown as follows illustrate how the | openstax_principles-of-data-science-web | [
0.02341867797076702,
0.02306336909532547,
0.05077637359499931,
-0.014592878520488739,
-0.037557803094387054,
-0.005930249113589525,
-0.007283027283847332,
-0.019899265840649605,
-0.01738305203616619,
0.0703052505850792,
0.05542195960879326,
-0.014922401867806911,
0.04829241335391998,
-0.02... |
6. 2 • classification using machine learning 291 algorithm works. figure 6. 14 displays the data. figure 6. 14 original dataset with 11 unlabeled points. the core points are those that have at least neighbors ( or, not counting the point itself ) within a distance of. the easiest way to determine core points would be t... | openstax_principles-of-data-science-web | [
-0.00344829517416656,
0.027695810422301292,
0.02933196723461151,
-0.02785010077059269,
-0.021956082433462143,
-0.025891540572047234,
0.004269497003406286,
0.002867197385057807,
-0.0010223984718322754,
0.07017327845096588,
0.024093637242913246,
0.029015785083174706,
0.019383905455470085,
-0... |
, f }, and cluster 2 consists of { h, j, k, l }. the results of dbscan clustering are shown in figure 6. 16. 292 6 • decision - making using machine learning basics access for free at openstax. org figure 6. 16 graph showing results of dbscan clustering. cluster 1 is in blue and cluster 2 is in red. dbscan in python th... | openstax_principles-of-data-science-web | [
-0.012431435286998749,
0.03056696429848671,
0.02276541106402874,
0.019485602155327797,
-0.03969186544418335,
-0.014588115736842155,
-0.02493848092854023,
0.008479774929583073,
0.00010848774400074035,
0.07261667400598526,
0.020668860524892807,
0.005063011310994625,
0.04526003450155258,
0.00... |
6. 2 • classification using machine learning 293 # visualize clusters import matplotlib. pyplot as plt # # for data visualization plt. scatter ( data ['x'], data ['y'], c = db. labels _ ) the resulting output will look like this : the confusion matrix when training and testing any algorithm that performs classification... | openstax_principles-of-data-science-web | [
0.0282151959836483,
0.009129194542765617,
0.010270155966281891,
-0.025903476402163506,
-0.005293280351907015,
-0.03178423270583153,
0.022986821830272675,
-0.020275497809052467,
0.03768882900476456,
0.04351559653878212,
0.007110309321433306,
0.025387421250343323,
0.02016313187777996,
-0.002... |
6. 6 displays the results in a confusion matrix : python code 294 6 • decision - making using machine learning basics access for free at openstax. org identified as a flower identified as a tree identified as a grass is a flower 23 3 9 is a tree 2 32 0 is a grass 12 1 18 table 6. 6 a confusion matrix for flowers, trees... | openstax_principles-of-data-science-web | [
0.02673574537038803,
-0.017099156975746155,
0.018387319520115852,
-0.02058119885623455,
-0.01907527819275856,
-0.016462480649352074,
0.04710705578327179,
0.010764309205114841,
0.030476640909910202,
0.05422065407037735,
0.06512429565191269,
0.005795294884592295,
-0.007307819090783596,
0.023... |
), the confusion matrix of course would have only four entries. there are special terms that apply to this case when the two classes are “ positive ” and “ negative. ” think of diagnosing a disease. either the patient has the disease or they do not. a doctor can perform a test, and the hope is that the test will determ... | openstax_principles-of-data-science-web | [
0.006225169636309147,
0.016099318861961365,
0.02818506769835949,
0.002800664398819208,
-0.0439113974571228,
-0.027440553531050682,
0.023115413263440132,
0.0016375923296436667,
-0.013282221741974354,
0.08477537333965302,
0.05654917657375336,
0.015294691547751427,
0.026219399645924568,
0.015... |
figure 6. 17 provides a heatmap for the flower / tree / grass example. | openstax_principles-of-data-science-web | [
-0.008603016845881939,
0.019454719498753548,
0.024785317480564117,
-0.026658086106181145,
-0.012996034696698189,
-0.023801514878869057,
0.0006986819789744914,
0.012666181661188602,
0.07494794577360153,
0.07621274888515472,
-0.006411413662135601,
0.023691440001130104,
0.025234177708625793,
... |
6. 2 • classification using machine learning 295 figure 6. 17 heatmap for flower / tree / grass example the darker shades indicate higher values. the main diagonal stands out with darker cells. this is to be expected if our classifier is doing its job. however, darker shades in cells that are off the main diagonal indi... | openstax_principles-of-data-science-web | [
0.027187475934624672,
0.007289208937436342,
0.031732186675071716,
-0.01457531563937664,
-0.011911858804523945,
-0.006978287827223539,
0.003751227166503668,
-0.00918616820126772,
0.020654987543821335,
0.06466560065746307,
0.03649007901549339,
0.013099946081638336,
0.025686515495181084,
0.00... |
##ssion ( ) model. fit ( x, y ) # generate model predictions y _ pred = model. predict ( x ) # generate the confusion matrix cf = confusion _ matrix ( y, y _ pred ) # plot the heatmap using seaborn and matplotlib sns. heatmap ( cf, annot = true, fmt ='d ', cmap ='blues ', cbar = true ) python code 296 6 • decision - ma... | openstax_principles-of-data-science-web | [
0.02699815109372139,
0.029192989692091942,
0.011106155812740326,
-0.011941317468881607,
-0.011860409751534462,
-0.0016110127326101065,
-0.023128880187869072,
0.0019106876570731401,
0.0072130062617361546,
0.06544879823923111,
0.032917920500040054,
0.006723990198224783,
0.021056057885289192,
... |
6. 3 machine learning in regression analysis learning outcomes by the end of this section, you should be able to : • 6. 3. 1 use bootstrapping to analyze variation in linear regression. • 6. 3. 2 outline assumptions relevant to a multiple linear regression. • 6. 3. 3 perform multiple linear regressions and analyze sign... | openstax_principles-of-data-science-web | [
0.013666174374520779,
0.04541260376572609,
0.02961905486881733,
-0.03982938826084137,
0.0030694727320224047,
0.029861297458410263,
-0.018482662737369537,
0.026407741010189056,
-0.0012893081875517964,
0.06453809887170792,
0.007058155257254839,
0.00555770518258214,
-0.024462733417749405,
-0.... |
6. 3 • machine learning in regression analysis 297 including how to perform these tasks in python. linear regression and bootstrapping the fundamentals of linear regression were presented in inferential statistics and regression analysis. while linear regression is a very powerful tool, it may suffer from inaccuracies ... | openstax_principles-of-data-science-web | [
0.01710994355380535,
0.03738784044981003,
0.017542313784360886,
-0.010443758219480515,
0.02529885806143284,
0.038230542093515396,
-0.014886325225234032,
0.037762608379125595,
0.01155904307961464,
0.0851411372423172,
0.011904585175216198,
-0.025771964341402054,
0.0017617946723476052,
-0.010... |
times. 4. the sets and represent distributions of possible values of the parameters and for the true linear fit,. 5. let and. these are the parameters we will chose for our ( bootstrapped ) linear regression,. 6. find the standard deviation of and as well in order to produce a confidence interval for each parameter. th... | openstax_principles-of-data-science-web | [
0.0326094813644886,
0.012142178602516651,
0.02637530118227005,
0.0067896111868321896,
0.0005726076196879148,
0.01924441009759903,
-0.004338437225669622,
0.016895003616809845,
0.008373254910111427,
0.06905678659677505,
-0.006450059823691845,
-0.007319632917642593,
0.013924278318881989,
-0.0... |
) y _ pred = model. predict ( x ) # visualizing the linear regression on the scatterplot plt. scatter ( x, y ) plt. plot ( x, y _ pred, color ='red') plt. show ( ) a = model. intercept _ b = model. coef _ print ( " linear model : y = % 1. 3f + % 2. 3f x " % ( a, b ) ) the resulting output will look like this : linear m... | openstax_principles-of-data-science-web | [
0.008147063665091991,
-0.010083611123263836,
0.0018992837285622954,
-0.013170008547604084,
-0.015636447817087173,
0.004083606880158186,
0.015177219174802303,
0.01864541321992874,
0.026808174327015877,
0.024747293442487717,
0.017072288319468498,
0.010942494496703148,
0.00486736698076129,
0.... |
6. 3 • machine learning in regression analysis 299 then, the set is resampled 50 times, using 100 data points each time. a linear regression is run each time, producing a set of 50 values of and 50 values of. all 50 regression lines are shown on the same graph. from sklearn. utils import resample data. plot. scatter ( ... | openstax_principles-of-data-science-web | [
0.006955233868211508,
0.04026913270354271,
0.010491931810975075,
-0.019009826704859734,
-0.012975369580090046,
-0.0033096312545239925,
-0.0035750283859670162,
0.013202042318880558,
-0.015717685222625732,
0.0809159204363823,
0.008735227398574352,
0.004932603798806667,
0.009794843383133411,
... |
##s ) b _ bar = stats. mean ( slopes ) b _ std = stats. stdev ( slopes ) print ( " intercept : mean = % 1. 3f, st. dev. = % 1. 3f " % ( a _ bar, a _ std ) ) print ( " slope : mean = % 1. 3f, st. dev. = % 1. 3f " % ( b _ bar, b _ std ) ) the resulting output will look like this : intercept : mean = 4. 947, st. dev. = 0.... | openstax_principles-of-data-science-web | [
0.013751937076449394,
0.02875949628651142,
0.00918340589851141,
-0.028408648446202278,
-0.014296524226665497,
-0.004440779332071543,
0.02337920106947422,
0.04574925824999809,
-0.011033452115952969,
0.06077927350997925,
0.007833743467926979,
-0.015961751341819763,
0.022050822153687477,
-0.0... |
6. 3 • machine learning in regression analysis 301 confidence interval for both parameters. recall that the 95 % confidence interval is found at plus or minus, where is the standard deviation ( see bootstrapping methods ). this can be done in python using the scipy. stats package. import scipy. stats as st import numpy... | openstax_principles-of-data-science-web | [
0.03005920723080635,
0.05921972915530205,
0.0032172733917832375,
-0.01641988568007946,
-0.017082400619983673,
-0.015155681408941746,
0.03147735446691513,
0.024322278797626495,
0.0011864681728184223,
0.06645383685827255,
0.0007183795678429306,
-0.015355334617197514,
-0.007902272045612335,
-... |
techniques, which use more than one input variable. in this section, we focus on two main concepts : multiple linear regression and multiple logistic regression. multiple linear regression a model for multiple linear regression involves some number of predictor variables, which we will label. here, we are using capital... | openstax_principles-of-data-science-web | [
0.025856269523501396,
0.04241626709699631,
0.01572505198419094,
-0.013026993721723557,
-0.018043041229248047,
0.01905413717031479,
0.014309677295386791,
0.021373996511101723,
0.01644323393702507,
0.09056781977415085,
0.023277070373296738,
-0.006222584284842014,
-0.013949871063232422,
-0.04... |
. if these assumptions are not met, then a more flexible model would be required. 3. there should be a linear relationship between and for each, regarding the other variables as constant. this can be checked by running simple linear regressions on the pair for each and verifying linearity. 4. the data should not have m... | openstax_principles-of-data-science-web | [
0.027755368500947952,
0.018717175349593163,
0.010214930400252342,
-0.010566411539912224,
-0.023837639018893242,
0.027442065998911858,
0.006392891518771648,
0.023441003635525703,
0.020335588604211807,
0.059737928211688995,
-0.0009790792828425765,
-0.04123150184750557,
-0.00028126267716288567,... |
pd. read _ csv ('ncaa - 2021 - stats. csv') data = data. drop ( ['seed'], axis = 1 ). dropna ( ) # # remove the seed column x = data [ ['barthag ','wab'] ] # feature list y = data [ ['w'] ] # response variable # create the multiple linear regression model model = linearregression ( ) python code 6. 3 • machine learning... | openstax_principles-of-data-science-web | [
0.003517328528687358,
0.007986009120941162,
0.031827881932258606,
-0.005388763267546892,
-0.02658265456557274,
0.02518204040825367,
-0.015807699412107468,
0.03101339004933834,
0.013924265280365944,
0.06733506917953491,
-0.0029570485930889845,
0.0064719975925982,
-0.01733863539993763,
-0.04... |
0. 58 according to the output, the multiple regression equation for this model is : we can see that both barthag and wab have positive coefficients, and so as either variable increases, there is a corresponding increase in w. the r - squared score indicates that about 58 % of the total variance in w is due to barthag a... | openstax_principles-of-data-science-web | [
0.02823188528418541,
0.036785174161195755,
0.007825934328138828,
0.028253573924303055,
-0.015342088416218758,
-0.00641907611861825,
-0.01012877095490694,
0.00620346050709486,
-0.009991535916924477,
0.05151275917887688,
-0.013309665024280548,
-0.02169222943484783,
0.008097331039607525,
-0.0... |
wab into the multiple regression formula discussed previously in the chapter. we also include the regression plane. the python code required to create the regression plane is somewhat involved, requiring another package, numpy ( https : / / openstax. org / r / numpy ), to help create a mesh grid of points, so don ’ t w... | openstax_principles-of-data-science-web | [
0.04971032962203026,
0.027998311445116997,
-0.005033107474446297,
-0.02194795198738575,
0.007436216343194246,
-0.023147210478782654,
-0.0004361277970019728,
0.03339162468910217,
0.0037615380715578794,
0.04210200533270836,
0.004537512082606554,
-0.04585941135883331,
0.006254053674638271,
-0... |
6. 3 • machine learning in regression analysis 305 x2 _ space = np. linspace ( x2min, x2max, 100 ) x1, x2 = np. meshgrid ( x1 _ space, x2 _ space ) # use the regression equation to find z - values z = b + a1 * x1 + a2 * x2 # plot the regression plane ax. set _ xlabel ('barthag') ax. set _ ylabel ('wab ', rotation = 45 ... | openstax_principles-of-data-science-web | [
0.009508891962468624,
0.01842772401869297,
0.03688525781035423,
-0.006114702206104994,
0.010682530701160431,
-0.037126678973436356,
-0.009244296699762344,
-0.009817191399633884,
-0.008502461947500706,
0.051516659557819366,
-0.004550064913928509,
0.010136689990758896,
-0.0015318394871428609,
... |
0 ] ], [ x2. values [ i, 0 ], x2. values [ i, 0 ] ], [ y. values [ i, 0 ], y _ pred [ i, 0 ] ], c ='g ', linewidth = 1 ) # plot the regression plane ax. set _ xlabel ('barthag') ax. set _ ylabel ('wab ', rotation = 45 ) ax. set _ zlabel ('w') ax. set _ title ('multiple linear regression') ax. set _ box _ aspect ( aspec... | openstax_principles-of-data-science-web | [
0.020986825227737427,
0.007443764712661505,
-0.0035543711856007576,
-0.002479415386915207,
-0.017406675964593887,
-0.008247227407991886,
-0.038022320717573166,
0.001458245562389493,
0.008837014436721802,
0.01229673158377409,
-0.004637254402041435,
0.00576064782217145,
0.02013365924358368,
... |
6. 3 • machine learning in regression analysis 307 x = data [ ['barthag ','wab ','tor'] ] # feature list y = data [ ['w'] ] # response variable # create the multiple linear regression model model = linearregression ( ) model. fit ( x, y ) b = model. intercept _ [ 0 ] a1, a2, a3 = model. coef _ [ 0 ] print ( " intercept... | openstax_principles-of-data-science-web | [
0.011161623522639275,
0.02173306606709957,
0.006411874201148748,
-0.006584366783499718,
-0.015969891101121902,
0.01927296631038189,
-0.02939809486269951,
0.02280648984014988,
0.008333388715982437,
0.08043339103460312,
0.007489851210266352,
0.010356603190302849,
-0.009222359396517277,
-0.06... |
0. 59 the formula now expands to : the r - squared measure has increased slightly to 0. 59, meaning that the new model explains a bit more of the variance. however, the small increase in prediction accuracy comes at a cost of adding complexity to the model. simpler models tend to do better at avoiding overfitting in pr... | openstax_principles-of-data-science-web | [
0.04167256876826286,
0.0435863621532917,
0.007743543945252895,
-0.0006154658040031791,
-0.033287517726421356,
-0.0061937798745930195,
0.013638019561767578,
-0.002502812771126628,
0.022987477481365204,
0.06193683668971062,
0.05739055201411247,
-0.005481910426169634,
-0.00263071246445179,
-0... |
data visualization import seaborn as sns # # for heatmap visualization from sklearn. linear _ model import logisticregression from sklearn. metrics import confusion _ matrix # read data data = pd. read _ csv ('collegecompletiondata. csv'). dropna ( ) x = data [ ['gpa ','in _ state'] ] y = data ['completion'] # build th... | openstax_principles-of-data-science-web | [
0.027032917365431786,
0.02855299971997738,
0.018879545852541924,
-0.00625094398856163,
-0.012428869493305683,
0.012715077959001064,
-0.017671188339591026,
-0.0025445392820984125,
0.0013243552530184388,
0.06848540902137756,
0.017837101593613625,
0.005579123739153147,
0.026482608169317245,
-... |
6. 4 decision trees learning outcomes by the end of this section, you should be able to : • 6. 4. 1 measure information using entropy. • 6. 4. 2 understand how entropy can be used to classify data. • 6. 4. 3 build a top - down decision tree classifier. • 6. 4. 4 use decision trees to classify data and make predictions.... | openstax_principles-of-data-science-web | [
0.010189907625317574,
-0.0013117355993017554,
-0.004635309334844351,
-0.022284196689724922,
-0.014566163532435894,
0.0026805768720805645,
-0.009630783461034298,
0.01734146475791931,
-0.0074223121628165245,
0.07418474555015564,
0.03070909157395363,
-0.0086186109110713,
-0.004897576291114092,
... |
through a dense forest. their flexibility lies mainly in their nonlinear nature. instead of trying to fit data to a linear model or some other rigid structure, the decision tree classifies data using a series of choices that depend on other choices, which may in turn depend on other choices, etc. in this section, we wi... | openstax_principles-of-data-science-web | [
0.01823061890900135,
0.007356205023825169,
0.035465486347675323,
-0.004971423652023077,
-0.0032178217079490423,
-0.023943329229950905,
0.0028465630020946264,
-0.020714497193694115,
-0.027458759024739265,
0.07536377012729645,
0.04982203617691994,
-0.05696972459554672,
-0.007609781809151173,
... |
or tails ) to knowing the outcome ( heads, for instance ). to measure the number of bits of a whole number, you would use the base - 2 logarithm ( ), so it may not come as a surprise to learn that the base - 2 logarithm plays a huge role in | openstax_principles-of-data-science-web | [
0.03070509433746338,
0.012056602165102959,
-0.0015788439195603132,
-0.028684906661510468,
-0.0297353807836771,
-0.05222310870885849,
0.004850816912949085,
-0.005666445940732956,
-0.009968782775104046,
0.08395221084356308,
0.04999345913529396,
-0.019672788679599762,
-0.01379912905395031,
0.... |
6. 4 • decision trees 311 measuring information. the information of an event with probability is. recall that probabilities are always between 0 and 1, and if, then by properties of logarithms, we would have. this explains the negative sign that appears in the formula, as it makes sense to measure information with a po... | openstax_principles-of-data-science-web | [
0.01570035330951214,
0.028509996831417084,
0.017662201076745987,
-0.04748659208416939,
0.009775820188224316,
-0.038433220237493515,
0.013738727197051048,
-0.004615857731550932,
-0.02017289400100708,
0.08931200206279755,
0.044133901596069336,
-0.0397372804582119,
-0.002033726777881384,
0.00... |
as we shall see in the next section. building a decision tree suppose that you wish to classify data into some number of categories based on values of its features ( inputs ). we will assume that you have plenty of labeled data to train on. for the purposes of illustration, let ’ s say that your data consists of a set ... | openstax_principles-of-data-science-web | [
0.01048065721988678,
0.009203674271702766,
0.001962403068318963,
-0.03165699541568756,
0.014125164598226547,
-0.0010934480233117938,
0.004913695622235537,
0.01659843511879444,
0.025317659601569176,
0.05318280681967735,
0.018113045021891594,
-0.0024623465724289417,
0.016904983669519424,
-0.... |
. in order to capture this feature, you will need a more flexible tool than linear or logistic regression. we will set up a decision tree! as discussed earlier, a decision tree is a classification algorithm that builds a hierarchical structure where each internal node represents a decision based on a feature of the dat... | openstax_principles-of-data-science-web | [
-0.006801930721849203,
0.03126830235123634,
0.01581050269305706,
-0.018023088574409485,
0.01729736104607582,
-0.014158245176076889,
0.000551423872821033,
0.01998063363134861,
0.0224631167948246,
0.047971177846193314,
0.06278885900974274,
-0.034857142716646194,
0.02474440261721611,
0.001954... |
6. 4 • decision trees 313 example, there are 10 red points and 9 blue points. consider this as a set with uncertainty of containing red or blue points. the probabilities of each case are and. the total entropy of the root note is thus : this is very close to the entropy of a coin toss. we need to separate points based ... | openstax_principles-of-data-science-web | [
0.008046502247452736,
0.025282414630055428,
0.003994770348072052,
-0.012077693827450275,
-0.03959774971008301,
-0.005526046734303236,
-0.015511578880250454,
0.03389839082956314,
0.0007549462607130408,
0.07108156383037567,
0.04844551905989647,
-0.009137844666838646,
0.009712031111121178,
-0... |
this is not difficult for a computer to do, as there are only finitely many points, hence only finitely many ways to split into subsets. for comparison, we will do one more, using the other feature. split on ( which is halfway between two adjacent y values, 13 and 14. 5 ). now l = { 9 red, 6 blue }, and r = { 0 red, 4 ... | openstax_principles-of-data-science-web | [
0.010647162795066833,
0.007028869818896055,
0.02652549557387829,
-0.02097979187965393,
-0.009399515576660633,
-0.01981401816010475,
0.006929715629667044,
0.038858819752931595,
-0.006854494102299213,
0.0700913593173027,
0.043893590569496155,
-0.013440361246466637,
0.010793917812407017,
-0.0... |
nodes. the number of levels, or length of the longest branch in a decision tree, is known as its depth. so this tree has a depth of 7. however, | openstax_principles-of-data-science-web | [
0.02969617024064064,
-0.013569607399404049,
0.021018510684370995,
-0.02949451096355915,
0.020644644275307655,
0.0048315622843801975,
0.02753513678908348,
0.013706913217902184,
-0.023960070684552193,
0.0580139122903347,
0.022451922297477722,
-0.0021416761446744204,
-0.0261208638548851,
-0.0... |
6. 4 • decision trees 315 the last few levels of the tree may in fact be overfitting on the training data. in the next section we will find out how to test and use decision trees and explore ways to reduce their overfitting variance by pruning and other methods. using a decision tree to predict once you have created a ... | openstax_principles-of-data-science-web | [
-0.004907676950097084,
0.01476294919848442,
0.038155119866132736,
-0.016693904995918274,
0.021450066938996315,
-0.02347344346344471,
0.022419236600399017,
0.017266321927309036,
0.03490384668111801,
0.058065108954906464,
0.010187356732785702,
-0.02391543798148632,
0.03036535531282425,
0.018... |
data. think of our dataset s as a random sample of points taken from a larger population of points. there could have been noise, outliers, and other factors present in our sample that cause m to give spurious predictions. in order to evaluate the predictive power of a decision tree, we should try it out on a testing se... | openstax_principles-of-data-science-web | [
-0.005250944755971432,
-0.00018938083667308092,
0.035450343042612076,
-0.017407765612006187,
0.005460902117192745,
-0.01011674851179123,
0.031685721129179,
0.005284248385578394,
0.022382065653800964,
0.042168229818344116,
0.03059229627251625,
-0.013349159620702267,
0.031054619699716568,
0.... |
10. 2 red blue table 6. 8 test points solution according to this table, m was correct 2 out of 3 times, so the accuracy is. pruning, depth - limiting, and other methods for reducing variance decision trees often suffer from overfitting ( high variance ), which adversely affects their accuracy. fortunately, there are a ... | openstax_principles-of-data-science-web | [
0.02155642956495285,
0.01565760187804699,
0.024365274235606194,
-0.014044124633073807,
-0.008572008460760117,
-0.009540720842778683,
0.028296200558543205,
-0.017279354855418205,
0.0033443921711295843,
0.060117416083812714,
0.051453568041324615,
-0.025280501693487167,
-0.013685312122106552,
... |
branches that split the data into sets l and r in which one of l or r is a singleton ( or below a predefined proportion of the original set ). then the node becomes a leaf consisting of data having multiple labels. the label of this new leaf is determined by majority vote. that is, the label that occurs most often beco... | openstax_principles-of-data-science-web | [
0.005970652215182781,
-0.0060845292173326015,
0.01910058967769146,
0.014586488716304302,
-0.014476684853434563,
-0.015921877697110176,
0.01747981272637844,
0.010784176178276539,
0.018653588369488716,
0.039667483419179916,
0.036542948335409164,
-0.012687458656728268,
0.013847890309989452,
0... |
6. 4 • decision trees 317 shown in figure 6. 22 and figure 6. 23. note that the pruned tree has a depth of 4, which is quite a bit smaller than the original tree ’ s depth of 7. figure 6. 22 flowchart for pruned decision tree from example 6. 10 figure 6. 23 regions of the plane corresponding to pure nodes for the prune... | openstax_principles-of-data-science-web | [
0.03407065197825432,
-0.02349487692117691,
0.02312498167157173,
-0.013467925600707531,
-0.005029084160923958,
-0.04299364611506462,
0.01579471491277218,
0.029676251113414764,
-0.004289937671273947,
0.062349483370780945,
0.03874203562736511,
-0.011935808695852757,
0.0006598884356208146,
0.0... |
10. 2 red red table 6. 9 reclassified test points now we find the model to be 100 % accurate on the testing data. ( of course, a model trained on real - world data with many more data points cannot possibly attain 100 % accuracy, but this is possible on very small datasets. ) note that the model ’ s accuracy on the ori... | openstax_principles-of-data-science-web | [
0.018103955313563347,
-0.015651069581508636,
0.033394843339920044,
-0.012216652743518353,
-0.008230670355260372,
-0.01367587223649025,
0.0020184277091175318,
-0.0021506419871002436,
0.00781495962291956,
0.04801398143172264,
0.05191339552402496,
-0.00914786383509636,
0.017917873337864876,
0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.