This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Import libraries | |
library(arules) | |
library(arulesViz) | |
## Create rules | |
assn_rules <- apriori(tData, parameter = list(supp = 0.001, conf=0.9, minlen=3, maxlen=5)) | |
## Filter rules by lift | |
filtered_rules <- subset(assn_rules, subset = lift > 1.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Import libraries | |
library(arulesCBA) | |
library(arules) | |
library(ggplot2) | |
## Discretize "MonthlyCharges" with respect to "Churn"/"No Churn" | |
df$Binned_MonthlyCharges <- discretizeDF.supervised(Churn ~ ., df[, c('MonthlyCharges', 'Churn')], | |
method='mdlp')$MonthlyCharges | |
## Discretize "Tenure" with respect to "Churn"/"No Churn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.MINTY]) | |
server = app.server | |
if __name__ == "__main__": | |
app.run_server(debug=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<br> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> | |
<link | |
rel="stylesheet" | |
href="https://cdn.rawgit.com/afeld/bootstrap-toc/v1.0.1/dist/bootstrap-toc.min.css" | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df['Binned_MonthlyCharges'] = pd.cut(x=df['MonthlyCharges'], | |
bins=[0, 30, 55, 70, 90, 110, 120], | |
labels=['$0-30', '$30-55', '$55-70', '$70-90', '$90-110', '$110-120']) | |
df['Binned_MonthlyCharges'] = df['Binned_MonthlyCharges'].astype('category') | |
df['Binned_MonthlyCharges'].cat.reorder_categories(['$0-30', '$30-55', '$55-70', '$70-90', '$90-110', '$110-120'], | |
inplace=True) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kill -9 $(lsof -i:5000 -t) 2> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rm -r --cached . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Apply varimax rotation | |
res.pcarot <- PCArot(res.pcamix, | |
dim=4, | |
graph=FALSE) | |
## Plot components before and after rotation | |
plot(res.pcamix, | |
choice="sqload", | |
coloring.var=TRUE, | |
axes=c(1, 2), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Taken from tutorial at https://cran.r-project.org/web/packages/PCAmixdata/vignettes/PCAmixdata.html | |
## Import library | |
library(PCAmixdata) | |
## Split qualitative and quantitative variables | |
split <- splitmix(gironde$housing) | |
X1 <- split$X.quanti | |
X2 <- split$X.quali |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options(repr.plot.width=4, repr.plot.height=3) |