# Share your approach!

**URL:** https://community.drivendata.org/t/share-your-approach/65
**Category:** Pump it Up: Data Mining the Water Table
**Created:** [February 10, 2015, 3:36pm UTC](https://community.drivendata.org/t/share-your-approach/65 "2015-02-10T15:36:15Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![bull](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/bull/32/8_2.png) [@bull](https://community.drivendata.org/u/bull)
#### Post date: [February 10, 2015, 3:36pm UTC](https://community.drivendata.org/t/share-your-approach/65/1 "2015-02-10T15:36:15Z")

</div>

Like with [Blood Donations](http://www.drivendata.org/competitions/2/) and [Millenium Development Goals](http://www.drivendata.org/competitions/1/), this competition is just for fun so we want to treat it as a learning opportunity.

What approaches are you using to tackle this data? Sharing your process and tools helps our community members that are launching their data science careers learn and improve.

- What score and rank have you achieved?
- Do you use Python or R? Julia or Java? Stata or SAS?
- Are you preprocessing any of the features?
- Are you using an ensemble of methods or leaning on something standard?
- What features of the data help or hurt your solutions?
- If you’ve got your code on GitHub or elsewhere, share a link!

---

<div class="post-metadata">

### Author: ![washier](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/washier/32/24_2.png) [@washier](https://community.drivendata.org/u/washier)
#### Post date: [February 11, 2015, 12:13pm UTC](https://community.drivendata.org/t/share-your-approach/65/2 "2015-02-11T12:13:44Z")

</div>

Score = 0.8218 (current rank = 2)  
Using R to clean data\preprocess features, C# to model (using ALGLIB[1](http://www.alglib.net/))  
Dropped some features and reduced the number of levels for some of the factors(categorical features). Created 2 new features.  
No ensembles, nothing special.

---

<div class="post-metadata">

### Author: ![BKR](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@BKR](https://community.drivendata.org/u/BKR)
#### Post date: [February 25, 2015, 4:46am UTC](https://community.drivendata.org/t/share-your-approach/65/3 "2015-02-25T04:46:23Z")

</div>

Hi @washier , do you mind sharing your r code and provide a bit more detail?  
Do you have an email where I can contact you?

---

<div class="post-metadata">

### Author: ![washier](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/washier/32/24_2.png) [@washier](https://community.drivendata.org/u/washier)
#### Post date: [February 25, 2015, 7:04am UTC](https://community.drivendata.org/t/share-your-approach/65/4 "2015-02-25T07:04:13Z")

</div>

@BKR,

Sure. Apparently I can’t attach anything other than images to this message, so I’ll share some Dropbox links. Hope that’s OK.

2 pieces of R code. The [first](https://www.dropbox.com/s/rmdbv8ynmfkv5uf/clean_data.R?dl=0) piece of code cleans the data, and produces 2 new csv’s(one for the training data, the other for the test data). The comments in the code should explain everything.

The [second](https://www.dropbox.com/s/rkxg8whc0c9n0wq/dummy.R?dl=0) piece of code transforms the data produced by the first piece of code by changing all the factors to dummy variables. This is required by ALGLIB.

I feed the data produced by the second piece of code to ALGLIB’s [Random Decision Forest](http://www.alglib.net/dataanalysis/decisionforest.php) algorithm.

---

<div class="post-metadata">

### Author: ![BKR](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@BKR](https://community.drivendata.org/u/BKR)
#### Post date: [February 25, 2015, 9:25am UTC](https://community.drivendata.org/t/share-your-approach/65/5 "2015-02-25T09:25:48Z")

</div>

Score = 0.8106, Rank = 7  
SQL to clean/prep data. Also dropped some variables and created a few new ones. I am not yet happy with my data and still experimenting with ideas. One area where I am unsure about best practice is reducing levels of categorical variables.  
Modeling in R (Caret), best score with ensemble of about 6 models.  
Tried H2O, but failed so far mostly due to overfitting.

---

<div class="post-metadata">

### Author: ![sushiyan](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@sushiyan](https://community.drivendata.org/u/sushiyan)
#### Post date: [March 18, 2015, 7:07am UTC](https://community.drivendata.org/t/share-your-approach/65/6 "2015-03-18T07:07:31Z")

</div>

There are many wells with population = 0, that is 37% of the pumps. Anyone have any idea if the data is accurate or it is a failure to capture the actual population?

---

<div class="post-metadata">

### Author: ![tjox](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@tjox](https://community.drivendata.org/u/tjox)
#### Post date: [March 23, 2015, 5:35am UTC](https://community.drivendata.org/t/share-your-approach/65/7 "2015-03-23T05:35:28Z")

</div>

Pretty sure 0 is equivalent to missing. There’s seems to be quite a bit of missing data across all the variables, though it’s not consistently coded. Might be worth experimenting with multiple imputation.

I managed to get to .798 with a random forest. I tried collapsing the funder/installer variables into something akin to international/government/local/unknown with the assumption that there might be a quality difference, but it was only a marginal improvement .76. The model basically fails to predict the ‘in need of repairs’ category completely, unfortunately.

---

<div class="post-metadata">

### Author: ![Jellis](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@Jellis](https://community.drivendata.org/u/Jellis)
#### Post date: [June 2, 2015, 4:17pm UTC](https://community.drivendata.org/t/share-your-approach/65/8 "2015-06-02T16:17:02Z")

</div>

Thank you for the cleaned data. I have been working on the $installer portion for days, basically taking the long way around trying to code each variable. I am a noob at the data engineering experience, but I feel silly for not thinking about the **summary()** option for these values.

---

<div class="post-metadata">

### Author: ![KeynesYouDigIt](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/keynesyoudigit/32/140_2.png) [@KeynesYouDigIt](https://community.drivendata.org/u/KeynesYouDigIt)
#### Post date: [July 15, 2015, 4:25am UTC](https://community.drivendata.org/t/share-your-approach/65/9 "2015-07-15T04:25:12Z")

</div>

Dude, this is very well done. Bravo. Are you taking questions on your method still, this late in the game? I thnk I get what you are doing but I might still have a thing or two I want to run by you.

---

<div class="post-metadata">

### Author: ![washier](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/washier/32/24_2.png) [@washier](https://community.drivendata.org/u/washier)
#### Post date: [July 15, 2015, 2:53pm UTC](https://community.drivendata.org/t/share-your-approach/65/10 "2015-07-15T14:53:38Z")

</div>

Thanks. It’s quite a while back but, fire away, I’ll try to answer as best I can 😃

---

<div class="post-metadata">

### Author: ![KeynesYouDigIt](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/keynesyoudigit/32/140_2.png) [@KeynesYouDigIt](https://community.drivendata.org/u/KeynesYouDigIt)
#### Post date: [July 29, 2015, 4:16am UTC](https://community.drivendata.org/t/share-your-approach/65/11 "2015-07-29T04:16:55Z")

</div>

Thanks! sorry it took so dang long to get back to you. Im a pretty big Data Science n00b so bear with me.

Why not start your sorting and mining by binding the “output” (functional, non-functional)

```
dat <- merge(train, Output)
date_recorded_offset_days <- as.numeric(as.Date("2014-01-01") - as.Date(dat$date_recorded))
date_recorded_month <- factor(format(as.Date(dat$date_recorded), "%b"))
dat <- dat[, -which(names(dat) == "date_recorded")]
dat <- cbind(dat, date_recorded_offset_days)
dat <- cbind(dat, date_recorded_month)
```

---

<div class="post-metadata">

### Author: ![dipetkov](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@dipetkov](https://community.drivendata.org/u/dipetkov)
#### Post date: [November 14, 2015, 12:18pm UTC](https://community.drivendata.org/t/share-your-approach/65/12 "2015-11-14T12:18:55Z")

</div>

I used H2O’s random forest to get a score of .821. I spent more time transforming the features, deciding which features to keep and which features to transform. Otherwise I used the randomForest method with most of its default values, except for the number of trees to build. The code is on GitHub:

> **[GitHub - dipetkov/DrivenData-PumpItUp](https://github.com/dipetkov/DrivenData-PumpItUp)**
>
> Contribute to dipetkov/DrivenData-PumpItUp development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![bull](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/bull/32/8_2.png) [@bull](https://community.drivendata.org/u/bull)
#### Post date: [November 14, 2015, 10:28pm UTC](https://community.drivendata.org/t/share-your-approach/65/13 "2015-11-14T22:28:16Z")

</div>

Thanks for sharing, @dipetkov. ❤ that you included `.md` documentation of your process!

---

<div class="post-metadata">

### Author: ![Abdul](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Abdul](https://community.drivendata.org/u/Abdul)
#### Post date: [November 27, 2015, 11:10pm UTC](https://community.drivendata.org/t/share-your-approach/65/14 "2015-11-27T23:10:12Z")

</div>

Hey pals, glad to come across this competition, pls is anyone using matlab, will like some clue on how to start working on this with matlab. first year Msc student. cheers

---

<div class="post-metadata">

### Author: ![bhagyeshvikani](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/bhagyeshvikani/32/410_2.png) [@bhagyeshvikani](https://community.drivendata.org/u/bhagyeshvikani)
#### Post date: [June 25, 2016, 6:57pm UTC](https://community.drivendata.org/t/share-your-approach/65/15 "2016-06-25T18:57:16Z")

</div>

Hello everyone,

My approach is very simple and uses RandomForest Classifier with 200 estimators. I ignored “wpt\_name”, “subvillage”, “funder”, “installer” from the dataset.

I got score = 0.8205 and rank = 47.

---

<div class="post-metadata">

### Author: ![holly](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/holly/32/317_2.png) [@holly](https://community.drivendata.org/u/holly)
#### Post date: [July 6, 2016, 12:55pm UTC](https://community.drivendata.org/t/share-your-approach/65/16 "2016-07-06T12:55:35Z")

</div>

Hello! Did you transform string values to integers? And how?

---

<div class="post-metadata">

### Author: ![bhagyeshvikani](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/bhagyeshvikani/32/410_2.png) [@bhagyeshvikani](https://community.drivendata.org/u/bhagyeshvikani)
#### Post date: [July 7, 2016, 9:14am UTC](https://community.drivendata.org/t/share-your-approach/65/17 "2016-07-07T09:14:32Z")

</div>

Hii, Yes I transformed string values to integers. For transformation, I assigned unique number to each unique label in both training and testing data set for every features contains string values.

If you have any doubt feel free to ask.

---

<div class="post-metadata">

### Author: ![holly](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/holly/32/317_2.png) [@holly](https://community.drivendata.org/u/holly)
#### Post date: [July 8, 2016, 4:57pm UTC](https://community.drivendata.org/t/share-your-approach/65/18 "2016-07-08T16:57:05Z")

</div>

Thank you for your answer!

---

<div class="post-metadata">

### Author: ![arnabitsme](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@arnabitsme](https://community.drivendata.org/u/arnabitsme)
#### Post date: [August 1, 2016, 2:27pm UTC](https://community.drivendata.org/t/share-your-approach/65/19 "2016-08-01T14:27:54Z")

</div>

> [@bhagyeshvikani](#):
>
> My approach is very simple and uses RandomForest Classifier with 200 estimators

Hi,  
Looking at the problem , I was just thinking if we can use Logistic regression as we need to predict the status “Functional/Non functional” based on the calculated probability only.  
Regards  
Arnab

---

<div class="post-metadata">

### Author: ![bhagyeshvikani](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.drivendata.org/bhagyeshvikani/32/410_2.png) [@bhagyeshvikani](https://community.drivendata.org/u/bhagyeshvikani)
#### Post date: [August 3, 2016, 11:42pm UTC](https://community.drivendata.org/t/share-your-approach/65/20 "2016-08-03T23:42:08Z")

</div>

Absolutely we can use logistic regression to binary classification. But I found it less accurate than random forest.

What is your score with logistic regression?

[Next page](https://community.drivendata.org/t/share-your-approach/65.md?page=2)
