teleren/devto huggingface dataset:
Predicting customer churn in banking using ANN
Tags: machinelearning, datascience, keras, neuralnetworks
Published: 2018-08-17 08:48:01

---
title: Predicting customer churn in banking using ANN
published: true
tags: machine-learning,data-science,keras,neural-networks
canonical_url: https://medium.com/@blackbird98/predicting-customer-churn-in-banking-using-ann-75b43289a1bd
---

![](https://cdn-images-1.medium.com/max/1024/0*CAnlolK6WNrLQBnz)<figcaption>Predicting customer churn in banking using ANN</figcaption>

### Dataset

The dataset ‘Churn\_Modelling.csv’ contains records of 10,000 customers of a bank with following columns:

1. RowNumber
2. CustomerId
3. Surname
4. CreditScore
5. Geography
6. Gender
7. Age
8. Tenure
9. Balance
10. NumOfProducts
11. HasCrCard
12. IsActiveMember
13. EstimatedSalary
14. Exited

By using the columns 1 to 13, we want to predict if the customer will exit or not that is column 14.

### Data Preprocessing

- Removing unnecessary features
- Label Encoder
- One Hot Encoder
- Train Test Split
- Standard Scaler

### Simple ANN Model using Keras

**Create an ANN with total 4 layers**

- One input layer with 11 input features and 6 output features
- Hidden layer with 6 output features
- Final layer with 1 output feature

**Activation Functions**

- 1st layer: Relu
- 2nd layer: Relu
- 3rd layer: Sigmoid

**Hyperparameters**

- optimizer: adam
- loss: binary\_crossentropy
- metrics: accuracy
- batch\_size: 10
- epochs:100

**Accuracy(Subject to change)**

- Training Set: 0.8610
- Testing Set:0.86

### Improving ANN

- Use **k-fold classifier** to split training set in say 10 parts and applying training on 9 out of 10 parts and testing on another every time to decrease fluctuation in accuracy every time you run the code.
- Use Dropout technique with a certain threshold to decreases overfitting on the training set. Applying to this dataset gives an accuracy of 0.8321 which means now data is less overfitted to this training set.
- Use **GridSearchCV** to find best parameters automatically. Enter all the hyperparameters you want to test your network on and after testing everything it will give the best possible accuracy and parameters. I tried with the following parameters:

**batch\_size:** 25, 32

**epochs:** 100, 500

**optimizer:** adam, rmsprop

- After waking in the morning(yes, it takes a long time…), this is what I found…

**best\_parameters**

- batch\_size: 25
- epochs: 500
- optimizer: rmsprop

**accuracy:** 0.8545

### Further Improvements

You can further improve this model by changing hyperparameters and trying other range of values in GridSearchCV. But it is important to note that, as you will increase the number of parameters in GridSearchCV, your time for training will also increase.

### Code

{% github Omkar-Ajnadkar/Neural-Network-Projects](https://github.com/Omkar-Ajnadkar/Neural-Network-Projects %}

Send a pull request for any suggestions and errors…
Translations with React, Redux and Asp.Net
Tags: aspnet, react, redux, net
Published: 2018-08-03 11:40:29

---
title: Translations with React, Redux and Asp.Net
published: true
tags: aspnet,react,redux,.net
canonical_url: https://craignicol.wordpress.com/2018/08/03/translations-with-react-redux-and-asp-net/
---

In a recent project, which was the first time I’ve used React and Redux in anger, we had a requirement to support 2 different languages, in the .Net backend for emails and PDFs, and in the React frontend.

As the translators we used were used to resx files, we wanted to use those as the master source. In other projects we’ve done the javascript translations via a pre-compilation step into static javascript files, but since redux has it’s own store, I decided to see if we could use that to store and process the translations.

This approach has the advantage that we can use the redux state to translate the site automatically when a new language is selected, without having to reload any pages. For an application that depends on up-to-date data, and had to operate on por data connections, avoiding reloads is essential.

The redux examples shown here use TypeScript, which certainly helped in our development process, but there’s a lot of gotchas getting the **dotnet new react-redux** template and many 3rd party react and redux libraries working nicely with TypeScript. You can make it work, but it’s definitely not an out-of-the-box solution in most cases.

The solution consists of 3 parts:

1. The Asp.Net Core 2.0 controller to translate the resx data into JSON,
2. The Redux configuration to retrieve the data and populate it into the store; and
3. A React function that reads the translation from the store and presents it to the user.

The solution below attempts to get the localisation from the user headers, so you’ll need to enable localisation in your **Startup.cs** , but depending on your use case, you may want save user language settings in the user’s account data, or in a cookie or other storage in their browser.

**For the code samples in this post, [please see the original on WordPress](https://craignicol.wordpress.com/2018/08/03/translations-with-react-redux-and-asp-net/)**
Do we still need turbolinks/PJAX?
Tags: discuss, webdev, rails, javascript
Published: 2018-08-03 08:24:33

---
title: Do we still need turbolinks/PJAX?
published: true
description: The way most browsers load pages nowadays might mean we don't need PJAX/turbolinks
tags: discuss,webdev,rails, JavaScript
---

While messing around with a server-rendered web application, I was thinking of dropping PJAX in to make page changes smoother, but I tested on a couple different browsers and it seems they all fetch the new page in the background and replace it after (like PJAX but with a proper style/JS refresh).

With that in mind: is there still a use case for PJAX/turbolinks?
Automagically build and push Docker images to a registry using Gitlab.
Tags: docker, devops, ci
Published: 2018-08-03 07:57:37

---
title: Automagically build and push Docker images to a registry using Gitlab.
published: true
description: Use Docker-in-Docker to build and push images to a registry.
tags: #docker, #devops, #ci
---

This is an example configuration for how to automatically build Docker images and push to your own Docker registry on Gitlab (free). In this example, I'm building and testing a Docker image that runs Django, but the same basic idea will work for any app. 

```yml
image: docker:latest

services:
  - docker:dind

stages:
- build
- test
- push

variables:
  DJANGO_TAG_NAME: registry.gitlab.com/<username>/<repo>/<image>:$CI_COMMIT_REF_NAME
  DJANGO_SETTINGS_MODULE: path.to.your.settings
  DATABASE_URL: postgres://postgres:xxxxxxx@postgres/postgres

before_script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com

build:django:
  artifacts:
    paths:
      - docker-images
  stage: build
  script:
    - mkdir docker-images
    - docker build --pull -t $DJANGO_TAG_NAME -f path/to/your/Dockerfile .
    - docker save $DJANGO_TAG_NAME > docker-images/app.tar
  only:
    - master
test:django:
  stage: test
  script:
    - docker load -i docker-images/app.tar
    - docker run --name test-postgres -e POSTGRES_PASSWORD=xxxxxxx -d postgres
    - docker run --rm --link test-postgres:postgres -v $(pwd):/<DOCKER WORKDIR> -e DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE -e DATABASE_URL=$DATABASE_URL $DJANGO_TAG_NAME python manage.py test -v 2

push:django:
  stage: push
  script:
    - docker load -i docker-images/app.tar
    - docker push $DJANGO_TAG_NAME
  only:
    - master

```
This one trick gives you unlimited CI minutes on Gitlab.
Tags: docker, devops, testing, ci
Published: 2018-08-03 07:49:04

---
title: This one trick gives you unlimited CI minutes on Gitlab.
published: true
description: Add a new runner to Gitlab using Docker.
tags: #docker, #devops, #testing, #ci
---

Gitlab graciously provides 2,000 free minutes per month to all users on Gitlab.com (thanks Gitlab!). I deploy many times a day so it's quite easy to use all 2K minutes in a matter of days. 

Here is how to get around that:

- Spin up a new compute instance with Docker pre-installed. I recommend [Digital Ocean](https://m.do.co/c/f1de666e40fd), but [Vultr](https://www.vultr.com/?ref=7495712) is pretty good too.
- Replace the `CI_SERVER_URL` value with one from your actual server URL. Go to the CI settings for your project and get your registration token under the "Runners" section. Then update `REGISTRATION_TOKEN` in the yml file.
- Ssh into your server and save the code below to a file called `docker-compose.yml`.
- Run `docker-compose up -d`



```yml
version: '2'
services:
  dind:
    restart: always
    privileged: true
    volumes:
    - /var/lib/docker
    image: docker:18.06.0-ce-dind
    command:
    - --storage-driver=overlay2

  runner:
    restart: always
    image: gitlab/gitlab-runner:alpine
    volumes:
    - ./gitlab/runner:/etc/gitlab-runner:Z
    environment:
    - DOCKER_HOST=tcp://dind:2375

  register-runner:
    restart: 'no'
    image: gitlab/gitlab-runner:alpine
    volumes:
    - ./gitlab/runner:/etc/gitlab-runner:Z
    command:
    - register
    - --non-interactived
    - --locked=false
    - --name=Docker Runner
    - --executor=docker
    - --docker-image=docker:18.06.0-ce-dind
    - --docker-volumes=/var/run/docker.sock:/var/run/docker.sock
    environment:
    - CI_SERVER_URL=https://XXXXXXXX.XXXXX
    - REGISTRATION_TOKEN=XXXXXXX

```
My preferred merge strategy for Pull Requests
Tags: git, github, bitbucket, pullrequest
Published: 2018-08-03 07:42:47

---
title: My preferred merge strategy for Pull Requests
published: true
description: Reasoning about common merge strategies
tags: git, github, bitbucket, pull-request
---

In every decent team project I've worked before (that had PRs in place), the merge strategy was to squash all commits into a single one, to be done into the master branch.

In the beginning, it felt odd, as "all my hard work and organized commits" would become a single, standardized blob of sorts. Then I got used to the flow and, well, whatever, right? _It works®_.

But then it came the time it was **me** who was deciding the path a team would start to walk through. And the question came, why squash merges? Why rebases?

As people say, _first you resist, then you accept, and then you question what was happening_.

![Squash diagram](https://help.github.com/assets/images/help/pull_requests/commit-squashing-diagram.png)

So, to help with understanding why I chose Squash Merge to be the default for our repository:

Squash merges are usually preferred not only because of the "flat history" (that is usually easier to navigate with any tooling), but actually, because the history gets much cleaner and "straight to the point", without all the partial commits that are common during development.
If the squash is done correctly, you'll still maintain all commits' text in the squashed commit, so you can still get some details about the development of that feature, without clogging your `master` history.

One should also remember history is not only used to see code progress on a timeline/tree, but also for _blaming changes_. Even though you can use tools or extra options to "ignore" partial commits, blame probably won't - or will get too convoluted, at least.

I did some quick research to see discussions on the subject, and I can link you to two references that show my opinion and that I used to enhance my arguments above:

[Answer about squash preference, on a CLI tool for Git Workflow](https://github.com/reenhanced/gitreflow/issues/52#issuecomment-28437323):
>_[...] And over time, that's all we really care about in the history. Who made this change and why was it made. Squash merging allows us to do that while still giving all of our developers the individual freedom to develop in the way that suits them best._

[GitHub manual about PR merge strategies](https://help.github.com/articles/about-pull-request-merges/):
>_You can use squash and merge to create a more streamlined Git history in your repository. Work-in-progress commits are helpful when working on a feature branch, but they aren’t necessarily important to retain in the Git history. If you squash these commits into one commit while merging to the default branch, you can retain the original changes with a clear Git history._


---------------------------

_[(this was also posted to my Medium)](https://medium.com/@igorsantos07/my-preferred-merge-strategy-for-pull-requests-6a9db5b0acd5)_

Best wishes of no-conflict merges!
Dynamically load data on div scroll using php, mysql, jquery and ajax
Tags: php, mysql, webdev, ajax
Published: 2018-08-03 04:08:49

---
title: Dynamically load data on div scroll using php, mysql, jquery and ajax
published: true
description: Dynamically load data on div scroll using php, mysql, jquery and ajax
tags: #php #mysql #webdev #ajax
---

Post Link : https://www.skptricks.com/2017/11/dynamically-load-data-on-div-scroll-using-php-mysql-jquery-and-ajax.html

n this tutorial, we will show you how can you dynamically load data on div tag using PHP, MySQL, JQuery and Ajax. We have used similar paging technique like Facebook to load data from database. Whenever user scroll down and reach to bottom of the page, then it will fetch the new data from database without page reload.
Facebook Style Auto Scroll Pagination using jQuery and PHP
Lets see the below complete example, where we Load Data on Page Scroll using JQuery Ajax PHP from MySQL Database.

<a href="https://www.skptricks.com/2017/11/dynamically-load-data-on-div-scroll-using-php-mysql-jquery-and-ajax.html">Dynamically load data on div scroll using php, mysql, jquery and ajax </a>

<img src="https://1.bp.blogspot.com/-sXlrictlbPA/Wf7CZ-5DiiI/AAAAAAAABAw/1NfOjpVpNncOodx4E6QxFPLXSTlo1JQxwCLcBGAs/s400/1.PNG" />


{% youtube rRLgGmO8rWY %}

<a href="https://www.skptricks.com/2017/11/dynamically-load-data-on-div-scroll-using-php-mysql-jquery-and-ajax.html">Read More...</a>
Android-Kotlin Digest #3 – A gist of Collection types
Tags: android, appdev, blog, code
Published: 2018-08-04 04:44:22

---
title: Android-Kotlin Digest #3 – A gist of Collection types
published: true
tags: android,appdev,blog,code
canonical_url: https://itscoderslife.wordpress.com/2018/08/03/android-kotlin-digest-3-a-gist-of-collection-types/
---

Today in Kotlin, learnt about _Arrays, Hashmaps, ArrayList, MutableList, MapOf, ArrayOf_. Here is gist of things.

In  **Swift**  we have all the functionalities of Array in one place.

In here  **Kotlin**  we may need to use combination of _Array_ and _ArrayList_.

Here are few Kotlin examples:

**Array** :

`var myArray = Array<Int>(6){2}
for (element in myArray) {
println("Item - " + element)
}`

for (index in 0..myArray.size - 1) {  
println(myArray[index])  
}

**ArrayList** :

`var myArrayList = ArrayList<String>()
myArrayList.add("It's")
myArrayList.add("Coders")
myArrayList.add("Life")`

if (myArrayList.contains("Coders"))  
println("He's a rockstar!")

myArrayList.remove("Coders")  
myArrayList.add("Dams")

//iterating through objects  
for (names in myArrayList) {  
println("Names:" + names)  
}

**HashMap** : (Dictionary in Swift)

`var hashmap = HashMap<String, String>()
hashmap.put("Mary", "Married")
hashmap.put("Paulo", "Married")
hashmap.put("John", "Single")`

for (k in hashmap.keys)  
println(hashmap.get(k))

**Other Collection Utilities:**

`var myArrayList = listOf<String>("Me", "James", "Bonni", "Life")
var mutableList = mutableListOf<String>("Me", "They", "James")
var myHashmap = hashMapOf(1 to "Paulo", 2 to "James")`

happyCoding();
First open source contribution
Tags: opensource, rails, agileventures, slack
Published: 2018-08-02 19:57:37

---
title: First open source contribution
published: true
description: Contributing to open source
tags: open source, rails, agileventures, slack
---
I have just joined this wonderful community of developers https://www.agileventures.org/ and was looking for interesting projects to work on.

I am currently working on this [project](https://github.com/roschaefer/rundfunk-mitbestimmen) because it was the easiest to set up. It uses docker compose to set up the development environment. I was very lucky to join a pairing session with 
 [Robert](https://github.com/roschaefer). I have even been assigned a beginner friendly issue [there](https://github.com/roschaefer/rundfunk-mitbestimmen/issues/427).
I have started working on that issue. I just wish I would have started contributing earlier. It is fun!

If any one else out there wants to contribute to open source, I found this interesting. You can just join the slack [here](https://agileventures.slack.com/).

I have 3 years of professional Ruby on Rails experience, a full stack developer. If any one else out there know any interesting projects that I can contribute to please comment.

I can't wait to commit to dev.to as well [here](https://github.com/thepracticaldev/dev.to).
How to maintain a personal reusable code library
Tags: reusable, web, webdev
Published: 2018-08-02 18:51:32

---
title: How to maintain a personal reusable code library
published: true
description: A little debate about reusable code
tags: reusable, web, web development
---

Hello devs,

Today I wanted to start a little debate about reusable code. As a **(web)** developer and more specifically a data analyst, I always find myself searching for old code that I wrote, to copy 'n' past it in my newest project.

I was thinking about making a library just for myself but most of the time, the context changed (even slightly) with the years, and it's quite hard sometimes to reimplement the copied method. 

So, what are your little tricks about it? Do you build an entire API that you reuse all the time? Or maybe you have a use huge list of method references wrote in Markdown on an old HDD?
Explain iOS development like I'm five
Tags: explainlikeimfive, swift, objectivec, ios
Published: 2018-08-02 18:45:16

---
title: Explain iOS development like I'm five
published: true
description: 
tags: explainlikeimfive, swift, objectivec, ios
---

I've been getting into iOS development and Swift, and I'm getting to like it. I sort of know how I _could_ do most things, and I've happily been going through Stack Overflow and some videos, but I'm still nervous about a lot of conceptual things. I'd love an explanation for dummies on things like:

- Where do I put reusable functions?
- What is `AppDelegate`'s role?
- Where would I put my models?
- Is it more of a "one right way" or a "many right ways" culture?
- Is Swift "culture" different from Obj C in any meaningful way?
- What do web developers typically least understand about iOS development?

And on and on and on. I mostly feel like I don't know what I don't know. Eventually I'll get all of this, but I feel like any and all tips on things I should look out for would be super helpful to me (and many others I'd imagine).

Thanks a lot!
Changelog for developers?
Tags: discuss, productivity
Published: 2018-08-02 18:27:46

---
title: Changelog for developers?
published: true
description: Potential way to help teams work together on projects
tags: discuss, productivity
---
As you may have seen I recently created a post asking for ways to increase the Bus Factor of a project. {% link https://dev.to/scottharrisondev/how-to-increase-your-bus-factor-3dpg %} There were some great responses and it prompted my team to adopt a process where when submitting a code review you select all the other developers as reviewers (not every developer has to approve the request though as this could get tiresome). This should help with knowledge sharing across projects and developers within the team.

A common, and related problem amongst teams of developers working on a project together is keeping everyone in the loop when something changes within the project, be it a code, design or devops related change.

A possible solution I've thought of is sort of a changelog, but for developers not end users. The idea being that there would be a changelog.md file in the root of each project which gets updated whenever a feature is merged to the master branch. The message should be simple but convey anything that may be relevant for a future developer to understand.

For instance, recently a developer made a change to our docker setup and updated the readme.md to reflect this change, however upon picking up the project to add a new feature I didn't check the readme.md and my environment wouldn't work. Rather than looking through commit history or disturbing another developer I could simply have looked at the changelog.md file and seen the following:

```
31/07/2018
- Now use docker-sync for handling storage in project, details of what you need to change in README.md
```

This simple message tells me all I need to know before I pick up the project again and get involved. This could be seen as duplication of commit messages but i often find commit messages offer quite technical details of what has changed which isn't always important when you are just jumping back into a project, especially if you aren't touching the part in those commits, however it can be handy to get a one sentence overview of what has changed in more of a high level way.

A colleague showed me this and it seems like this is spot on with what I had in mind: https://keepachangelog.com/en/1.0.0/

What do you think?
A fuzzball of an introduction.
Tags: introductions
Published: 2017-05-22 15:17:49

---
title: A fuzzball of an introduction.
published: true
description: My introduction post
tags: introductions
---

!["Code tailored WHILE U WAIT."](https://thepracticaldev.s3.amazonaws.com/i/9v4lu0pavjlr83gkna6d.png)

What can I say... Well... I've been programing in various languages (C, multiple dialects of Basic, C++, Perl, PHP, Python, Informix 4GL, bash) for over 30 years now.  Slowly I'm tossing some code up on [my GitHub repo](https://github.com/STrRedWolf).

Mainly, though, I'm a generalist programmer.  Toss me at some project, and I'll research it and get it done.  I like my programming languages to resolve integer 0 to *false* and my code well formatted yet compact.

I work for [Edge Hosting, LLC](http://edgehosting.com) and take the [MARC train](http://mta.maryland.gov) into Baltimore every day. There, I'm mostly writing up C# and Python.

There's much that I didn't know about, but Dev.To's been very useful for some coding here and at home.  Plus, the "books" have been useful (O'RLY? YA RLY!).

For the name and avatar pog?  Well, that's a bit of history that may be divulged later on...
Web App Help
Tags: help
Published: 2018-08-02 17:39:48

---
title: Web App Help
published: true
tags: help
---

I want to create the following web app.

Web App description: This web app will have 4 buttons on the screen for phone1.  Each button has a unique color and when its pressed, it will change the background color on the screen of phone2.

So the reason I want to do this as a web app is that I've already done it as an iOS app using Multipeer Connectivity... and I like the idea of not having to download a native app and including my android friends.  I think this is just a simple app to get started with web app development, but I'm a newbie and feel a little unsure of my current direction.

I'd like some advice on what technology to use for this project.  My research has led me to websockets to accomplish this instead of socket.io or webRTC.  So here are some of the questions that are in my head:

Is websockets the right tech?
Will websockets let me connect more than 2 devices?
Do I need to use node.js too?
Will iOS Safari support the tech I use (I have iOS 11.4)?
Where can I host this web app for free?