id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
16,100 | the final output layer consists of two units with softmax activation function the softmax function is basically generalization of the logistic function we saw earlierwhich can be used to represent probability distribution over possible class outcomes in our case where the class can either be positive or negative and th... |
16,101 | specify validation_split of to extract of the training data and use it as validation dataset for evaluating the performance at each epoch the shuffle parameter helps shuffle the samples in each epoch when training the model in [ ]batch_size v_dnn fit(avg_wv_train_featuresy_trainepochs= batch_size=batch_sizeshuffle=true... |
16,102 | we obtained an overall model accuracy and -score of with the glove featureswhich is still good but not better than what we obtained using our word vec features you can refer to the sentiment analysis supervised ipynb jupyter notebook to see the step-by-step outputs obtained for the previous code this concludes our disc... |
16,103 | in [ ]from collections import counter build word to index vocabulary token_counter counter([token for review in tokenized_train for token in review]vocab_map {item[ ]index+ for indexitem in enumerate(dict(token_counteritems())max_index np max(list(vocab_map values())vocab_map['pad_index' vocab_map['not_found_index'max_... |
16,104 | #test prediction class labels convert text sentiment labels (negative\positiveto binary encodings ( / test_y le transform(test_sentimentsview vector shapes print('max length of train review vectors:'max_lenprint('train review vectors shape:'train_x shapetest review vectors shape:'test_x shapemax length of train review ... |
16,105 | figure - understanding how word embeddings are generated based on our model architecturethe embedding layer takes in three parameters--input_dimwhich is equal to the vocabulary size (vocab_sizeof output_dimwhich is representing the dimension of dense embedding (depicted by rows in the embedding layer in figure - )and i... |
16,106 | figure - basic structure of rnn and lstm units (sourcechristopher olah' blogcolah github iothe rnn units usually have chain of repeating modules (this happens when we unroll the looprefer to figure - in where we talk about thissuch that the module has simple structure of having maybe one layer with the tanh activation ... |
16,107 | figure - detailed architecture of an lstm cell (sourcechristopher olah' blogcolah github iothe detailed architecture of an lstm cell is depicted in figure - the notation indicates one time stepc depicts the cell statesand indicates the hidden states the gates , help in removing or adding information to the cell state t... |
16,108 | all these steps in this detailed workflow are depicted in figure - with necessary annotations and equations we would like to thank our good friend christopher olah for providing us detailed information as well as the images for depicting the internal workings of lstm networks we recommend checking out christopher' blog... |
16,109 | in [ ]batch_size model fit(train_xtrain_yepochs= batch_size=batch_sizeshuffle=truevalidation_split= verbose= train on samplesvalidate on samples epoch / / loss acc val_loss val_acc epoch / / loss acc val_loss val_acc epoch / / loss acc val_loss val_acc epoch / / loss acc val_loss val_acc epoch / / loss acc val_loss val... |
16,110 | analyzing sentiment causation we built both supervised and unsupervised models to predict the sentiment of movie reviews based on the review text content while feature engineering and modeling is definitely the need of the houryou also need to know how to analyze and interpret the root cause behind how model prediction... |
16,111 | we build our model based on norm_train_reviewswhich contains the normalized training reviews that we have used in all our earlier analyses now that we have our classification pipeline readyyou can actually deploy the model by using pickle or joblib to save the classifier and feature objects similar to what we discussed... |
16,112 | display model prediction interpretation exp explainer explain_instance(norm_corpus[doc_index]lr_pipeline predict_probanum_features= labels=[ ]exp show_in_notebook(the preceding snippet leverages skater to explain our text classifier to analyze its decision-making process in an easy to interpret form even though the mod... |
16,113 | the results depicted in figure - show us the class prediction probabilities and also the top features that contributed the maximum to the prediction decision making process these key features are also highlighted in the normalized movie review text our model performs quite well in this scenario and we can see the key f... |
16,114 | the results depicted in figure - show the top features responsible for the model making decision of predicting this review as positive based on the contentthe reviewer really liked this model and also it was real cult classic among certain age groups in our final analysiswe will look at the model interpretation of an e... |
16,115 | the preceding output tells us that our model predicted the movie review indicating positive sentiment when in-fact the actual sentiment label is negative for the same review the results depicted in figure - tell us that the reviewer in fact shows signs of positive sentiment in the movie reviewespecially in parts where ... |
16,116 | from the preceding output dimensionsyou can see that we have filtered out lot of the features we used previously when building our classification models by making min_df to be and max_df to be this is to speed up the topic modeling process and remove features that either occur too much or too rarely let' now import the... |
16,117 | we depict some of the topics out of the topics generated in the preceding output you can leverage pyldavis now to visualize these topics in an interactive visualization see figure - in [ ]pyldavis sklearn prepare(pos_nmfptvf_featuresptvfr= figure - visualizing topic models on positive sentiment movie reviews the visual... |
16,118 | let' now extract topics and run this same analysis on our negative sentiment reviews from the movie reviews dataset in [ ]build topic model on negative sentiment review features neg_nmf nmf(n_components= random_state= alpha= _ratio= neg_nmf fit(ntvf_featuresextract features and component weights neg_feature_names ntvf ... |
16,119 | the visualization depicted in figure - shows us the topics from negative movie reviews and we can see the top relevant terms for topic highlighted in the output from the topics and the termswe can see terms like wastetimemoneycrapplotterribleactingand so on have contributed toward negative sentiment in various topics o... |
16,120 | customer segmentation and effective cross selling money makes the world go round and in the current ecosystem of data intensive business practicesit is safe to claim that data also makes the world go round very important skill set for data scientists is to match the technical aspects of analytics with its business valu... |
16,121 | online retail transactions dataset the online retail transactions dataset is available from the uci machine learning repository we already used some datasets from this repository in our earlier and this should underline the importance of this repository to the users the dataset we will be using for our analysis is qui... |
16,122 | the few lines from the dataset gives us information about the attributes of the datasetsas shown in figure - figure - sample transactions from the retail transactions dataset the attributes of the dataset are easily identifiable from their names we know right away what each of these fields might mean for the sake of co... |
16,123 | next we might be interested in how many unique customers the retailer is having and how do they stack up in the number of orders they make we are also interested in knowing that what percentage of orders is made by the top customers of the retailer this information is interesting as it would tell us whether the user ba... |
16,124 | in [ ]cs_df[cs_df['stockcode'==cat_des_df stockcode value_counts()[cat_des_df stockcode value_counts()> reset_index()['index'][ ]]['description'unique(out[ ]array(['mistletoe heart wreath cream''mistletoe heart wreath white''mistletoe heart wreath cream''?''had been put aside'nan]dtype=objectthis gives the multiple des... |
16,125 | customer segmentation segmentation is the process of segregating any aggregated entity into separate parts or groups (segmentsthese parts may or may not share something common across them customer segmentation is similarly the process of dividing an organization' customer bases into different sections or segments based... |
16,126 | finding latent customer segments customer segmentation process helps the organization with knowing its customer base an obvious side effect of any such practice is finding out which segment of customers it might be missing this can help in identifying untapped customer segments by focused on marketing campaigns or new ... |
16,127 | customer segmentation is just the task of segmenting customers it can be solved in several ways and it need not always be complex model clustering provides mathematical framework which can be leveraged for finding out such segment boundaries in the data clustering is especially useful when we have lot of attributes abo... |
16,128 | cs_df cs_df[~(cs_df amount< )cs_df head(out[ ]invoiceno stockcode description quantity white hanging heart -light holder white metal lantern cream cupid hearts coat hanger knitted union flag hot water bottle red woolly hottie white heart invoicedate unitprice customerid country amount : : united kingdom : : united king... |
16,129 | before we proceedlet' examine how the distribution of customer recency looks for our data (see figure - customer_history_df recency mu np mean(customer_history_df recencysigma math sqrt(np var(customer_history_df recency)nbinspatches plt hist( facecolor='green'alpha= add 'best fitline mlab normpdfbinsmusigmal plt plot(... |
16,130 | in [ ]customer_monetary_val cs_df[['customerid''amount']groupby("customerid"sum(reset_index(customer_history_df customer_history_df merge(customer_monetary_valhow='outer'customer_history_df amount customer_history_df amount+ customer_freq cs_df[['customerid''amount']groupby("customerid"count(reset_index(customer_freq r... |
16,131 | customer_history_df[feature_vectoras_matrix(scaler preprocessing standardscaler(fit(xx_scaled scaler transform(xthe previous code snippet will create log valued and mean centered version of our dataset we can visualize the results of our preprocessing by inspecting the variable with the widest range of values the follo... |
16,132 | let' try to visualize our three main features (rfand mon three-dimensional plot to see if we can understand any interesting patterns that the data distribution is showing from mpl_toolkits mplot import axes fig plt figure(figsize=( )ax fig add_subplot( projection=' 'xs =customer_history_df recency_log ys customer_histo... |
16,133 | clustering for segments we will be using the -means clustering algorithm for finding out clusters (or segments in our datait is one of the simplest clustering algorithms that we can employ and hence it is widely used in practice we will give you brief primer of the algorithm before we go on to using the samefor finding... |
16,134 | figure - silhouette analysis with three and five clusters in the visualization depicted in figure - we plotted the silhouette score of each cluster along with the center of each of the cluster discovered we will use this information in the next section on cluster analysis although we have to keep in mind that in severa... |
16,135 | cent_transformed scaler inverse_transform(cluster_centers[ ]['cluster_center']print(pd dataframe(np exp(cent_transformed),columns=feature_vector)print("silhouette score for cluster {is {}format(icluster_centers[ ]['silhouette_score'])print(for number of clusters amount_log recency_log frequency_log silhouette score for... |
16,136 | cluster descriptions on the basis of eyeballing the cluster centerswe can figure out that we have good difference in the customer value in the segments as defined in terms of recencyamount and frequency to further drill down on this point and find out the quality of these differencewe can label our data with the corre... |
16,137 | [ <np percentile( cutoff_quantile) =customer_history_df[customer_history_df['num_cluster _labels']== ][field_to_plotvalues [ <np percentile( cutoff_quantile) =customer_history_df[customer_history_df['num_cluster _labels']== ][field_to_plotvalues [ <np percentile( cutoff_quantile) =customer_history_df[customer_history_d... |
16,138 | figure - difference in sales amount values across the five segments let' also take look at the plot that is generated as result of this code snippet in figure - we can see that the clusters and have higher average sales amountthus being the highest spenders although we don' see much difference in the sales values of cl... |
16,139 | figure - difference in sales amount values across the three segments we can further improve the quality of clustering by adding relevant features to the dataset that we have created often firms will buy data regarding their customers from external data vendors and use it to enhance the segmentation process we had limit... |
16,140 | figure - cross selling example more often than notthese recommended products would be very appealing for exampleif am in the market for protein supplement it will definitely be good idea for me to buy vitamin supplement too the retailer will often offer you bundle of products with some attractive offer and it is highly... |
16,141 | this rule can be read in the obvious manner that when the customer bought items on the (left hand sidelhs of the rule he is likely to buy the itemk in the later sectionswe define mathematical metrics that will capture the strength of such rules we can use these rules in variety of ways the most obvious way to use these... |
16,142 | liftlift of the rule is defined as the ratio of observed support to the support expected in the case the elements of the rule were independent for the previous set of transactions if the rule is defined as (ry}then the lift of the rule is defined aslift (ry supp supp supp ( frequent itemsetfrequent itemsets are itemset... |
16,143 | we will not go into detailed mathematical descriptions of the algorithm hereas the intent is to not to keep this section math heavy but to focus on how it can be leveraged to find patterns in this data howeverwe will explain it in brief so you can understand the core concepts in this method the fp growth algorithm uses... |
16,144 | figure - grocery dataset transactions the first observation that we make from this dataset is that it is not available in completely structuredeasy-to-analyze format this limitation will mean that the first thing we will have to do is to write custom code that will convert the raw file into data structure we can use si... |
16,145 | item_summary_df columns[ ]:'item_count'}inplace=trueitem_summary_df head( out[ ]item_name item_count whole milk other vegetables rolls/buns soda yogurt for creating the histogramwe will create summary dataframe using the previous code this tells us that we have total of , items occurring in total in all those transacti... |
16,146 | figure - grocery dataset top items based on sales let' also find out how much percentage of total sales is explained by these items alone we will use the cumulative sum function offered by pandas (cumsumto find this out we will create two columns in our dataframe one will tell how much percentage of total sales can be ... |
16,147 | this shows us that the top five items are responsible for of the entire sales and only the top items are responsible for over of the salesthis is important for usas we don' want to find association rules for items which are bought very infrequently with this information we can limit the items we want to explore for cre... |
16,148 | using the fp growth algorithm now we have all the pieces required to perform our rule-mining but before proceedingwe want to take care of one more important aspect of the analysis we saw in the earlier section how only handful of items are responsible for bulk of our sales so we want to prune our dataset to reflect th... |
16,149 | num of required transactions in [ ]len(itemsetsout[ ] so we get whopping , itemsets for support of only %this will increase exponentially if we decrease the support or if we increase the number of items in our dataset the next step is specifying confidence value and generating our rules we have written code snippet tha... |
16,150 | the output of this code snippet consists of the association rules dataframe that we can use for our analysis you can play around with the item numberconsequentantecedentsupportand confidence values to generate different rules let' take some sample rules generated using transactions that explain of total salesmin-suppor... |
16,151 | of finding root vegetables in the previous transactions ( typicallya lift value of indicates that the probability of occurrence of the antecedent and consequent together are independent of each other hencethe idea is to look for rules having lift much greater than in our caseall the previously mentioned rules are good ... |
16,152 | support num_trans input_assoc_rules shape[ ]*support itemsets dict(frequent_itemsets(data_tran_uk_ensupport)confidence rules_df pd dataframe(rest of the code similar to what we did earlier the rest of the analysis can be performed using the same workflow which we used for the groceries dataset feel free to check out th... |
16,153 | analyzing wine types and quality in the last we looked at specific case studies leveraging unsupervised machine learning techniques like clustering and rule-mining frameworks in this we focus on some more case studies relevant to supervised machine learning algorithms and predictive analytics we have looked at classifi... |
16,154 | the datasets used in this are available in the very popular uci machine learning repository under the name of wine quality data set you can access more details at ml/datasets/wine+qualitywhich gives you access to the raw datasets as well as details about the various features in the datasets there are two datasetsone fo... |
16,155 | exploratory data analysis standard machine learning and analytics workflow recommend processingcleaninganalyzingand visualizing your data before moving on toward modeling your data we will also follow the same workflow we used in all our other you can refer to the python file titled exploratory_data_analysis py for al... |
16,156 | if value < else 'mediumif value < else 'high'white_wine['quality_label'pd categorical(white_wine['quality_label']categories=['low''medium''high']merge red and white wine datasets wines pd concat([red_winewhite_wine]re-shuffle records just to randomize data points wines wines sample(frac= random_state= reset_index(drop=... |
16,157 | figure - sample data points from the wine quality dataset the output depicted in figure - shows us sample wine records for our wine quality dataset looking at the valueswe can get an idea of numeric as well as categorical features let' now try to gain some domain knowledge about wine and its attributes domain knowledge... |
16,158 | chloridesthis is usually major contributor to saltiness in wine it' usually expressed in sodiumchloride in the dataset dm free sulfur dioxidethis is the part of the sulfur dioxide thatwhen added to wineis said to be free after the remaining part binds winemakers will always try to get the highest proportion of free sul... |
16,159 | quality_labelthis is derived attribute from the quality attribute we bucket or group wine quality scores into three qualitative bucketsnamely lowmediumand high wines with quality score of and are low qualityscores of and are medium qualityand scores of and are high quality wines we will also build another model in this... |
16,160 | figure - descriptive statistics for wine attributes separated by wine quality the summary table depicted in figure - shows us descriptive statistics for various wine attributes subset by wine quality ratings interestinglymean alcohol levels seem to increase based on the rating of the wine quality we also see that ph le... |
16,161 | for our scenariothree data subsets or groups from the data are created based on wine quality ratings the mean values in the first test would be based on the wine alcohol content and the second test would be based on the wine ph levels also let' assume the null hypothesis is that the group means for lowmediumand high qu... |
16,162 | figure - visualizing wine alcohol content and ph level distributions based on quality ratings the boxplots depicted in figure - show us stark differences in wine alcohol content distributions based on wine quality as compared to ph levelswhich look to be between and in fact if you look at the mean and median values for... |
16,163 | figure - univariate plots depicting feature distributions for the wine quality dataset the power of packages like matplotlib and pandas enable you to easily plot variable distributions as depicted in figure - using minimal code do you notice any interesting patterns across the two wine typeslet' take the feature named ... |
16,164 | figure - residual sugar distribution for red and white wine samples we can notice easily from the visualization in figure - that residual sugar content in white wine samples seems to be more as compared to red wine samples you can reuse the plotting template in the preceding code snippet and visualize more features som... |
16,165 | figure - distributions for wine quality for red and white wine samples the bar plots depicted in figure - show us the distribution of wine samples based on type and quality it is quite evident that high quality wine samples are far less as compared to low and medium quality wine samples multivariate analysis analyzing ... |
16,166 | figure - correlation heatmap for features in the wine quality dataset while most of the correlations are weakas observed in figure - we can see strong negative correlation between density and alcohol and strong positive correlation between total and free sulfur dioxidewhich is expected you can also visualize patterns a... |
16,167 | figure - pairwise plots by wine type for features in the wine quality dataset from the plots in figure - we can notice several interesting patternswhich are in alignment with some insights we obtained earlier these observations include the followingpresence of higher sulphate levels in red wines as compared to white wi... |
16,168 | figure - visualizing relationships between wine typessulphates and quality with joint plots while there seems to be some pattern depicting lower sulphate levels for higher quality rated wine samplesthe correlation is quite weak (see figure - howeverwe do see clearly that sulphate levels for red wine are much higher as ... |
16,169 | figure - visualizing relationships between wine typesalcoholqualityand acidity levels the plot in figure - shows us some interesting patterns not only are we able to successfully visualize four variablesbut also we can see meaningful relationships among them higher quality wine samples (depicted by darker shadeshave lo... |
16,170 | figure - visualizing relationships between wine typesqualitysulfur dioxideand acidity levels we can easily interpret from figure - that volatile acidity as well as total sulfur dioxide is considerably lower in high quality wine samples alsototal sulfur dioxide is considerable more in white wine samples as compared to r... |
16,171 | figure - visualizing relationships between wine typesquality and alcohol content based on our earlier analysis for wine quality versus alcohol volume in the "inferential statisticssectionthese results look consistent each box plot in figure - depicts the distribution of alcohol level for particular wine quality rating ... |
16,172 | figure - visualizing relationships between wine typesquality and acidity in figure - each violin plot typically depicts the inter-quartile range with the median which is shown with dotted lines in this figure you can also visualize the distribution of data with the density plots where width depicts frequency thus in ad... |
16,173 | do remember to have the model_evaluation_utils py module in the same directory where you are running your code since we will be using it for evaluating our predictive models let' briefly look at the workflow we will be following for our predictive systems we will focus on two major phases--model training and model pred... |
16,174 | wtp_train_xwtp_test_xwtp_train_ywtp_test_y train_test_split(wtp_featureswtp_class_labelstest_size= random_state= print(counter(wtp_train_y)counter(wtp_test_y)print('features:'list(wtp_feature_names)counter({'white' 'red' }counter({'white' 'red' }features['fixed acidity''volatile acidity''citric acid''residual sugar''ch... |
16,175 | we get an overall score and model accuracy of %as depicted in figure - which is really amazingin spite of low samples of red winewe seem to do pretty well in case your models do not perform well on other datasets due to class imbalance problemyou can consider over-sampling or under-sampling techniques including sample ... |
16,176 | in [ ]wtp_dnn_ypred wtp_dnn_model predict_classes(wtp_test_sxwtp_dnn_predictions le inverse_transform(wtp_dnn_ypredmeu display_model_performance_metrics(true_labels=wtp_test_ypredicted_labels=wtp_dnn_predictionsclasses=['red''white']figure - model performance metrics for deep neural network for wine type predictive mod... |
16,177 | in [ ]from skater core explanations import interpretation from skater model import inmemorymodel wtp_interpreter interpretation(wtp_test_sxfeature_names=wtp_features columnswtp_im_model inmemorymodel(wtp_lr predict_probaexamples=wtp_train_sxtarget_names=wtp_lr classes_plots wtp_interpreter feature_importance plot_featu... |
16,178 | figure - roc curve for our logistic regression model we achieved almost accuracy if you remember for this model and hence the roc curve is almost perfect where we also see that the area under curve (aucis which is perfect finallyfrom our feature importance ranks we obtained earlierlet' see if we can visualize the model... |
16,179 | figure - visualizing the model decision surface for our logistic regression model the plot depicted in figure - reinforces the fact that our model has learned the underlying patterns quite well based on just the two most important featureswhich it has used to separate out majority of the red wine samples from the white... |
16,180 | counter({'medium' 'low' 'high' }counter({'medium' 'low' 'high' }features['fixed acidity''volatile acidity''citric acid''residual sugar''chlorides''free sulfur dioxide''total sulfur dioxide''density''ph''sulphates''alcohol'from the preceding outputit is evident we use the same physicochemical wine features the number of... |
16,181 | we get an overall score and model accuracy of approximately %as depicted in figure - which is not bad for start looking at the class based statisticswe can see the recall for the high quality wine samples is pretty bad since lot of them have been misclassified into medium and low quality ratings this is kind of expecte... |
16,182 | in [ ]from graphviz import source from sklearn import tree from ipython display import image graph source(tree export_graphviz(wqp_dtout_file=noneclass_names=wqp_label_namesfilled=truerounded=truespecial_ characters=falsefeature_names=wqp_feature_namesmax_depth= )png_data graph pipe(format='png'with open('dtree_struct... |
16,183 | moving forward with our mission of improving our wine quality predictive modellet' look at some ensemble modeling methods ensemble models are typically machine learning models that combine or take weighted (average\majorityvote of the predictions of each of the individual base model estimators that have been built usin... |
16,184 | figure - model performance metrics for random forest for wine quality predictive model the model prediction results on the test dataset depict an overall score and model accuracy of approximately %as seen in figure - this is definitely an improvement of from what we obtained with just decision trees proving that ensemb... |
16,185 | accuracy to evaluate the model for best accuracy you can set it to other parameters to evaluate the model on other metrics like scoreprecisionrecall and so on check out modules/model_evaluation html#scoring-parameter for further details you can view the grid search results for all the hyperparameter combinations as fol... |
16,186 | another way of modeling ensemble based methods is boosting very popular method is xgboost which stands for extreme gradient boosting it is variant of the gradient boosting machines (gbmmodel this model is extremely popular in the data science community owing to its superior performance in several data science challenge... |
16,187 | in [ ]from skater core explanations import interpretation from skater model import inmemorymodel leveraging skater for feature importances interpreter interpretation(wqp_test_sxfeature_names=wqp_feature_nameswqp_im_model inmemorymodel(wqp_rf predict_probaexamples=wqp_train_sxtarget_names=wqp_rf classes_retrieving featu... |
16,188 | prediction hence equal weight is given to each prediction classification decision macro-averaging involves giving equal weight to each class label when averaging our model_evaluation_utils module has nifty customizable function plot_model_roc_curve)which can help plot multi-class classifier roc curves with both microan... |
16,189 | figure - visualizing the model decision surface for our tuned random forest model the plot depicted in figure - shows us that the three classes are definitely not as easily distinguishable as our wine type classifier for red and white wine of coursevisualizing the hypersurfaces with multiple features becomes difficult ... |
16,190 | figure - model interpretation for our wine quality model' prediction for low quality wine the results depicted in figure - show us the features that were primarily responsible for the model to predict the wine quality as low we can see that the most important feature was alcoholwhich makes sense considering what we obt... |
16,191 | to wrap up our discussion on model interpretationwe will be talking about partial dependence plots and how they are useful in our scenario in generalpartial dependence helps describe the marginal impact or influence of feature on the model prediction decision by holding the other features constant because it is very di... |
16,192 | figure - two-way partial dependence plots for our random forest model predictor based on alcohol and volatile acidity the plots in figure - bear some resemblance with the plots in figure - for predicting high quality winedue to the lack of training datawhile some dependency is there for high wine quality class predicti... |
16,193 | analyzing music trends and recommendations recommendation engines are probably one of the most popular and well known machine learning applications lot of people who don' belong to the machine learning community often assume that recommendation engines are its only use although we know that machine learning has vast su... |
16,194 | the million song dataset taste profile the million song dataset is very popular dataset and is available at millionsongthe original dataset contained quantified audio features of around million songs ranging over multiple years the dataset was created as collaborative project between the echonest (using this dataset d... |
16,195 | since the dataset doesn' have headerwe also provided the column name to the function subset of the data is shown in figure - figure - sample rows from the echonest taste profile dataset the first thing we may want to do in the dataset of this size is determine how many unique users (or songswe should consider in the or... |
16,196 | the persisted dataframe can be then loaded and used based on our requirements we can use similar strategy to extract play counts for each of the songs few lines from the dataset are shown in figure - figure - play counts for some users the first thing we want to find out about our dataset is the number of users that we... |
16,197 | del(triplet_datasettriplet_dataset_sub_song triplet_dataset_sub[triplet_dataset_sub song isin(song_subset)del(triplet_dataset_subtriplet_dataset_sub_song to_csv(path_or_buf=data_home+'triplet_dataset_sub_song csv'index falsethis subsetting will give us dataframe with around million rows of tuples we will use this as t... |
16,198 | the final datasetmerged with the triplets dataframe looks similar to the depiction in figure - this will form the starting dataframe for our exploratory data analysis figure - play counts dataset merged with songs metadata visual analysis before we start developing various recommendation engineslet' do some visual ana... |
16,199 | the plot that' generated by the code snippet is shown in figure - the plot shows that the most popular song of our dataset is "you're the onewe can also search through our track dataframe to see that the band responsible for that particular track is the black keys figure - most popular songs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.