Coder Social home page Coder Social logo

jenskrumsieck / bundestag-project Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 2.13 MB

I took a machine learning in python course recently and wanted to practice what i have learnt in this course. This repository contains the progress i made in two days with scraping polls from the website of the german Bundestag.

Jupyter Notebook 44.52% Python 55.48%
sklearn machine-learning bundestag

bundestag-project's Introduction

Bundestag Polls

bundestag19

I took a machine learning in python course recently and wanted to practice what i have learnt in this course. This repository contains the progress i made in two days with scraping polls from the website of the german Bundestag.

The poll data was scraped using code in the scraper subfolder and stored in csv files in the data subfolder. The files are named as follows: [Voting Period]_data.csv containing columns for each poll and are named with the following scheme: [Period]-[Session]-[Poll]

Jupyter Notebook index.ipynb contains an attempt to do classfication with supervised machine learning using a Pipeling and GridSearchCV. Best Values for 19th Bundestag (Score: 76.78%):

{'classifier__knn__n_neighbors': 3, 'classifier__pca__n_components': 4}

Pipeline:

vote_cols = [c for c in df.columns if "-" in c]
Pipeline(steps=[('preprocess',
                 ColumnTransformer(sparse_threshold=0,
                                   transformers=[('preprocess_vote',
                                                  Pipeline(steps=[('imputer',
                                                                   SimpleImputer(fill_value='Abwesend',
                                                                                 strategy='constant')),
                                                                  ('onehot',
                                                                   OneHotEncoder(handle_unknown='ignore'))]),
                                                  vote_cols)])),
                ('classifier',
                 Pipeline(steps=[('pca', PCA()),
                                 ('knn', KNeighborsClassifier())]))])

Result

The major take-away from this project for me was that you can clearly see in the Visualizations who is the governing coalition in each period and the obligation to vote in accordance with party policy. The classification is not very useful as for yourself to classify a lot of polls have to be taken - although this would be a nice idea for further development.

Visualization is done using tSNE.

19th Bundestag:

18th Bundestag:

17th Bundestag:

20th Bundestag (current):

combined Bundestags (does that even make sense? ๐Ÿ˜‰)

bundestag-project's People

Contributors

jenskrumsieck avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.