Giter Site home page Giter Site logo

rahuljadli / titanic-survival-prediction Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 216 KB

Predicting the survival of the passenger

Jupyter Notebook 100.00%
titanic-survival-prediction titanic-kaggle machine-learning knn-classifier decision-tree logistic-regression

titanic-survival-prediction's Introduction

Titanic Survival Prediction

Imported all the required library

import pandas as pd
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.neighbors import KNeighborsClassifier
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeClassifier

Loading and Viewing the data

data=pd.read_csv('titanic_data.csv')
data.head()

Data Visualisation

Ploting the survival rate

alt Survived

Ploting Age graph

alt Age

Ploting Survival Based on Sex

alt Sex Survival

Ploting Survival Based on Passenger Class

alt Sex Survival

Ploting Survival Based on Sibling

alt Sex Survival

Ploting Survival Based on Parents

alt Sex Survival

Data filling

clean_test.Age = clean_test.Age.fillna(titanic_data['Age'].mean())
testing_data.Fare=testing_data.Fare.fillna(data.Fare.mean())

Using Different Model's

Creating Training and Testing Data set

x_train, x_test, y_train, y_test = train_test_split(X, Y, test_size=0.20, random_state=42)

Training the model

model=LogisticRegression()
model.fit(x_train,y_train)

Making the prediction

new_prediction=model.predict(testing_data)

Getting the accuracy score

from sklearn.metrics import accuracy_score


acc_logreg = round(accuracy_score(prediction, y_test) * 100, 2)
print(acc_logreg)

titanic-survival-prediction's People

Contributors

rahuljadli avatar

Stargazers

 avatar  avatar

Watchers

 avatar

titanic-survival-prediction's Issues

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.