id
int64
0
25.6k
text
stringlengths
0
4.59k
16,700
the big data ecosystem and data science apache mapreduce hdfshadoop file system apache pig red hat glusterfs quantcast filesystem jaql distributed filesystem distributed programming ceph filesystem apache hama graphbuilder others mahout weka onyx oozie falcon netflix pigpen apache twill tika giraph apache spark schedul...
16,701
data science in big data world distributed programming framework once you have the data stored on the distributed file systemyou want to exploit it one important aspect of working on distributed hard disk is that you won' move your data to your programbut rather you'll move your program to the data when you start from ...
16,702
nltk or natural language toolkit--as the name suggestsits focus is working with natural language it' an extensive library that comes bundled with number of text corpuses to help you model your own data pylearn --another machine learning toolbox but bit less mature than scikit-learn tensorflow-- python library for deep ...
16,703
data science in big data world graph databases--not every problem is best stored in table particular problems are more naturally translated into graph theory and stored in graph databases classic example of this is social network scheduling tools scheduling tools help you automate repetitive tasks and trigger jobs base...
16,704
an introductory working example of hadoop we'll end this with small application in big data context for this we'll use hortonworks sandbox image this is virtual machine created by hortonworks to try some big data applications on local machine later on in this book you'll see how juju eases the installation of hadoop on...
16,705
data science in big data world press ctrl+ and select the virtual image from hortonworks click next click importafter little time your image should be imported now select your virtual machine and click run give it little time to start the centos distribution with the hadoop installation runningas shown in figure notice...
16,706
an introductory working example of hadoop figure the hortonworks sandbox welcome screen available at figure list of available tables in hcatalog
16,707
data science in big data world figure the contents of the table to see the contents of the dataclick the browse data button next to the sample_ entry to get the next screen (figure this looks like an ordinary tableand hive is tool that lets you approach it like an ordinary database with sql that' rightin hive you get y...
16,708
figure you can execute hiveql command in the beeswax hiveql editor behind the scenes it' translated into mapreduce job figure the logging shows that your hiveql is translated into mapreduce job notethis log was from the february version of hdpso the current version might look slightly different
16,709
data science in big data world figure the end resultan overview of the average salary by profession after while the result appears great workthe conclusion of thisas shown in figure is that going to medical school is good investment surprisedwith this table we conclude our introductory hadoop tutorial although this was...
16,710
even though the data science process isn' linear it can be divided into steps setting the research goal gathering data data preparation data exploration modeling presentation and automation the big data landscape is more than hadoop alone it consists of many different technologies that can be categorized into the follo...
16,711
this covers understanding the flow of data science process discussing the steps in data science process the goal of this is to give an overview of the data science process without diving into big data yet you'll learn how to work with big data setsstreaming dataand text data in subsequent overview of the data science p...
16,712
data science process define research goal setting the research goal create project charter data retrieval internal data retrieving data data ownership external data errors from data entry physically impossible values missing values data cleansing outliers spacestyposerrors against codebook aggregating data data prepara...
16,713
the data science process data owner the result is data in its raw formwhich probably needs polishing and transformation before it becomes usable now that you have the raw datait' time to prepare it this includes transforming the data from raw form into data that' directly usable in your models to achieve thisyou'll det...
16,714
dividing project into smaller stages also allows employees to work together as team it' impossible to be specialist in everything you' need to know how to upload all the data to all the different databasesfind an optimal data scheme that works not only for your application but also for other projects inside your compan...
16,715
the data science process data science process define research goal setting the research goal retrieving data create project charter data preparation data exploration data modeling presentation and automation figure step setting the research goal questions (whatwhyhowis the goal of the first phaseso that everybody knows...
16,716
step retrieving data project charter requires teamworkand your input covers at least the followinga clear research goal the project mission and context how you're going to perform your analysis what resources you expect to use proof that it' an achievable projector proof of concepts deliverables and measure of success ...
16,717
the data science process start with data stored within the company your first act should be to assess the relevance and quality of the data that' readily available within your company most companies have program for maintaining key dataso much of the cleaning work may already be done this data can be stored in official...
16,718
table list of open-data providers that should get you started open data site description data gov the home of the us government' open data the home of the european commission' open data freebase org an open database that retrieves its information from sites like wikipediamusicbrainsand the sec archive data worldbank or...
16,719
the data science process data science process setting the research goal retrieving data errors from data entry physically impossible values missing values data cleansing outliers spacestyposerrors against codebook aggregating data data preparation extrapolating data data transformation derived measures creating dummies...
16,720
data for grantedlike saying that person' age is greater than years the second type of error points to inconsistencies between data sources or against your company' standardized values an example of this class of errors is putting "femalein one table and "fin another when they represent the same thingthat the person is ...
16,721
the data science process single outlier can throw off regression estimate distance regression line influenced by outlier xx xx xxx xx xx xx xx xx xxx xxx xx xx xxxx xx xxx xx xxx xx xxx normal regression line row number figure the encircled point influences the model heavily and is worth investigating because it can po...
16,722
most errors of this type are easy to fix with simple assignment statements and if-thenelse rulesif ="godo" "goodif ="bade" "badredundant whitespace whitespaces tend to be hard to detect but cause errors like other redundant characters would who hasn' lost few days in project because of bug that was caused by whitespace...
16,723
the data science process expected distribution frequency - - - distribution with outliers frequency - figure distribution plots are helpful in detecting outliers and helping you understand the variable it shows most cases occurring around the average of the distribution and the occurrences decrease when further away fr...
16,724
step cleansingintegratingand transforming data table an overview of techniques to handle missing data technique advantage disadvantage omit the values easy to perform you lose the information from an observation set value to null easy to perform not every modeling technique and/or implementation can handle null values ...
16,725
the data science process different units of measurement when integrating two data setsyou have to pay attention to their respective units of measurement an example of this would be when you study the prices of gasoline in the world to do this you gather data from different data providers data sets can contain prices pe...
16,726
fixing the data as soon as it' captured is nice in perfect world sadlya data scientist doesn' always have say in the data collection and simply telling the it department to fix certain things may not make it so if you can' correct the data at the sourceyou'll need to handle it inside your code data manipulation doesn' ...
16,727
the data science process client item month client region john doe coca-cola january john doe ny jackie qi pepsi-cola january jackie qi nc client item month region john doe coca-cola january ny jackie qi pepsi-cola january nc figure joining two tables on the item and region keys are called primary keys one table may hav...
16,728
step cleansingintegratingand transforming data using views to simulate data joins and appends to avoid duplication of datayou virtually combine data with views in the previous example we took the monthly data and combined it in new physical table the problem is that we duplicated the data and therefore needed more stor...
16,729
the data science process product class product sales in sales - in growth sales by product class rank sales ( -yy ax nx sport sport - sport sport - shoes shoes figure growthsales by product classand rank sales are examples of derived and aggregate measures product sold/total quantity soldtend to outperform models that ...
16,730
step cleansingintegratingand transforming data transforming the input variables greatly simplifies the estimation problem other times you might want to combine two variables into new variable reducing the number of variables sometimes you have too many variables and need to reduce the number because they don' add new i...
16,731
the data science process key values it also shows how two variables account for of the variation within the data set (component component %these variablescalled "component and "component ,are both combinations of the original variables they're the principal components of the underlying data structure if it isn' all tha...
16,732
understanding of the content of the data and the relationships between the variables and observationswe explore this in the next section step exploratory data analysis during exploratory data analysis you take deep dive into the data (see figure information becomes much easier to grasp when shown in picturetherefore yo...
16,733
the data science process year year density - figure from top to bottoma bar charta line plotand distribution are some of the graphs used in exploratory analysis
16,734
step exploratory data analysis these plots can be combined to provide even more insightas shown in figure overlaying several plots is common practice in figure we combine simple graphs into pareto diagramor - diagram figure shows another techniquebrushing and linking with brushing and linking you combine and link diffe...
16,735
the data science process countries countries country figure pareto diagram is combination of the values and cumulative distribution it' easy to see from this diagram that the first of the countries contain slightly less than of the total amount if this graph represented customer buying power and we sell expensive produ...
16,736
frequency age figure example histogramthe number of people in the agegroups of -year intervals the techniques we described in this phase are mainly visualbut in practice they're certainly not limited to visualization techniques tabulationclusteringand other modeling techniques can also be part of exploratory analysis e...
16,737
the data science process step build the models with clean data in place and good understanding of the contentyou're ready to build models with the goal of making better predictionsclassifying objectsor gaining an understanding of the system that you're modeling this phase is much more focused than the exploratory analy...
16,738
step build the models of what variables will help you construct good model many modeling techniques are availableand choosing the right model for problem requires judgment on your part you'll need to consider model performance and whether your project meets all the requirements to use your modelas well as other factors...
16,739
the data science process (target variablex (predictor variablefigure linear regression tries to fit line while minimizing the distance to each point okaywe cheated herequite heavily so we created predictor values that are meant to predict how the target variables behave for linear regressiona "linear relationbetween ea...
16,740
let' ignore most of the output we got here and focus on the most important partsmodel fit--for this the -squared or adjusted -squared is used this measure is an indication of the amount of variation in the data that gets captured by the model the difference between the adjusted -squared and the -squared is minimal here...
16,741
( -nearest neighbor figure the data science process ( -nearest neighbor ( -nearest neighbor -nearest neighbor techniques look at the -nearest point to make prediction let' try it in python code using the scikit learn libraryas in this next listing listing executing -nearest neighbor classification on semi-random data i...
16,742
step build the models predicted value actual value number of correctly predicted cases figure confusion matrixit shows how many cases were correctly classified and incorrectly classified by comparing the prediction with the real values remarkthe classes ( , , were added in the figure for clarification the confusion mat...
16,743
the data science process (if not the most popularprogramming languages for data science for more informationsee model diagnostics and model comparison you'll be building multiple models from which you then choose the best one based on multiple criteria working with holdout sample helps you pick the best-performing mode...
16,744
estimate the modelswe use randomly chosen observations out of , (or %)without showing the other of data to the model once the model is trainedwe predict the values for the other of the variables based on those for which we already know the true valueand calculate the model error with an error measure then we choose the...
16,745
the data science process if you've done this rightyou now have working model and satisfied stakeholdersso we can conclude this here summary in this you learned the data science process consists of six stepssetting the research goal--defining the whatthe whyand the how of your project in project charter retrieving data-...
16,746
this covers understanding why data scientists use machine learning identifying the most important python libraries for machine learning discussing the process for model building using machine learning techniques gaining hands-on experience with machine learning do you know how computers learn to protect you from malici...
16,747
machine learning what is machine learning and why should you care about it"machine learning is field of study that gives computers the ability to learn without being explicitly programmed --arthur samuel the definition of machine learning coined by arthur samuel is often quoted and is genius in its broadnessbut it leav...
16,748
identifying profitable customers (regression and classificationproactively identifying car parts that are likely to fail (regressionidentifying tumors and diseases (classificationpredicting the amount of money person will spend on product (regressionpredicting the number of eruptions of volcano in period (regressionpre...
16,749
machine learning the data modeling phase can' start until you have qualitative raw data you can understand but prior to thatthe data preparation phase can benefit from the use of machine learning an example would be cleansing list of text stringsmachine learning can group similar strings together so it becomes easier t...
16,750
the first type of package shown in figure is mainly used in simple tasks and when data fits into memory the second type is used to optimize your code when you've finished prototyping and run into speed or memory issues the third type is specific to using python with big data technologies packages for working with data ...
16,751
machine learning blaze --blaze gives you data structures that can be bigger than your computer' main memoryenabling you to work with large data sets dispy and ipcluster --these packages allow you to write code that can be distributed over cluster of computers pp --python is executed as single process by default with th...
16,752
recombines these features to achieve its predictions often you may need to consult an expert or the appropriate literature to come up with meaningful features certain features are the variables you get from data setas is the case with the provided data sets in our exercises and in most school exercises in practice you'...
16,753
machine learning training your model with the right predictors in place and modeling technique in mindyou can progress to model training in this phase you present to your model data from which it can learn the most common modeling techniques have industry-ready implementations in almost every programming languageinclud...
16,754
regularization you ask for model with as few predictors as possible this is important for the model' robustnesssimple solutions tend to hold true in more situations regularization aims to keep the variance between the coefficients of the predictors as small as possible overlapping variance between predictors makes it h...
16,755
machine learning semi-supervised learning techniques need labeled dataand therefore human interactionto find patterns in the data setbut they can still progress toward result and learn even if passed unlabeled data as well in this sectionwe'll look at all three approachessee what tasks each is more appropriate forand u...
16,756
types of machine learning introducing naive bayes classifiers in the context of spam filter not every email you receive has honest intentions your inbox can contain unsolicited commercial or bulk emailsa spam not only is spam annoyingit' often used in scams and as carrier for viruses kaspersky estimates that more than ...
16,757
machine learning working with images isn' much different from working with other data sets in the case of gray imageyou put value in every matrix entry that depicts the gray value to be shown the following code demonstrates this process and is step four of the data science processdata exploration listing step of the da...
16,758
types of machine learning figure we'll turn an image into something usable by the naive bayes classifier by getting the grayscale value for each of its pixels (shown on the rightand putting those values in list the previous code snippet shows the matrix of figure flattened (the number of dimensions was reduced from two...
16,759
step fit data machine learning gnb gaussiannb(fit gnb fit(x_train,y_trainpredicted fit predict(x_testconfusion_matrix(y_testpredictedstep create confusion matrix step select naive bayes classifieruse gaussian distribution to estimate probability step predict data for unseen data the end result of this code is called co...
16,760
types of machine learning the model was correct in ( + cases and incorrect in ( + casesresulting in ( correct/ total observations accuracy all the correctly classified observations are added up on the diagonal ( + while everything else ( + is incorrectly classified when the model only predicts two classes (binary)our c...
16,761
machine learning figure for each blurry image number is predictedonly the number is misinterpreted as then an ambiguous number is predicted to be but it could as well be even to human eyes this isn' clear with the bottom left number is ambiguouseven to humansis it or it' debatablebut the algorithm thinks it' by discern...
16,762
discerning simplified latent structure from your data not everything can be measured when you meet someone for the first time you might try to guess whether they like you based on their behavior and how they respond but what if they've had bad day up until nowmaybe their cat got run over or they're still down from atte...
16,763
machine learning table the first three rows of the red wine quality data set fixed volatile acidity acidity citric acid residual chlorides sugar free sulfur dioxide total sulfur dioxide density ph sulfates alcohol quality principal component analysis-- technique to find the latent variables in your data set while retai...
16,764
types of machine learning with the initial data preparation behind youyou can execute the pca the resulting scree plot (which will be explained shortlyis shown in figure because pca is an explorative techniquewe now arrive at step four of the data science processdata explorationas shown in the following listing listing...
16,765
machine learning one is at position zero on the axis)two variables will capture approximately more or totaland so on table shows you the full read-out table the findings of the pca number of variables extra information captured total data captured an elbow shape in the plot suggests that five variables can hold most of...
16,766
types of machine learning table how pca calculates the original variablescorrelation with latent variables fixed acidity volatile acidity citric acid residual sugar chlorides free sulfur dioxide total sulfur dioxide density ph sulphates alcohol - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - giving useable ...
16,767
machine learning comparing the accuracy of the original data set with latent variables now that we've decided our data set should be recoded into latent variables rather than the originalsit' time to see how well the new data set works for predicting the quality of wine when compared to the original we'll use the naive...
16,768
types of machine learning figure the results plot shows that adding more latent variables to model ( -axisgreatly increases predictive power ( -axisup to point but then tails off the gain in predictive power from adding variables wears off eventually the resulting plot is shown in figure the plot in figure shows that w...
16,769
machine learning figure the goal of clustering is to divide data set into "sufficiently distinctsubsets in this plot for instancethe observations have been divided into three clusters -means is good general-purpose algorithm with which to get started howeverlike all the clustering algorithmsyou need to specify the numb...
16,770
types of machine learning listing iris classification example print first observations of data frame to screennow we can clearly see variablessepal lengthsepal widthpetal lengthand petal width load in iris (flowersdata of scikit-learn import sklearn from sklearn import cluster import pandas as pd add another variable c...
16,771
machine learning semi-supervised learning it shouldn' surprise you to learn that while we' like all our data to be labeled so we can use the more powerful supervised machine learning techniquesin reality we often start with only minimally labeled dataif it' labeled at all we can use our unsupervised machine learning te...
16,772
summary buyers non-buyers figure the previous figure shows that the data has only two labeled observationsfar too few for supervised learning this figure shows how you can exploit the structure of the underlying data set to learn better classifiers than from the labeled data only the data is split into two clusters by ...
16,773
machine learning the two big types of machine learning techniques supervised--learning that requires labeled data unsupervised--learning that doesn' require labeled data but is usually less accurate or reliable than supervised learning semi-supervised learning is in between those techniques and is used when only small ...
16,774
single computer this covers working with large data sets on single computer working with python libraries suitable for larger data sets understanding the importance of choosing correct algorithms and data structures understanding how you can adapt algorithms to work inside databases what if you had so much data that it...
16,775
handling large data on single computer be processed when we refer to large data in this we mean data that causes problems to work with in terms of memory or speed but can still be handled by single computer we start this with an overview of the problems you face when handling large data sets then we offer three types o...
16,776
even when you cure the memory issuesyou may need to deal with another limited resourcetime although computer may think you live for millions of yearsin reality you won' (unless you go into cryostasis until your pc is donecertain algorithms don' take time into accountthey'll keep running forever other algorithms can' en...
16,777
handling large data on single computer unpacked data setnumerous read and write operations ( /oare occurringbut the cpu remains largely idlewhereas with the compressed data set the cpu gets its fair share of the workload keep this in mind while we explore few solutions choosing the right algorithm choosing the right al...
16,778
listing training perceptron by observation the learning rate of an algorithm is the adjustment it makes every time new observation comes in if this is highthe model will adjust quickly to new observations but might "overshootand never get precise an oversimplified examplethe optimal (and unknownweight for an -variable ...
16,779
handling large data on single computer if we reach the maximum number of allowed runswe stop looking for solution if error_count = print "training successfulbreak if epoch >self max_epochsprint "reached maximum epochsno perfect predictionbreak if by the end of the epoch we don' have an errorthe training was successful ...
16,780
we'll zoom in on parts of the code that might not be so evident to grasp without further explanation we'll start by explaining how the train_observation(function works this function has two large parts the first is to calculate the prediction of an observation and compare it to the actual value the second part is to ch...
16,781
handling large data on single computer error count is variable to keep track of how many observations are wrongly predicted in this epoch and is returned to the calling function you add one observation to the error counter if the original prediction was wrong an epoch is single training run through all the observations...
16,782
online learning techniques are related to streaming algorithmswhere you see every data point only once think about incoming twitter datait gets loaded into the algorithmsand then the observation (tweetis discarded because the sheer number of incoming tweets of data might soon overwhelm the hardware online learning algo...
16,783
handling large data on single computer (continuedthe formula in figure shows that there' no difference between adding matrices and together in one step or first adding the upper half of the matrices and then adding the lower half all the common matrix and vector operationssuch as multiplicationinversionand singular val...
16,784
listing block matrix calculations with bcolz and dask libraries number of observations (scientific notation feel free to change this import dask array as da import bcolz as bc import numpy as np import dask creates fake datanp arange(nreshape( / , creates matrix of by (because we set to bc carray numpy is an array exte...
16,785
handling large data on single computer doesn' yet support block matrix inversion you can find more general information on matrix arithmetic on the wikipedia page at (mathematicsmapreduce mapreduce algorithms are easy to understand with an analogyimagine that you were asked to count all the votes for the national electi...
16,786
problems sparse data choose the right algorithms solutions choose the right data structures tree hash choose the right tools handling large data general tips figure overview of data structures often applied in data science when working with large data figure example of sparse matrixalmost everything is other values are...
16,787
handling large data on single computer biological tree and the way it splits into branchestwigsand leaves simple decision rules make it easy to find the child tree in which your data resides look at figure to see how tree structure enables you to get to the relevant information quickly start search age age > <age leaf ...
16,788
them in the last example of this when you build recommender system within database hash tables are used extensively in databases as indices for fast information retrieval selecting the right tools with the right class of algorithms and data structures in placeit' time to choose the right tool for the job the right tool...
16,789
handling large data on single computer thisit rewrites your expression and uses an internal (just-in-timecompiler see numba --numba helps you to achieve greater speed by compiling your code right before you execute italso known as just-in-time compiling this gives you the advantage of writing high-level code but achiev...
16,790
general programming tips for dealing with large data sets the tricks that work in general programming context still apply for data science several might be worded slightly differentlybut the principles are essentially the same for all programmers this section recapitulates those tricks that are important in data scienc...
16,791
handling large data on single computer and incorporate best practices and state-of-the art technologies spend your time on getting things donenot on reinventing and repeating others people' effortsunless it' for the sake of understanding how things work then you must consider your hardware limitation get the most out o...
16,792
lower-level language such as or fortran and integrate this with your codebase if you make the step to lower-level languages (languages that are closer to the universal computer bytecode)learn to work with computational libraries such as lapackblastintel mkland atlas these are highly optimizedand it' difficult to achiev...
16,793
handling large data on single computer step defining the research goal the goal of our project is to detect whether certain urls can be trusted or not because the data is so large we aim to do this in memory-friendly way in the next step we'll first look at what happens if we don' concern ourselves with memory (ramissu...
16,794
tools and techniques we ran into memory error while loading single file--still to go luckilywe have few tricks up our sleeve let' try these techniques over the course of the case studyuse sparse representation of data feed the algorithm compressed data instead of raw data use an online algorithm to make predictions we'...
16,795
handling large data on single computer listing checking data size we don' know how many features we haveso let' initialize it at we don' know how many observations we haveso let' initialize it at import tarfile from sklearn linear_model import sgdclassifier from sklearn metrics import classification_report from sklearn...
16,796
case study predicting malicious urls listing creating model to distinguish the malicious from the normal urls we know number of features from data exploration the target variable can be or - " "website safe to visit"- "website unsafe set up stochastic gradient classifier classes [- , sgd sgdclassifier(loss="log"n_featu...
16,797
handling large data on single computer differentbecause the algorithm could converge slightly differently if you don' mind waiting whileyou can go for the full data set you can now handle all the data without problems we won' have sixth step (presentation or automationin this case study now let' look at second applicat...
16,798
techniques simple recommender system will look for customers who've rented similar movies as you have and then suggest those that the others have watched but you haven' seen yet this technique is called -nearest neighbors in machine learning customer who behaves similarly to you isn' necessarily the most similar custom...
16,799
handling large data on single computer comparing multiple columns is an expensive operationso you'll need trick to speed this up because the columns contain binary ( or variable to indicate whether customer has bought movie or notyou can concatenate the information so that the same information is contained in new colum...