diff --git "a/github_ronelsolomon_dma.git.json" "b/github_ronelsolomon_dma.git.json"
new file mode 100644--- /dev/null
+++ "b/github_ronelsolomon_dma.git.json"
@@ -0,0 +1,34 @@
+{
+ "repository_url": "https://github.com/ronelsolomon/dma.git",
+ "owner": "ronelsolomon",
+ "name": "dma.git",
+ "extracted_at": "2026-03-02T22:49:45.639057",
+ "files": {
+ "Skylight Documentation.html": {
+ "content": "\n\n \n
Shortcut \n\n
Skylight Documentation \n \n
Skylight Documentation \n \n
\n",
+ "size": 445,
+ "language": "html"
+ },
+ "salary.ipynb": {
+ "content": "{\"nbformat\":4,\"nbformat_minor\":0,\"metadata\":{\"colab\":{\"provenance\":[],\"authorship_tag\":\"ABX9TyOUwkeKm7aHEuw8UwateZtH\"},\"kernelspec\":{\"name\":\"python3\",\"display_name\":\"Python 3\"},\"language_info\":{\"name\":\"python\"}},\"cells\":[{\"cell_type\":\"code\",\"execution_count\":54,\"metadata\":{\"id\":\"qapNIsc_sgDF\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768003511,\"user_tz\":480,\"elapsed\":522,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"outputs\":[],\"source\":[\"import re\\n\",\"import urllib\\n\",\"from time import sleep\"]},{\"cell_type\":\"code\",\"source\":[\"url = \\\"http://www.espn.com/nba/salaries/_/year/2022/page\\\"\\n\",\"f = urllib.request.urlopen(url)\\n\",\"#print(f)\\n\",\"r_source = f.read().decode('utf-8')\\n\",\"r_source\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":178},\"id\":\"Np1o4Mp0vVuP\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768004049,\"user_tz\":480,\"elapsed\":540,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"d6585612-919d-45f5-9ed5-c6b1e67fc02f\"},\"execution_count\":55,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"'\\\\n\\\\n\\\\n
\\\\n\\\\n \\\\n \\\\n \\\\n \\\\nNBA Player Salaries - National Basketball Association - ESPN \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n \\\\n\\\\n\\\\t\\\\t\\\\n \\\\n \\\\n \\\\n \\\\n \\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n \\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n
\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n
\\\\n\\\\n\\\\n\\\\n\\\\t\\\\n\\\\t\\\\n\\\\t\\\\n\\\\t\\\\n\\\\n\\\\t\\\\n\\\\t\\\\t\\\\n\\\\t\\\\n\\\\n\\\\n\\\\n'\"],\"application/vnd.google.colaboratory.intrinsic+json\":{\"type\":\"string\"}},\"metadata\":{},\"execution_count\":55}]},{\"cell_type\":\"code\",\"source\":[\"playreg = ('\\\"http:\\\\/\\\\/www\\\\.espn\\\\.com\\\\/nba\\\\/player\\\\/_\\\\/id\\\\/\\\\d+\\\\/\\\\w+\\\\-\\\\w+\\\\\\\"\\\\>(\\\\w+\\\\s\\\\w+)[^\\\"]+\\\\\\\"[^\\\"]+\\\\\\\"[^\\\"]+\\\\\\\"[^\\\"]+\\\\\\\"\\\\>\\\\$([^\\\"]+)\\\\<\\\\/td')\\n\",\"playreg\\n\",\"info = re.findall(playreg, r_source)\\n\",\"len(info)\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"6XMw8DcRvd7k\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768004050,\"user_tz\":480,\"elapsed\":11,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"20d9e8ed-1548-4d20-ac90-db841c28f82c\"},\"execution_count\":56,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"37\"]},\"metadata\":{},\"execution_count\":56}]},{\"cell_type\":\"code\",\"source\":[\"def get_player_info(roster_url):\\n\",\" abs = urllib.request.urlopen(roster_url)\\n\",\" rosource = a.read().decode('utf-8')\\n\",\" sleep(0.5)\\n\",\" reg = ('\\\"http:\\\\/\\\\/www\\\\.espn\\\\.com\\\\/nba\\\\/player\\\\/_\\\\/id\\\\/\\\\d+\\\\/\\\\w+\\\\-\\\\w+\\\\\\\"\\\\>(\\\\w+\\\\s\\\\w+)[^\\\"]+\\\\\\\"[^\\\"]+\\\\\\\"[^\\\"]+\\\\\\\"[^\\\"]+\\\\\\\"\\\\>\\\\$([^\\\"]+)\\\\<\\\\/td')\\n\",\" \\n\",\" info = re.findall(reg, rosource)\\n\",\" \\n\",\" return info\"],\"metadata\":{\"id\":\"al9KmlcozuAZ\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768004050,\"user_tz\":480,\"elapsed\":7,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":57,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"all_players = []\\n\",\"all_players2 = []\\n\",\"for i in range(0, 14):\\n\",\" url = \\\"http://www.espn.com/nba/salaries/_/page/\\\" + str(i)\\n\",\" print(url)\\n\",\" x = get_player_info(url)\\n\",\" for i in x:\\n\",\" all_players.append(i[0])\\n\",\" for i in x:\\n\",\" all_players2.append(i[1])\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"kJ7fwvTmzi2g\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017720,\"user_tz\":480,\"elapsed\":13677,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"50277619-11d6-43d1-f27b-59002b9271e9\"},\"execution_count\":58,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stdout\",\"text\":[\"http://www.espn.com/nba/salaries/_/page/0\\n\",\"http://www.espn.com/nba/salaries/_/page/1\\n\",\"http://www.espn.com/nba/salaries/_/page/2\\n\",\"http://www.espn.com/nba/salaries/_/page/3\\n\",\"http://www.espn.com/nba/salaries/_/page/4\\n\",\"http://www.espn.com/nba/salaries/_/page/5\\n\",\"http://www.espn.com/nba/salaries/_/page/6\\n\",\"http://www.espn.com/nba/salaries/_/page/7\\n\",\"http://www.espn.com/nba/salaries/_/page/8\\n\",\"http://www.espn.com/nba/salaries/_/page/9\\n\",\"http://www.espn.com/nba/salaries/_/page/10\\n\",\"http://www.espn.com/nba/salaries/_/page/11\\n\",\"http://www.espn.com/nba/salaries/_/page/12\\n\",\"http://www.espn.com/nba/salaries/_/page/13\\n\"]}]},{\"cell_type\":\"code\",\"source\":[\"all_players\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"O8bSTg6n0d3I\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017720,\"user_tz\":480,\"elapsed\":69,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"2fba7a78-25fb-444c-acb9-0e2264f075d7\"},\"execution_count\":59,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"['Stephen Curry',\\n\",\" 'Russell Westbrook',\\n\",\" 'LeBron James',\\n\",\" 'Kevin Durant',\\n\",\" 'Bradley Beal',\\n\",\" 'Damian Lillard',\\n\",\" 'Giannis Antetokounmpo',\\n\",\" 'Kawhi Leonard',\\n\",\" 'Paul George',\\n\",\" 'Klay Thompson',\\n\",\" 'Rudy Gobert',\\n\",\" 'Anthony Davis',\\n\",\" 'Khris Middleton',\\n\",\" 'Jimmy Butler',\\n\",\" 'Tobias Harris',\\n\",\" 'Zach LaVine',\\n\",\" 'Luka Doncic',\\n\",\" 'Trae Young',\\n\",\" 'Kyrie Irving',\\n\",\" 'Pascal Siakam',\\n\",\" 'Ben Simmons',\\n\",\" 'Kristaps Porzingis',\\n\",\" 'Devin Booker',\\n\",\" 'Jrue Holiday',\\n\",\" 'Joel Embiid',\\n\",\" 'Andrew Wiggins',\\n\",\" 'CJ McCollum',\\n\",\" 'Nikola Jokic',\\n\",\" 'James Harden',\\n\",\" 'Brandon Ingram',\\n\",\" 'Jamal Murray',\\n\",\" 'Deandre Ayton',\\n\",\" 'Donovan Mitchell',\\n\",\" 'Bam Adebayo',\\n\",\" 'Gordon Hayward',\\n\",\" 'Stephen Curry',\\n\",\" 'Russell Westbrook',\\n\",\" 'LeBron James',\\n\",\" 'Kevin Durant',\\n\",\" 'Bradley Beal',\\n\",\" 'Damian Lillard',\\n\",\" 'Giannis Antetokounmpo',\\n\",\" 'Kawhi Leonard',\\n\",\" 'Paul George',\\n\",\" 'Klay Thompson',\\n\",\" 'Rudy Gobert',\\n\",\" 'Anthony Davis',\\n\",\" 'Khris Middleton',\\n\",\" 'Jimmy Butler',\\n\",\" 'Tobias Harris',\\n\",\" 'Zach LaVine',\\n\",\" 'Luka Doncic',\\n\",\" 'Trae Young',\\n\",\" 'Kyrie Irving',\\n\",\" 'Pascal Siakam',\\n\",\" 'Ben Simmons',\\n\",\" 'Kristaps Porzingis',\\n\",\" 'Devin Booker',\\n\",\" 'Jrue Holiday',\\n\",\" 'Joel Embiid',\\n\",\" 'Andrew Wiggins',\\n\",\" 'CJ McCollum',\\n\",\" 'Nikola Jokic',\\n\",\" 'James Harden',\\n\",\" 'Brandon Ingram',\\n\",\" 'Jamal Murray',\\n\",\" 'Deandre Ayton',\\n\",\" 'Donovan Mitchell',\\n\",\" 'Bam Adebayo',\\n\",\" 'Gordon Hayward',\\n\",\" 'Kevin Love',\\n\",\" 'Jaylen Brown',\\n\",\" 'Chris Paul',\\n\",\" 'Kyle Lowry',\\n\",\" 'Jayson Tatum',\\n\",\" 'Jalen Brunson',\\n\",\" 'DeMar DeRozan',\\n\",\" 'Al Horford',\\n\",\" 'Draymond Green',\\n\",\" 'Julius Randle',\\n\",\" 'John Collins',\\n\",\" 'Buddy Hield',\\n\",\" 'Mike Conley',\\n\",\" 'Malcolm Brogdon',\\n\",\" 'Anfernee Simons',\\n\",\" 'Nikola Vucevic',\\n\",\" 'Terry Rozier',\\n\",\" 'Fred VanVleet',\\n\",\" 'Jerami Grant',\\n\",\" 'Spencer Dinwiddie',\\n\",\" 'Mikal Bridges',\\n\",\" 'Jarrett Allen',\\n\",\" 'Aaron Gordon',\\n\",\" 'Eric Gordon',\\n\",\" 'Bojan Bogdanovic',\\n\",\" 'Lonzo Ball',\\n\",\" 'Eric Bledsoe',\\n\",\" 'Caris LeVert',\\n\",\" 'Clint Capela',\\n\",\" 'Joe Harris',\\n\",\" 'Domantas Sabonis',\\n\",\" 'Harrison Barnes',\\n\",\" 'Evan Fournier',\\n\",\" 'Myles Turner',\\n\",\" 'Bogdan Bogdanovic',\\n\",\" 'Steven Adams',\\n\",\" 'Jonathan Isaac',\\n\",\" 'Marcus Smart',\\n\",\" 'Mitchell Robinson',\\n\",\" 'Duncan Robinson',\\n\",\" 'Derrick White',\\n\",\" 'Norman Powell',\\n\",\" 'Dejounte Murray',\\n\",\" 'Collin Sexton',\\n\",\" 'Markelle Fultz',\\n\",\" 'Lauri Markkanen',\\n\",\" 'Davis Bertans',\\n\",\" 'Jusuf Nurkic',\\n\",\" 'Malik Beasley',\\n\",\" 'Luguentz Dort',\\n\",\" 'Jonas Valanciunas',\\n\",\" 'Derrick Rose',\\n\",\" 'Kevin Huerter',\\n\",\" 'Luke Kennard',\\n\",\" 'Will Barton',\\n\",\" 'Christian Wood',\\n\",\" 'Brook Lopez',\\n\",\" 'Doug McDermott',\\n\",\" 'Zion Williamson',\\n\",\" 'Jordan Clarkson',\\n\",\" 'Kyle Kuzma',\\n\",\" 'Gary Harris',\\n\",\" 'Patrick Beverley',\\n\",\" 'Josh Hart',\\n\",\" 'Chris Boucher',\\n\",\" 'Robert Covington',\\n\",\" 'Kelly Olynyk',\\n\",\" 'Josh Richardson',\\n\",\" 'Terrence Ross',\\n\",\" 'Dillon Brooks',\\n\",\" 'Richaun Holmes',\\n\",\" 'Reggie Jackson',\\n\",\" 'Dwight Powell',\\n\",\" 'Paolo Banchero',\\n\",\" 'RJ Barrett',\\n\",\" 'Bobby Portis',\\n\",\" 'Nicolas Batum',\\n\",\" 'Anthony Edwards',\\n\",\" 'Cade Cunningham',\\n\",\" 'Mo Bamba',\\n\",\" 'Derrick Favors',\\n\",\" 'Jae Crowder',\\n\",\" 'Ivica Zubac',\\n\",\" 'Alec Burks',\\n\",\" 'Reggie Bullock',\\n\",\" 'Danny Green',\\n\",\" 'Chet Holmgren',\\n\",\" 'Ja Morant',\\n\",\" 'James Wiseman',\\n\",\" 'Landry Shamet',\\n\",\" 'Malik Monk',\\n\",\" 'Jalen Green',\\n\",\" 'Jakob Poeltl',\\n\",\" 'Dario Saric',\\n\",\" 'Nerlens Noel',\\n\",\" 'Kemba Walker',\\n\",\" 'Monte Morris',\\n\",\" 'Mason Plumlee',\\n\",\" 'Alex Caruso',\\n\",\" 'Maxi Kleber',\\n\",\" 'Darius Garland',\\n\",\" 'Kyle Anderson',\\n\",\" 'Victor Oladipo',\\n\",\" 'Daniel Theis',\\n\",\" 'LaMelo Ball',\\n\",\" 'Nic Claxton',\\n\",\" 'Grayson Allen',\\n\",\" 'Seth Curry',\\n\",\" 'Evan Mobley',\\n\",\" 'Keegan Murray',\\n\",\" 'Thaddeus Young',\\n\",\" 'Taurean Prince',\\n\",\" 'Kevon Looney',\\n\",\" 'Isaiah Hartenstein',\\n\",\" 'Delon Wright',\\n\",\" 'Patrick Williams',\\n\",\" 'Scottie Barnes',\\n\",\" 'Cedi Osman',\\n\",\" 'Coby White',\\n\",\" 'Aron Baynes',\\n\",\" 'Zach Collins',\\n\",\" 'Jaden Ivey',\\n\",\" 'Isaac Okoro',\\n\",\" 'Cody Martin',\\n\",\" 'Jalen Suggs',\\n\",\" 'Jaxson Hayes',\\n\",\" 'Khem Birch',\\n\",\" 'Bennedict Mathurin',\\n\",\" 'Patty Mills',\\n\",\" 'Joe Ingles',\\n\",\" 'Caleb Martin',\\n\",\" 'John Wall',\\n\",\" 'Bruce Brown',\\n\",\" 'Danilo Gallinari',\\n\",\" 'Onyeka Okongwu',\\n\",\" 'Jarrett Culver',\\n\",\" 'Justin Holiday',\\n\",\" 'Josh Giddey',\\n\",\" 'Rui Hachimura',\\n\",\" 'Rudy Gay',\\n\",\" 'Shaedon Sharpe',\\n\",\" 'Cameron Payne',\\n\",\" 'Cam Reddish',\\n\",\" 'Cameron Johnson',\\n\",\" 'Ricky Rubio',\\n\",\" 'Jonathan Kuminga',\\n\",\" 'Pat Connaughton',\\n\",\" 'Tyler Herro',\\n\",\" 'Romeo Langford',\\n\",\" 'Killian Hayes',\\n\",\" 'Dyson Daniels',\\n\",\" 'JaVale McGee',\\n\",\" 'Obi Toppin',\\n\",\" 'Franz Wagner',\\n\",\" 'Kendrick Nunn',\\n\",\" 'Hamidou Diallo',\\n\",\" 'Taj Gibson',\\n\",\" 'Cory Joseph',\\n\",\" 'Torrey Craig',\\n\",\" 'Jeremy Sochan',\\n\",\" 'David Nwaba',\\n\",\" 'Furkan Korkmaz',\\n\",\" 'Dante Exum',\\n\",\" 'Lou Williams',\\n\",\" 'Deni Avdija',\\n\",\" 'Garrett Temple',\\n\",\" 'Davion Mitchell',\\n\",\" 'Johnny Davis',\\n\",\" 'Goga Bitadze',\\n\",\" 'Ish Smith',\\n\",\" 'Dewayne Dedmon',\\n\",\" 'Jalen Smith',\\n\",\" 'Ziaire Williams',\\n\",\" 'Ousmane Dieng',\\n\",\" 'Maurice Harkless',\\n\",\" 'Donte DiVincenzo',\\n\",\" 'Jeff Green',\\n\",\" 'Devin Vassell',\\n\",\" 'Matisse Thybulle',\\n\",\" 'James Bouknight',\\n\",\" 'Brandon Clarke',\\n\",\" 'Jalen Williams',\\n\",\" 'Grant Williams',\\n\",\" 'Darius Bazley',\\n\",\" 'Ty Jerome',\\n\",\" 'Tyrese Haliburton',\\n\",\" 'Nassir Little',\\n\",\" 'Joshua Primo',\\n\",\" 'Jalen Duren',\\n\",\" 'Justise Winslow',\\n\",\" 'Jarred Vanderbilt',\\n\",\" 'Dylan Windler',\\n\",\" 'Chandler Hutchison',\\n\",\" 'Terence Davis',\\n\",\" 'George Hill',\\n\",\" 'Chris Duarte',\\n\",\" 'Ochai Agbaji',\\n\",\" 'Alex Len',\\n\",\" 'Jordan Poole',\\n\",\" 'Keldon Johnson',\\n\",\" 'Aaron Nesmith',\\n\",\" 'Mark Williams',\\n\",\" 'Gabriel Deck',\\n\",\" 'Cole Anthony',\\n\",\" 'Sekou Doumbouya',\\n\",\" 'Moses Moody',\\n\",\" 'Corey Kispert',\\n\",\" 'AJ Griffin',\\n\",\" 'Mike Muscala',\\n\",\" 'Boban Marjanovic',\\n\",\" 'Georges Niang',\\n\",\" 'Chuma Okeke',\\n\",\" 'Isaiah Stewart',\\n\",\" 'Amir Coffey',\\n\",\" 'Alperen Sengun',\\n\",\" 'Tari Eason',\\n\",\" 'Aleksej Pokusevski',\\n\",\" 'Trey Burke',\\n\",\" 'Simone Fontecchio',\\n\",\" 'Andre Drummond',\\n\",\" 'Dalen Terry',\\n\",\" 'Josh Green',\\n\",\" 'Jake LaRavia',\\n\",\" 'Tre Mann',\\n\",\" 'Sterling Brown',\\n\",\" 'Jordan Nwora',\\n\",\" 'Saddiq Bey',\\n\",\" 'Luka Samanic',\\n\",\" 'Malaki Branham',\\n\",\" 'Kai Jones',\\n\",\" 'Precious Achiuwa',\\n\",\" 'Christian Braun',\\n\",\" 'Jalen Johnson',\\n\",\" 'Tyrese Maxey',\\n\",\" 'Bruno Fernando',\\n\",\" 'Trey Lyles',\\n\",\" 'Walker Kessler',\\n\",\" 'Marc Gasol',\\n\",\" 'Anthony Tolliver',\\n\",\" 'Keon Johnson',\\n\",\" 'David Roddy',\\n\",\" 'Isaiah Jackson',\\n\",\" 'Zeke Nnaji',\\n\",\" 'MarJon Beauchamp',\\n\",\" 'Usman Garuba',\\n\",\" 'Willy Hernangomez',\\n\",\" 'Blake Wesley',\\n\",\" 'Josh Christopher',\\n\",\" 'Leandro Bolmaro',\\n\",\" 'Stanley Johnson',\\n\",\" 'Immanuel Quickley',\\n\",\" 'John Konchar',\\n\",\" 'Damian Jones',\\n\",\" 'Quentin Grimes',\\n\",\" 'Andrew Nembhard',\\n\",\" 'Nikola Jovic',\\n\",\" 'Payton Pritchard',\\n\",\" 'Vlatko Cancar',\\n\",\" 'Bones Hyland',\\n\",\" 'Bol Bol',\\n\",\" 'Peyton Watson',\\n\",\" 'Marquese Chriss',\\n\",\" 'Nik Stauskas',\\n\",\" 'Udoka Azubuike',\\n\",\" 'Jaden McDaniels',\\n\",\" 'Jordan McLaughlin',\\n\",\" 'Malachi Flynn',\\n\",\" 'Cam Thomas',\\n\",\" 'Luke Kornet',\\n\",\" 'Desmond Bane',\\n\",\" 'Jahlil Okafor',\\n\",\" 'Jaden Springer',\\n\",\" 'Jevon Carter',\\n\",\" 'Santi Aldama',\\n\",\" 'Frank Ntilikina',\\n\",\" 'Tony Bradley',\\n\",\" 'Jaylin Williams',\\n\",\" 'Kenrich Williams',\\n\",\" 'Abdel Nader',\\n\",\" 'Caleb Houstan',\\n\",\" 'Garrison Mathews',\\n\",\" 'Shake Milton',\\n\",\" 'Edmond Sumner',\\n\",\" 'Jontay Porter',\\n\",\" 'Denzel Valentine',\\n\",\" 'Jalen McDaniels',\\n\",\" 'Daniel Gafford',\\n\",\" 'Naz Reid',\\n\",\" 'Jaylen Nowell',\\n\",\" 'Terance Mann',\\n\",\" 'Dean Wade',\\n\",\" 'Chimezie Metu',\\n\",\" 'Davon Reed',\\n\",\" 'Xavier Tillman',\\n\",\" 'Killian Tillie',\\n\",\" 'Theo Maledon',\\n\",\" 'Moritz Wagner',\\n\",\" 'Svi Mykhailiuk',\\n\",\" 'Thanasis Antetokounmpo',\\n\",\" 'Wenyen Gabriel',\\n\",\" 'Didi Louzada',\\n\",\" 'Oshae Brissett',\\n\",\" 'Juancho Hernangomez',\\n\",\" 'Anthony Gill',\\n\",\" 'Isaiah Joe',\\n\",\" 'Gorgui Dieng',\\n\",\" 'Matthew Dellavedova',\\n\",\" 'Drew Eubanks',\\n\",\" 'Josh Okogie',\\n\",\" 'Damion Lee',\\n\",\" 'Bismack Biyombo',\\n\",\" 'Montrezl Harrell',\\n\",\" 'Ryan Arcidiacono',\\n\",\" 'Markieff Morris',\\n\",\" 'Nathan Knight',\\n\",\" 'Bryn Forbes',\\n\",\" 'Austin Rivers',\\n\",\" 'Wesley Matthews',\\n\",\" 'Serge Ibaka',\\n\",\" 'Udonis Haslem',\\n\",\" 'Thomas Bryant',\\n\",\" 'Matt Ryan',\\n\",\" 'Dennis Schroder',\\n\",\" 'James Johnson',\\n\",\" 'JaMychal Green',\\n\",\" 'Andre Iguodala',\\n\",\" 'Rodney McGruder',\\n\",\" 'DeAndre Jordan',\\n\",\" 'Theo Pinson',\\n\",\" 'Facundo Campazzo',\\n\",\" 'Raul Neto',\\n\",\" 'Robin Lopez',\\n\",\" 'Goran Dragic',\\n\",\" 'Justin Jackson',\\n\",\" 'Noah Vonleh',\\n\",\" 'Blake Griffin',\\n\",\" 'Aaron Holiday',\\n\",\" 'Frank Kaminsky',\\n\",\" 'Wes Iwundu',\\n\",\" 'Dwayne Bacon',\\n\",\" 'Max Strus',\\n\",\" 'Gabe Vincent',\\n\",\" 'Javonte Green',\\n\",\" 'Juwan Morgan',\\n\",\" 'Herbert Jones',\\n\",\" 'Nick Richards',\\n\",\" 'Tre Jones',\\n\",\" 'Isaiah Roby',\\n\",\" 'KZ Okpala',\\n\",\" 'Paul Reed',\\n\",\" 'Yogi Ferrell',\\n\",\" 'Alen Smailagic',\\n\",\" 'Lamar Stevens',\\n\",\" 'Naji Marshall',\\n\",\" 'Miye Oni',\\n\",\" 'Yuta Watanabe',\\n\",\" 'Khyri Thomas',\\n\",\" 'Saben Lee',\\n\",\" 'Devin Cannady',\\n\",\" 'Luca Vildoza',\\n\",\" 'Rayjon Tucker',\\n\",\" 'Haywood Highsmith',\\n\",\" 'Omer Yurtseven',\\n\",\" 'Malik Fitts',\\n\",\" 'Paul Watson',\\n\",\" 'Kelan Martin',\\n\",\" 'Mfiondu Kabengele',\\n\",\" 'Sam Dekker',\\n\",\" 'Jarrell Brantley',\\n\",\" 'Solomon Hill',\\n\",\" 'Trevor Ariza',\\n\",\" 'Semi Ojeleye',\\n\",\" 'Kevin Pangos',\\n\",\" 'Jabari Parker',\\n\",\" 'Enes Freedom',\\n\",\" 'Jericho Sims',\\n\",\" 'Justin Champagnie',\\n\",\" 'Kessler Edwards',\\n\",\" 'Trevelin Queen',\\n\",\" 'Isaiah Todd',\\n\",\" 'JT Thor',\\n\",\" 'Jared Butler',\\n\",\" 'Aaron Wiggins',\\n\",\" 'Charles Bassey',\\n\",\" 'Trendon Watford',\\n\",\" 'Jock Landale',\\n\",\" 'Miles McBride',\\n\",\" 'Austin Reaves',\\n\",\" 'Jason Preston',\\n\",\" 'Terry Taylor',\\n\",\" 'Daishen Nix',\\n\",\" 'Isaiah Livers',\\n\",\" 'Marko Simonovic',\\n\",\" 'Ayo Dosunmu',\\n\",\" 'Jose Alvarado',\\n\",\" 'Sam Hauser',\\n\",\" 'Vit Krejci',\\n\",\" 'Dalano Banton',\\n\",\" 'Daniel Oturu',\\n\",\" 'Caleb Homesley',\\n\",\" 'Sam Merrill',\\n\",\" 'Elijah Bryant',\\n\",\" 'Deividas Sirvydis',\\n\",\" 'Mamadi Diakite',\\n\",\" 'Tyus Jones',\\n\",\" 'Christian Koloko',\\n\",\" 'Kennedy Chandler',\\n\",\" 'Alfonzo McKinnie',\\n\",\" 'Chima Moneke',\\n\",\" 'Jabari Walker',\\n\",\" 'Josh Minott',\\n\",\" 'Max Christie',\\n\",\" 'Ryan Rollins',\\n\",\" 'Jaden Hardy',\\n\",\" 'Tyrese Martin',\\n\",\" 'Luka Garza',\\n\",\" 'Keifer Sykes',\\n\",\" 'Moses Brown',\\n\",\" 'Xavier Sneed',\\n\",\" 'Ish Wainright']\"]},\"metadata\":{},\"execution_count\":59}]},{\"cell_type\":\"code\",\"source\":[\"# This method finds the urls for each of the rosters in the NBA using regexes.\\n\",\"import pandas as pd\\n\",\"df = pd.DataFrame()\\n\",\"df[\\\"Salary\\\"] = all_players2\\n\",\"df[\\\"Name\\\"] = all_players\\n\",\"df = df.rename(columns={\\\"0\\\": \\\"Salary\\\"})\"],\"metadata\":{\"id\":\"sIo_BjGLs5Ed\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017729,\"user_tz\":480,\"elapsed\":76,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":60,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":424},\"id\":\"jkVZt7Ifs6-6\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017730,\"user_tz\":480,\"elapsed\":76,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"507e6890-68aa-4b12-a808-d890a5af6606\"},\"execution_count\":61,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" Salary Name\\n\",\"0 48,070,014 Stephen Curry\\n\",\"1 47,063,478 Russell Westbrook\\n\",\"2 44,474,988 LeBron James\\n\",\"3 44,119,845 Kevin Durant\\n\",\"4 43,279,250 Bradley Beal\\n\",\".. ... ...\\n\",\"485 925,258 Luka Garza\\n\",\"486 558,345 Keifer Sykes\\n\",\"487 19,186 Moses Brown\\n\",\"488 8,558 Xavier Sneed\\n\",\"489 5,318 Ish Wainright\\n\",\"\\n\",\"[490 rows x 2 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" Salary \\n\",\" Name \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 0 \\n\",\" 48,070,014 \\n\",\" Stephen Curry \\n\",\" \\n\",\" \\n\",\" 1 \\n\",\" 47,063,478 \\n\",\" Russell Westbrook \\n\",\" \\n\",\" \\n\",\" 2 \\n\",\" 44,474,988 \\n\",\" LeBron James \\n\",\" \\n\",\" \\n\",\" 3 \\n\",\" 44,119,845 \\n\",\" Kevin Durant \\n\",\" \\n\",\" \\n\",\" 4 \\n\",\" 43,279,250 \\n\",\" Bradley Beal \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" 485 \\n\",\" 925,258 \\n\",\" Luka Garza \\n\",\" \\n\",\" \\n\",\" 486 \\n\",\" 558,345 \\n\",\" Keifer Sykes \\n\",\" \\n\",\" \\n\",\" 487 \\n\",\" 19,186 \\n\",\" Moses Brown \\n\",\" \\n\",\" \\n\",\" 488 \\n\",\" 8,558 \\n\",\" Xavier Sneed \\n\",\" \\n\",\" \\n\",\" 489 \\n\",\" 5,318 \\n\",\" Ish Wainright \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
490 rows × 2 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":61}]},{\"cell_type\":\"code\",\"source\":[\"df.to_csv('salary2022-2023', index = False)\"],\"metadata\":{\"id\":\"K5VE4iD8tAV6\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017731,\"user_tz\":480,\"elapsed\":76,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":62,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"rjPIFreyz8pW\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017732,\"user_tz\":480,\"elapsed\":77,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":62,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"nogUY-uQtA3C\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017732,\"user_tz\":480,\"elapsed\":76,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":62,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"player_info = re.findall(player_regex, roster_source)\\n\",\"player_info #[0:4]\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"huuWtTQAvPjc\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017733,\"user_tz\":480,\"elapsed\":77,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"d1d8d7ec-cccd-43fe-a664-6d48356b686c\"},\"execution_count\":63,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"[('Stephen Curry', '45,780,966'),\\n\",\" ('James Harden', '44,310,840'),\\n\",\" ('John Wall', '44,310,840'),\\n\",\" ('Russell Westbrook', '44,211,146'),\\n\",\" ('Kevin Durant', '42,018,900'),\\n\",\" ('LeBron James', '41,180,544'),\\n\",\" ('Giannis Antetokounmpo', '39,344,970'),\\n\",\" ('Damian Lillard', '39,344,900'),\\n\",\" ('Kawhi Leonard', '39,344,900'),\\n\",\" ('Paul George', '39,344,900'),\\n\",\" ('Klay Thompson', '37,980,720'),\\n\",\" ('Jimmy Butler', '36,016,200'),\\n\",\" ('Tobias Harris', '35,995,950'),\\n\",\" ('Khris Middleton', '35,500,000'),\\n\",\" ('Anthony Davis', '35,361,360'),\\n\",\" ('Rudy Gobert', '35,344,828'),\\n\",\" ('Kyrie Irving', '35,328,700'),\\n\",\" ('Bradley Beal', '33,724,200'),\\n\",\" ('Pascal Siakam', '33,003,936'),\\n\",\" ('Ben Simmons', '33,003,936'),\\n\",\" ('Jrue Holiday', '32,413,333'),\\n\",\" ('Kristaps Porzingis', '31,650,600'),\\n\",\" ('Devin Booker', '31,650,600'),\\n\",\" ('Joel Embiid', '31,579,390'),\\n\",\" ('Andrew Wiggins', '31,579,390'),\\n\",\" ('Nikola Jokic', '31,579,390'),\\n\",\" ('Kevin Love', '31,258,256'),\\n\",\" ('CJ McCollum', '30,864,198'),\\n\",\" ('Chris Paul', '30,000,000'),\\n\",\" ('Gordon Hayward', '29,925,000'),\\n\",\" ('Jamal Murray', '29,467,800'),\\n\",\" ('Brandon Ingram', '29,467,800'),\\n\",\" ('Bam Adebayo', '28,103,500'),\\n\",\" ('Donovan Mitchell', '28,103,500'),\\n\",\" ('Jayson Tatum', '28,103,500'),\\n\",\" ('Al Horford', '27,000,000'),\\n\",\" ('Kyle Lowry', '26,894,128')]\"]},\"metadata\":{},\"execution_count\":63}]},{\"cell_type\":\"code\",\"source\":[\"re.findall('\\\\\\\",\\\"name\\\":\\\\\\\"(\\\\w+\\\\s\\\\w+)\\\\\\\"\\\\,\\\"href\\\":\\\"https:\\\\/\\\\/www.espn.com\\\\/nba\\\\/player\\\\/_\\\\/id\\\\/[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,\\\\\\\"salary\\\\\\\":\\\\\\\"\\\\$([^\\\"]+)', roster_source)\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"qh4RTOwEFsfu\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017734,\"user_tz\":480,\"elapsed\":61,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"1a4cae37-843f-4205-8ff2-b5ef93953017\"},\"execution_count\":64,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"[]\"]},\"metadata\":{},\"execution_count\":64}]},{\"cell_type\":\"code\",\"source\":[\"import json\\n\",\"#draymond = json.loads(\\\"{\\\"+player_info[3][1]+\\\"}\\\")\\n\",\"#draymond\"],\"metadata\":{\"id\":\"G5ImMsd7tC_Z\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017734,\"user_tz\":480,\"elapsed\":58,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":65,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"def get_player_info(roster_url):\\n\",\" f = urllib.request.urlopen(roster_url)\\n\",\" roster_source = f.read().decode('utf-8')\\n\",\" sleep(0.5)\\n\",\" reg = ('\\\\\\\",\\\"name\\\":\\\\\\\"(\\\\w+\\\\s\\\\w+)\\\\\\\"\\\\,\\\"href\\\":\\\"https:\\\\/\\\\/www.espn.com\\\\/nba\\\\/player\\\\/_\\\\/id\\\\/[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,[^,]+\\\\,\\\\\\\"salary\\\\\\\":\\\\\\\"\\\\$([^\\\"]+)')\\n\",\" player_regex = ('\\\\\\\"salary\\\\\\\":\\\\\\\"\\\\$([^\\\"]+)')\\n\",\" #player_info2 = re.findall(player_regex, roster_source)\\n\",\" player_info = re.findall(reg, roster_source)\\n\",\" \\n\",\" return player_info\"],\"metadata\":{\"id\":\"M1shjBYqtR85\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768017735,\"user_tz\":480,\"elapsed\":58,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":66,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"all_players = []\\n\",\"all_players2 = []\\n\",\"for team in rosters.keys():\\n\",\" print(\\\"Gathering player info for team: \\\" + team)\\n\",\" x = get_player_info(rosters[team])\\n\",\" for i in x:\\n\",\" all_players.append(i[0])\\n\",\" for i in x:\\n\",\" all_players2.append(i[1])\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"mGjqpzwItS94\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768062664,\"user_tz\":480,\"elapsed\":44987,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"11110ac3-7219-406c-9430-17f785b35048\"},\"execution_count\":67,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stdout\",\"text\":[\"Gathering player info for team: boston-celtics\\n\",\"Gathering player info for team: brooklyn-nets\\n\",\"Gathering player info for team: new-york-knicks\\n\",\"Gathering player info for team: philadelphia-76ers\\n\",\"Gathering player info for team: toronto-raptors\\n\",\"Gathering player info for team: chicago-bulls\\n\",\"Gathering player info for team: cleveland-cavaliers\\n\",\"Gathering player info for team: detroit-pistons\\n\",\"Gathering player info for team: indiana-pacers\\n\",\"Gathering player info for team: milwaukee-bucks\\n\",\"Gathering player info for team: atlanta-hawks\\n\",\"Gathering player info for team: charlotte-hornets\\n\",\"Gathering player info for team: miami-heat\\n\",\"Gathering player info for team: orlando-magic\\n\",\"Gathering player info for team: washington-wizards\\n\",\"Gathering player info for team: denver-nuggets\\n\",\"Gathering player info for team: minnesota-timberwolves\\n\",\"Gathering player info for team: oklahoma-city-thunder\\n\",\"Gathering player info for team: portland-trail-blazers\\n\",\"Gathering player info for team: utah-jazz\\n\",\"Gathering player info for team: golden-state-warriors\\n\",\"Gathering player info for team: la-clippers\\n\",\"Gathering player info for team: los-angeles-lakers\\n\",\"Gathering player info for team: phoenix-suns\\n\",\"Gathering player info for team: sacramento-kings\\n\",\"Gathering player info for team: dallas-mavericks\\n\",\"Gathering player info for team: houston-rockets\\n\",\"Gathering player info for team: memphis-grizzlies\\n\",\"Gathering player info for team: new-orleans-pelicans\\n\",\"Gathering player info for team: san-antonio-spurs\\n\"]}]},{\"cell_type\":\"code\",\"source\":[\"all_players\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"br0Y6sk_tcDy\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768062665,\"user_tz\":480,\"elapsed\":29,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"4d59f1cb-c5f7-44d9-fbb5-a89aa70729ef\"},\"execution_count\":68,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"['Malcolm Brogdon',\\n\",\" 'Jaylen Brown',\\n\",\" 'Danilo Gallinari',\\n\",\" 'Blake Griffin',\\n\",\" 'Sam Hauser',\\n\",\" 'Al Horford',\\n\",\" 'Justin Jackson',\\n\",\" 'Mfiondu Kabengele',\\n\",\" 'Luke Kornet',\\n\",\" 'Payton Pritchard',\\n\",\" 'Marcus Smart',\\n\",\" 'Jayson Tatum',\\n\",\" 'Noah Vonleh',\\n\",\" 'Derrick White',\\n\",\" 'Grant Williams',\\n\",\" 'Nic Claxton',\\n\",\" 'Seth Curry',\\n\",\" 'Kevin Durant',\\n\",\" 'Kessler Edwards',\\n\",\" 'Joe Harris',\\n\",\" 'Kyrie Irving',\\n\",\" 'Patty Mills',\\n\",\" 'Markieff Morris',\\n\",\" 'Ben Simmons',\\n\",\" 'Edmond Sumner',\\n\",\" 'Cam Thomas',\\n\",\" 'Yuta Watanabe',\\n\",\" 'Ryan Arcidiacono',\\n\",\" 'RJ Barrett',\\n\",\" 'Jalen Brunson',\\n\",\" 'Evan Fournier',\\n\",\" 'Quentin Grimes',\\n\",\" 'Isaiah Hartenstein',\\n\",\" 'Svi Mykhailiuk',\\n\",\" 'Immanuel Quickley',\\n\",\" 'Julius Randle',\\n\",\" 'Cam Reddish',\\n\",\" 'Mitchell Robinson',\\n\",\" 'Derrick Rose',\\n\",\" 'Jericho Sims',\\n\",\" 'Joel Embiid',\\n\",\" 'Montrezl Harrell',\\n\",\" 'Tobias Harris',\\n\",\" 'Furkan Korkmaz',\\n\",\" 'Saben Lee',\\n\",\" 'Tyrese Maxey',\\n\",\" 'Shake Milton',\\n\",\" 'Georges Niang',\\n\",\" 'Paul Reed',\\n\",\" 'Jaden Springer',\\n\",\" 'Matisse Thybulle',\\n\",\" 'Precious Achiuwa',\\n\",\" 'Dalano Banton',\\n\",\" 'Scottie Barnes',\\n\",\" 'Khem Birch',\\n\",\" 'Chris Boucher',\\n\",\" 'Justin Champagnie',\\n\",\" 'Malachi Flynn',\\n\",\" 'Juancho Hernangomez',\\n\",\" 'Christian Koloko',\\n\",\" 'Pascal Siakam',\\n\",\" 'Fred VanVleet',\\n\",\" 'Thaddeus Young',\\n\",\" 'Tony Bradley',\\n\",\" 'Alex Caruso',\\n\",\" 'DeMar DeRozan',\\n\",\" 'Ayo Dosunmu',\\n\",\" 'Goran Dragic',\\n\",\" 'Javonte Green',\\n\",\" 'Zach LaVine',\\n\",\" 'Marko Simonovic',\\n\",\" 'Dalen Terry',\\n\",\" 'Nikola Vucevic',\\n\",\" 'Coby White',\\n\",\" 'Patrick Williams',\\n\",\" 'Jarrett Allen',\\n\",\" 'Mamadi Diakite',\\n\",\" 'Darius Garland',\\n\",\" 'Robin Lopez',\\n\",\" 'Kevin Love',\\n\",\" 'Donovan Mitchell',\\n\",\" 'Evan Mobley',\\n\",\" 'Raul Neto',\\n\",\" 'Isaac Okoro',\\n\",\" 'Cedi Osman',\\n\",\" 'Ricky Rubio',\\n\",\" 'Lamar Stevens',\\n\",\" 'Dean Wade',\\n\",\" 'Dylan Windler',\\n\",\" 'Saddiq Bey',\\n\",\" 'Bojan Bogdanovic',\\n\",\" 'Alec Burks',\\n\",\" 'Hamidou Diallo',\\n\",\" 'Jalen Duren',\\n\",\" 'Killian Hayes',\\n\",\" 'Jaden Ivey',\\n\",\" 'Cory Joseph',\\n\",\" 'Isaiah Livers',\\n\",\" 'Rodney McGruder',\\n\",\" 'Isaiah Stewart',\\n\",\" 'Goga Bitadze',\\n\",\" 'Oshae Brissett',\\n\",\" 'Tyrese Haliburton',\\n\",\" 'Buddy Hield',\\n\",\" 'Isaiah Jackson',\\n\",\" 'James Johnson',\\n\",\" 'Bennedict Mathurin',\\n\",\" 'Aaron Nesmith',\\n\",\" 'Trevelin Queen',\\n\",\" 'Jalen Smith',\\n\",\" 'Terry Taylor',\\n\",\" 'Daniel Theis',\\n\",\" 'Myles Turner',\\n\",\" 'Grayson Allen',\\n\",\" 'Giannis Antetokounmpo',\\n\",\" 'Thanasis Antetokounmpo',\\n\",\" 'MarJon Beauchamp',\\n\",\" 'Jevon Carter',\\n\",\" 'Pat Connaughton',\\n\",\" 'Jrue Holiday',\\n\",\" 'Serge Ibaka',\\n\",\" 'Joe Ingles',\\n\",\" 'Brook Lopez',\\n\",\" 'Wesley Matthews',\\n\",\" 'Khris Middleton',\\n\",\" 'Jordan Nwora',\\n\",\" 'Bobby Portis',\\n\",\" 'Bogdan Bogdanovic',\\n\",\" 'Clint Capela',\\n\",\" 'John Collins',\\n\",\" 'Jarrett Culver',\\n\",\" 'AJ Griffin',\\n\",\" 'Justin Holiday',\\n\",\" 'Frank Kaminsky',\\n\",\" 'Vit Krejci',\\n\",\" 'Tyrese Martin',\\n\",\" 'Dejounte Murray',\\n\",\" 'Onyeka Okongwu',\\n\",\" 'Trae Young',\\n\",\" 'Gordon Hayward',\\n\",\" 'Kai Jones',\\n\",\" 'Theo Maledon',\\n\",\" 'Cody Martin',\\n\",\" 'Jalen McDaniels',\\n\",\" 'Mason Plumlee',\\n\",\" 'Nick Richards',\\n\",\" 'Mark Williams',\\n\",\" 'Bam Adebayo',\\n\",\" 'Jimmy Butler',\\n\",\" 'Dewayne Dedmon',\\n\",\" 'Udonis Haslem',\\n\",\" 'Tyler Herro',\\n\",\" 'Haywood Highsmith',\\n\",\" 'Nikola Jovic',\\n\",\" 'Kyle Lowry',\\n\",\" 'Caleb Martin',\\n\",\" 'Victor Oladipo',\\n\",\" 'Duncan Robinson',\\n\",\" 'Max Strus',\\n\",\" 'Omer Yurtseven',\\n\",\" 'Cole Anthony',\\n\",\" 'Mo Bamba',\\n\",\" 'Paolo Banchero',\\n\",\" 'Bol Bol',\\n\",\" 'Markelle Fultz',\\n\",\" 'Gary Harris',\\n\",\" 'Terrence Ross',\\n\",\" 'Jalen Suggs',\\n\",\" 'Franz Wagner',\\n\",\" 'Moritz Wagner',\\n\",\" 'Deni Avdija',\\n\",\" 'Will Barton',\\n\",\" 'Daniel Gafford',\\n\",\" 'Taj Gibson',\\n\",\" 'Anthony Gill',\\n\",\" 'Rui Hachimura',\\n\",\" 'Corey Kispert',\\n\",\" 'Kyle Kuzma',\\n\",\" 'Monte Morris',\\n\",\" 'Kristaps Porzingis',\\n\",\" 'Isaiah Todd',\\n\",\" 'Delon Wright',\\n\",\" 'Christian Braun',\\n\",\" 'Bruce Brown',\\n\",\" 'Vlatko Cancar',\\n\",\" 'Aaron Gordon',\\n\",\" 'Jeff Green',\\n\",\" 'Nikola Jokic',\\n\",\" 'DeAndre Jordan',\\n\",\" 'Jamal Murray',\\n\",\" 'Zeke Nnaji',\\n\",\" 'Davon Reed',\\n\",\" 'Ish Smith',\\n\",\" 'Peyton Watson',\\n\",\" 'Kyle Anderson',\\n\",\" 'Bryn Forbes',\\n\",\" 'Luka Garza',\\n\",\" 'Rudy Gobert',\\n\",\" 'Nathan Knight',\\n\",\" 'Jordan McLaughlin',\\n\",\" 'Josh Minott',\\n\",\" 'Jaylen Nowell',\\n\",\" 'Taurean Prince',\\n\",\" 'Naz Reid',\\n\",\" 'Austin Rivers',\\n\",\" 'Darius Bazley',\\n\",\" 'Ousmane Dieng',\\n\",\" 'Luguentz Dort',\\n\",\" 'Chet Holmgren',\\n\",\" 'Isaiah Joe',\\n\",\" 'Tre Mann',\\n\",\" 'Mike Muscala',\\n\",\" 'Aleksej Pokusevski',\\n\",\" 'Aaron Wiggins',\\n\",\" 'Jalen Williams',\\n\",\" 'Jaylin Williams',\\n\",\" 'Kenrich Williams',\\n\",\" 'Drew Eubanks',\\n\",\" 'Jerami Grant',\\n\",\" 'Josh Hart',\\n\",\" 'Keon Johnson',\\n\",\" 'Damian Lillard',\\n\",\" 'Nassir Little',\\n\",\" 'Jusuf Nurkic',\\n\",\" 'Shaedon Sharpe',\\n\",\" 'Jabari Walker',\\n\",\" 'Justise Winslow',\\n\",\" 'Ochai Agbaji',\\n\",\" 'Udoka Azubuike',\\n\",\" 'Malik Beasley',\\n\",\" 'Leandro Bolmaro',\\n\",\" 'Jordan Clarkson',\\n\",\" 'Mike Conley',\\n\",\" 'Simone Fontecchio',\\n\",\" 'Rudy Gay',\\n\",\" 'Walker Kessler',\\n\",\" 'Lauri Markkanen',\\n\",\" 'Kelly Olynyk',\\n\",\" 'Jarred Vanderbilt',\\n\",\" 'Stephen Curry',\\n\",\" 'Donte DiVincenzo',\\n\",\" 'Draymond Green',\\n\",\" 'Andre Iguodala',\\n\",\" 'Ty Jerome',\\n\",\" 'Jonathan Kuminga',\\n\",\" 'Kevon Looney',\\n\",\" 'Moses Moody',\\n\",\" 'Klay Thompson',\\n\",\" 'Andrew Wiggins',\\n\",\" 'James Wiseman',\\n\",\" 'Nicolas Batum',\\n\",\" 'Moses Brown',\\n\",\" 'Amir Coffey',\\n\",\" 'Robert Covington',\\n\",\" 'Paul George',\\n\",\" 'Luke Kennard',\\n\",\" 'Terance Mann',\\n\",\" 'Norman Powell',\\n\",\" 'Jason Preston',\\n\",\" 'John Wall',\\n\",\" 'Ivica Zubac',\\n\",\" 'Patrick Beverley',\\n\",\" 'Thomas Bryant',\\n\",\" 'Max Christie',\\n\",\" 'Wenyen Gabriel',\\n\",\" 'LeBron James',\\n\",\" 'Damian Jones',\\n\",\" 'Kendrick Nunn',\\n\",\" 'Austin Reaves',\\n\",\" 'Matt Ryan',\\n\",\" 'Dennis Schroder',\\n\",\" 'Russell Westbrook',\\n\",\" 'Deandre Ayton',\\n\",\" 'Bismack Biyombo',\\n\",\" 'Mikal Bridges',\\n\",\" 'Torrey Craig',\\n\",\" 'Jae Crowder',\\n\",\" 'Cameron Johnson',\\n\",\" 'Jock Landale',\\n\",\" 'Damion Lee',\\n\",\" 'Cameron Payne',\\n\",\" 'Dario Saric',\\n\",\" 'Landry Shamet',\\n\",\" 'Ish Wainright',\\n\",\" 'Harrison Barnes',\\n\",\" 'Matthew Dellavedova',\\n\",\" 'Richaun Holmes',\\n\",\" 'Kevin Huerter',\\n\",\" 'Alex Len',\\n\",\" 'Trey Lyles',\\n\",\" 'Chimezie Metu',\\n\",\" 'Davion Mitchell',\\n\",\" 'Chima Moneke',\\n\",\" 'Malik Monk',\\n\",\" 'Keegan Murray',\\n\",\" 'KZ Okpala',\\n\",\" 'Domantas Sabonis',\\n\",\" 'Davis Bertans',\\n\",\" 'Reggie Bullock',\\n\",\" 'Spencer Dinwiddie',\\n\",\" 'Luka Doncic',\\n\",\" 'Josh Green',\\n\",\" 'Maxi Kleber',\\n\",\" 'JaVale McGee',\\n\",\" 'Frank Ntilikina',\\n\",\" 'Dwight Powell',\\n\",\" 'Christian Wood',\\n\",\" 'Josh Christopher',\\n\",\" 'Tari Eason',\\n\",\" 'Bruno Fernando',\\n\",\" 'Usman Garuba',\\n\",\" 'Eric Gordon',\\n\",\" 'Jalen Green',\\n\",\" 'Boban Marjanovic',\\n\",\" 'Garrison Mathews',\\n\",\" 'Daishen Nix',\\n\",\" 'Alperen Sengun',\\n\",\" 'Steven Adams',\\n\",\" 'Santi Aldama',\\n\",\" 'Desmond Bane',\\n\",\" 'Dillon Brooks',\\n\",\" 'Brandon Clarke',\\n\",\" 'Danny Green',\\n\",\" 'Tyus Jones',\\n\",\" 'John Konchar',\\n\",\" 'Ja Morant',\\n\",\" 'David Roddy',\\n\",\" 'Ziaire Williams',\\n\",\" 'Jose Alvarado',\\n\",\" 'Dyson Daniels',\\n\",\" 'Jaxson Hayes',\\n\",\" 'Willy Hernangomez',\\n\",\" 'Brandon Ingram',\\n\",\" 'Herbert Jones',\\n\",\" 'Naji Marshall',\\n\",\" 'Garrett Temple',\\n\",\" 'Jonas Valanciunas',\\n\",\" 'Charles Bassey',\\n\",\" 'Malaki Branham',\\n\",\" 'Zach Collins',\\n\",\" 'Gorgui Dieng',\\n\",\" 'Tre Jones',\\n\",\" 'Romeo Langford',\\n\",\" 'Doug McDermott',\\n\",\" 'Jakob Poeltl',\\n\",\" 'Josh Richardson',\\n\",\" 'Isaiah Roby',\\n\",\" 'Jeremy Sochan',\\n\",\" 'Devin Vassell',\\n\",\" 'Blake Wesley']\"]},\"metadata\":{},\"execution_count\":68}]},{\"cell_type\":\"code\",\"source\":[\"import pandas as pd\\n\",\"df = pd.DataFrame()\\n\",\"df[\\\"Salary\\\"] = all_players2\\n\",\"df[\\\"Name\\\"] = all_players\\n\",\"df = df.rename(columns={\\\"0\\\": \\\"Salary\\\"})\\n\"],\"metadata\":{\"id\":\"SYhZR-8Qtm88\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768062665,\"user_tz\":480,\"elapsed\":26,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":69,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":424},\"id\":\"w0kmMMWtLTW_\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768062666,\"user_tz\":480,\"elapsed\":27,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"3109dac6-caca-447e-fcc0-68ca8983a7ff\"},\"execution_count\":70,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" Salary Name\\n\",\"0 22,600,000 Malcolm Brogdon\\n\",\"1 28,741,071 Jaylen Brown\\n\",\"2 6,479,000 Danilo Gallinari\\n\",\"3 1,836,090 Blake Griffin\\n\",\"4 1,563,518 Sam Hauser\\n\",\".. ... ...\\n\",\"345 11,615,328 Josh Richardson\\n\",\"346 1,782,621 Isaiah Roby\\n\",\"347 5,063,520 Jeremy Sochan\\n\",\"348 4,437,000 Devin Vassell\\n\",\"349 2,385,480 Blake Wesley\\n\",\"\\n\",\"[350 rows x 2 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" Salary \\n\",\" Name \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 0 \\n\",\" 22,600,000 \\n\",\" Malcolm Brogdon \\n\",\" \\n\",\" \\n\",\" 1 \\n\",\" 28,741,071 \\n\",\" Jaylen Brown \\n\",\" \\n\",\" \\n\",\" 2 \\n\",\" 6,479,000 \\n\",\" Danilo Gallinari \\n\",\" \\n\",\" \\n\",\" 3 \\n\",\" 1,836,090 \\n\",\" Blake Griffin \\n\",\" \\n\",\" \\n\",\" 4 \\n\",\" 1,563,518 \\n\",\" Sam Hauser \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" 345 \\n\",\" 11,615,328 \\n\",\" Josh Richardson \\n\",\" \\n\",\" \\n\",\" 346 \\n\",\" 1,782,621 \\n\",\" Isaiah Roby \\n\",\" \\n\",\" \\n\",\" 347 \\n\",\" 5,063,520 \\n\",\" Jeremy Sochan \\n\",\" \\n\",\" \\n\",\" 348 \\n\",\" 4,437,000 \\n\",\" Devin Vassell \\n\",\" \\n\",\" \\n\",\" 349 \\n\",\" 2,385,480 \\n\",\" Blake Wesley \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
350 rows × 2 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":70}]},{\"cell_type\":\"code\",\"source\":[\"df.to_csv('salary2021-2022', index = False)\"],\"metadata\":{\"id\":\"LuYThwUhSzLy\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768062666,\"user_tz\":480,\"elapsed\":24,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":71,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"i_t_rPczvHSa\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1669768062666,\"user_tz\":480,\"elapsed\":24,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":71,\"outputs\":[]}]}",
+ "size": 141440,
+ "language": "unknown"
+ },
+ "README.md": {
+ "content": "Berekelt files in Colt X / DMA\n",
+ "size": 31,
+ "language": "markdown"
+ },
+ "kaggle_competition.ipynb": {
+ "content": "{\"nbformat\":4,\"nbformat_minor\":0,\"metadata\":{\"colab\":{\"provenance\":[],\"collapsed_sections\":[],\"authorship_tag\":\"ABX9TyNfE/qmqFjx/OE/IWNhcFUF\"},\"kernelspec\":{\"name\":\"python3\",\"display_name\":\"Python 3\"},\"language_info\":{\"name\":\"python\"}},\"cells\":[{\"cell_type\":\"code\",\"execution_count\":null,\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":537},\"id\":\"TyJNDBpuui3h\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189740634,\"user_tz\":420,\"elapsed\":182,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"8636cc29-06e3-4d5a-a170-ec051ccfd5c9\"},\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass \\\\\\n\",\"0 1 0 3 \\n\",\"1 2 1 1 \\n\",\"2 3 1 3 \\n\",\"3 4 1 1 \\n\",\"4 5 0 3 \\n\",\".. ... ... ... \\n\",\"886 887 0 2 \\n\",\"887 888 1 1 \\n\",\"888 889 0 3 \\n\",\"889 890 1 1 \\n\",\"890 891 0 3 \\n\",\"\\n\",\" Name Sex Age SibSp \\\\\\n\",\"0 Braund, Mr. Owen Harris male 22.0 1 \\n\",\"1 Cumings, Mrs. John Bradley (Florence Briggs Th... female 38.0 1 \\n\",\"2 Heikkinen, Miss. Laina female 26.0 0 \\n\",\"3 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35.0 1 \\n\",\"4 Allen, Mr. William Henry male 35.0 0 \\n\",\".. ... ... ... ... \\n\",\"886 Montvila, Rev. Juozas male 27.0 0 \\n\",\"887 Graham, Miss. Margaret Edith female 19.0 0 \\n\",\"888 Johnston, Miss. Catherine Helen \\\"Carrie\\\" female NaN 1 \\n\",\"889 Behr, Mr. Karl Howell male 26.0 0 \\n\",\"890 Dooley, Mr. Patrick male 32.0 0 \\n\",\"\\n\",\" Parch Ticket Fare Cabin Embarked \\n\",\"0 0 A/5 21171 7.2500 NaN S \\n\",\"1 0 PC 17599 71.2833 C85 C \\n\",\"2 0 STON/O2. 3101282 7.9250 NaN S \\n\",\"3 0 113803 53.1000 C123 S \\n\",\"4 0 373450 8.0500 NaN S \\n\",\".. ... ... ... ... ... \\n\",\"886 0 211536 13.0000 NaN S \\n\",\"887 0 112053 30.0000 B42 S \\n\",\"888 2 W./C. 6607 23.4500 NaN S \\n\",\"889 0 111369 30.0000 C148 C \\n\",\"890 0 370376 7.7500 NaN Q \\n\",\"\\n\",\"[891 rows x 12 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 3 \\n\",\" Braund, Mr. Owen Harris \\n\",\" male \\n\",\" 22.0 \\n\",\" 1 \\n\",\" 0 \\n\",\" A/5 21171 \\n\",\" 7.2500 \\n\",\" NaN \\n\",\" S \\n\",\" \\n\",\" \\n\",\" 1 \\n\",\" 2 \\n\",\" 1 \\n\",\" 1 \\n\",\" Cumings, Mrs. John Bradley (Florence Briggs Th... \\n\",\" female \\n\",\" 38.0 \\n\",\" 1 \\n\",\" 0 \\n\",\" PC 17599 \\n\",\" 71.2833 \\n\",\" C85 \\n\",\" C \\n\",\" \\n\",\" \\n\",\" 2 \\n\",\" 3 \\n\",\" 1 \\n\",\" 3 \\n\",\" Heikkinen, Miss. Laina \\n\",\" female \\n\",\" 26.0 \\n\",\" 0 \\n\",\" 0 \\n\",\" STON/O2. 3101282 \\n\",\" 7.9250 \\n\",\" NaN \\n\",\" S \\n\",\" \\n\",\" \\n\",\" 3 \\n\",\" 4 \\n\",\" 1 \\n\",\" 1 \\n\",\" Futrelle, Mrs. Jacques Heath (Lily May Peel) \\n\",\" female \\n\",\" 35.0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 113803 \\n\",\" 53.1000 \\n\",\" C123 \\n\",\" S \\n\",\" \\n\",\" \\n\",\" 4 \\n\",\" 5 \\n\",\" 0 \\n\",\" 3 \\n\",\" Allen, Mr. William Henry \\n\",\" male \\n\",\" 35.0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 373450 \\n\",\" 8.0500 \\n\",\" NaN \\n\",\" S \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" 886 \\n\",\" 887 \\n\",\" 0 \\n\",\" 2 \\n\",\" Montvila, Rev. Juozas \\n\",\" male \\n\",\" 27.0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 211536 \\n\",\" 13.0000 \\n\",\" NaN \\n\",\" S \\n\",\" \\n\",\" \\n\",\" 887 \\n\",\" 888 \\n\",\" 1 \\n\",\" 1 \\n\",\" Graham, Miss. Margaret Edith \\n\",\" female \\n\",\" 19.0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 112053 \\n\",\" 30.0000 \\n\",\" B42 \\n\",\" S \\n\",\" \\n\",\" \\n\",\" 888 \\n\",\" 889 \\n\",\" 0 \\n\",\" 3 \\n\",\" Johnston, Miss. Catherine Helen \\\"Carrie\\\" \\n\",\" female \\n\",\" NaN \\n\",\" 1 \\n\",\" 2 \\n\",\" W./C. 6607 \\n\",\" 23.4500 \\n\",\" NaN \\n\",\" S \\n\",\" \\n\",\" \\n\",\" 889 \\n\",\" 890 \\n\",\" 1 \\n\",\" 1 \\n\",\" Behr, Mr. Karl Howell \\n\",\" male \\n\",\" 26.0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 111369 \\n\",\" 30.0000 \\n\",\" C148 \\n\",\" C \\n\",\" \\n\",\" \\n\",\" 890 \\n\",\" 891 \\n\",\" 0 \\n\",\" 3 \\n\",\" Dooley, Mr. Patrick \\n\",\" male \\n\",\" 32.0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 370376 \\n\",\" 7.7500 \\n\",\" NaN \\n\",\" Q \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
891 rows × 12 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":284}],\"source\":[\"import pandas as pd\\n\",\"from sklearn.neural_network import MLPClassifier #https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html\\n\",\"from sklearn.model_selection import train_test_split\\n\",\"from sklearn.metrics import accuracy_score\\n\",\"from keras.models import Sequential\\n\",\"from keras.layers import Dense, Activation\\n\",\"from sklearn import preprocessing\\n\",\"import collections \\n\",\"from sklearn.cluster import KMeans\\n\",\"from sklearn.metrics import silhouette_score\\n\",\"import numpy as np\\n\",\"from sklearn.preprocessing import normalize\\n\",\"\\n\",\"import matplotlib\\n\",\"import matplotlib.pyplot as plt\\n\",\"\\n\",\"import pandas as pd\\n\",\"from sklearn.neural_network import MLPClassifier\\n\",\"from sklearn.svm import SVC\\n\",\"\\n\",\"from sklearn.preprocessing import StandardScaler, MinMaxScaler\\n\",\"from sklearn.preprocessing import LabelEncoder, OneHotEncoder\\n\",\"from sklearn.feature_extraction import DictVectorizer\\n\",\"\\n\",\"from sklearn.pipeline import Pipeline\\n\",\"from sklearn.metrics import accuracy_score\\n\",\"from sklearn.model_selection import train_test_split\\n\",\"from sklearn.model_selection import GridSearchCV, ParameterGrid\\n\",\"\\n\",\"import numpy as np\\n\",\"\\n\",\"import warnings\\n\",\"from pandas.core.internals.construction import treat_as_nested\\n\",\"# YOUR CODE HERE\\n\",\"from sklearn.metrics import accuracy_score\\n\",\"\\n\",\"from collections import Counter, defaultdict\\n\",\"from itertools import combinations \\n\",\"import pandas as pd\\n\",\"import numpy as np\\n\",\"import operator\\n\",\"import math\\n\",\"import itertools\\n\",\"from sklearn.feature_extraction import DictVectorizer\\n\",\"from sklearn import preprocessing, tree\\n\",\"import matplotlib.pyplot as plt\\n\",\"import sklearn\\n\",\"from sklearn.ensemble import RandomForestClassifier\\n\",\"from sklearn.model_selection import StratifiedKFold, cross_val_score, train_test_split, GridSearchCV\\n\",\"from sklearn.feature_selection import SelectFromModel\\n\",\"\\n\",\"#!wget -nc http://askoski.berkeley.edu/~zp/gender_submission.csv\\n\",\"\\n\",\"df = pd.read_csv('gender_submission.csv', delimiter= ',')\\n\",\"df_train = pd.read_csv('train.csv', delimiter= ',')\\n\",\"df_test = pd.read_csv('test.csv', delimiter= ',')\\n\",\"df_train #[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]]\"]},{\"cell_type\":\"code\",\"source\":[\"df_train.groupby(\\\"Pclass\\\").count()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":175},\"id\":\"roy85QOKon_P\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741137,\"user_tz\":420,\"elapsed\":19,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"1b795f95-fcee-4416-975d-cece1b539d0b\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Name Sex Age SibSp Parch Ticket Fare \\\\\\n\",\"Pclass \\n\",\"1 216 216 216 216 186 216 216 216 216 \\n\",\"2 184 184 184 184 173 184 184 184 184 \\n\",\"3 491 491 491 491 355 491 491 491 491 \\n\",\"\\n\",\" Cabin Embarked \\n\",\"Pclass \\n\",\"1 176 214 \\n\",\"2 16 184 \\n\",\"3 12 491 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" \\n\",\" \\n\",\" Pclass \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 1 \\n\",\" 216 \\n\",\" 216 \\n\",\" 216 \\n\",\" 216 \\n\",\" 186 \\n\",\" 216 \\n\",\" 216 \\n\",\" 216 \\n\",\" 216 \\n\",\" 176 \\n\",\" 214 \\n\",\" \\n\",\" \\n\",\" 2 \\n\",\" 184 \\n\",\" 184 \\n\",\" 184 \\n\",\" 184 \\n\",\" 173 \\n\",\" 184 \\n\",\" 184 \\n\",\" 184 \\n\",\" 184 \\n\",\" 16 \\n\",\" 184 \\n\",\" \\n\",\" \\n\",\" 3 \\n\",\" 491 \\n\",\" 491 \\n\",\" 491 \\n\",\" 491 \\n\",\" 355 \\n\",\" 491 \\n\",\" 491 \\n\",\" 491 \\n\",\" 491 \\n\",\" 12 \\n\",\" 491 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":285}]},{\"cell_type\":\"code\",\"source\":[\"df_train.isnull().sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"VO4hBbRTYIo3\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741138,\"user_tz\":420,\"elapsed\":18,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"c07bf72d-e3c3-4d6a-a65b-7ece541f7ca9\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"PassengerId 0\\n\",\"Survived 0\\n\",\"Pclass 0\\n\",\"Name 0\\n\",\"Sex 0\\n\",\"Age 177\\n\",\"SibSp 0\\n\",\"Parch 0\\n\",\"Ticket 0\\n\",\"Fare 0\\n\",\"Cabin 687\\n\",\"Embarked 2\\n\",\"dtype: int64\"]},\"metadata\":{},\"execution_count\":286}]},{\"cell_type\":\"code\",\"source\":[\"df_test.isnull().sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"g70g3UX5K7K5\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741138,\"user_tz\":420,\"elapsed\":12,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"c6eee050-1142-4a57-ad72-1c98a06860cd\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"PassengerId 0\\n\",\"Pclass 0\\n\",\"Name 0\\n\",\"Sex 0\\n\",\"Age 86\\n\",\"SibSp 0\\n\",\"Parch 0\\n\",\"Ticket 0\\n\",\"Fare 1\\n\",\"Cabin 327\\n\",\"Embarked 0\\n\",\"dtype: int64\"]},\"metadata\":{},\"execution_count\":287}]},{\"cell_type\":\"code\",\"source\":[\"#df_test.isnull().sum()\\n\",\"df_test[df_test[\\\"Fare\\\"].isnull() == True]\\n\",\"\\n\",\"df_test[\\\"Fare\\\"] = df_test[\\\"Fare\\\"].replace(np.nan, df_test[\\\"Fare\\\"].median())\\n\",\"df_test[\\\"Age\\\"] = df_test[\\\"Age\\\"].replace(np.nan, df_test[\\\"Age\\\"].median())\\n\",\"df_test.isnull().sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"SGqbIXo7Hf5E\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741138,\"user_tz\":420,\"elapsed\":10,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"1d72db39-c2af-41ab-9425-23be349156e9\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"PassengerId 0\\n\",\"Pclass 0\\n\",\"Name 0\\n\",\"Sex 0\\n\",\"Age 0\\n\",\"SibSp 0\\n\",\"Parch 0\\n\",\"Ticket 0\\n\",\"Fare 0\\n\",\"Cabin 327\\n\",\"Embarked 0\\n\",\"dtype: int64\"]},\"metadata\":{},\"execution_count\":288}]},{\"cell_type\":\"code\",\"source\":[\"def fare_group(x):\\n\",\" if(x <= 7.5):\\n\",\" return 0#\\\"less \\\"\\n\",\" elif(x > 7.5 and x <= 15): # high school\\n\",\" return 1#\\\"regular\\\" \\n\",\" elif(x > 15 and x <= 30): # college\\n\",\" return 2#\\\"add_ on\\\"\\n\",\" elif(x > 30 and x <= 45): # young adult\\n\",\" return 3#\\\"Prenium\\\"\\n\",\" elif(x > 45):\\n\",\" #print(x)\\n\",\" return 4#\\\"expensive\\\"\\n\",\" else:\\n\",\" return 5\\n\",\"x = df_train\\n\",\"#x[\\\"fare_group\\\"] = x[\\\"Fare\\\"].apply(fare_group)\\n\",\"#df_train.corr()\"],\"metadata\":{\"id\":\"SBsJOqJHmDDq\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"def name(a):\\n\",\" x = a.split(' ')[1]\\n\",\" #print(x)\\n\",\" \\n\",\" x = x.strip(' .,!?#/123')\\n\",\" if(x != \\\"Mr\\\" and x != \\\"Mrs\\\" and x != \\\"Miss\\\" and x != \\\"Master\\\" and x != \\\"Don\\\" \\n\",\" and x != \\\"Rev\\\" and x != \\\"Dr\\\" and x != \\\"Capt\\\" and x != \\\"Col\\\" and x != \\\"Ms\\\" \\n\",\" and x != \\\"Major\\\" and x != \\\"Countess\\\" and x != \\\"Lady\\\" and x != \\\"Sir\\\" and \\n\",\" x != \\\"Mlle\\\" and x != \\\"Mme\\\"):\\n\",\" x = a.split(' ')[2]\\n\",\" #print(x)\\n\",\" \\n\",\" x = x.strip(' .,!?#/123')\\n\",\" \\n\",\" #x = a.split(' ')[3]\\n\",\" #print(x)\\n\",\" \\n\",\" #x = x.strip(' .,!?#/123') \\n\",\"\\n\",\" return x\\n\",\"name(\\\"Braund, Mr. Owen Harris\\\")\\n\",\"df_train[\\\"ID\\\"] = df_train[\\\"Name\\\"].apply(name)\\n\",\"df_train[\\\"ID\\\"] #.unique()\\n\",\"\\n\",\"df_test[\\\"ID\\\"] = df_test[\\\"Name\\\"].apply(name)\\n\",\"df_train.groupby(\\\"ID\\\").count()\"],\"metadata\":{\"id\":\"nXvDrGIMwO7A\",\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":739},\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741139,\"user_tz\":420,\"elapsed\":8,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"a49ad20b-a1de-4668-8107-b0c15f05e295\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Name Sex Age SibSp Parch \\\\\\n\",\"ID \\n\",\"Capt 1 1 1 1 1 1 1 1 \\n\",\"Castellana 2 2 2 2 2 2 2 2 \\n\",\"Col 2 2 2 2 2 2 2 2 \\n\",\"Countess 1 1 1 1 1 1 1 1 \\n\",\"Don 1 1 1 1 1 1 1 1 \\n\",\"Dr 7 7 7 7 7 6 7 7 \\n\",\"John 1 1 1 1 1 1 1 1 \\n\",\"Lady 1 1 1 1 1 1 1 1 \\n\",\"Major 2 2 2 2 2 2 2 2 \\n\",\"Manent 1 1 1 1 1 0 1 1 \\n\",\"Master 40 40 40 40 40 36 40 40 \\n\",\"Miss 181 181 181 181 181 145 181 181 \\n\",\"Mlle 2 2 2 2 2 2 2 2 \\n\",\"Mme 1 1 1 1 1 1 1 1 \\n\",\"More 1 1 1 1 1 1 1 1 \\n\",\"Mr 514 514 514 514 514 396 514 514 \\n\",\"Mrs 124 124 124 124 124 107 124 124 \\n\",\"Ms 1 1 1 1 1 1 1 1 \\n\",\"Rev 6 6 6 6 6 6 6 6 \\n\",\"Sir 1 1 1 1 1 1 1 1 \\n\",\"hoef 1 1 1 1 1 1 1 1 \\n\",\"\\n\",\" Ticket Fare Cabin Embarked \\n\",\"ID \\n\",\"Capt 1 1 1 1 \\n\",\"Castellana 2 2 2 2 \\n\",\"Col 2 2 1 2 \\n\",\"Countess 1 1 1 1 \\n\",\"Don 1 1 0 1 \\n\",\"Dr 7 7 3 7 \\n\",\"John 1 1 0 1 \\n\",\"Lady 1 1 1 1 \\n\",\"Major 2 2 2 2 \\n\",\"Manent 1 1 0 1 \\n\",\"Master 40 40 7 40 \\n\",\"Miss 181 181 47 180 \\n\",\"Mlle 2 2 2 2 \\n\",\"Mme 1 1 1 1 \\n\",\"More 1 1 0 1 \\n\",\"Mr 514 514 91 514 \\n\",\"Mrs 124 124 43 123 \\n\",\"Ms 1 1 0 1 \\n\",\"Rev 6 6 0 6 \\n\",\"Sir 1 1 1 1 \\n\",\"hoef 1 1 1 1 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" \\n\",\" \\n\",\" ID \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" Capt \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" Castellana \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" \\n\",\" \\n\",\" Col \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 1 \\n\",\" 2 \\n\",\" \\n\",\" \\n\",\" Countess \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" Don \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" Dr \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 6 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 3 \\n\",\" 7 \\n\",\" \\n\",\" \\n\",\" John \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" Lady \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" Major \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" \\n\",\" \\n\",\" Manent \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" Master \\n\",\" 40 \\n\",\" 40 \\n\",\" 40 \\n\",\" 40 \\n\",\" 40 \\n\",\" 36 \\n\",\" 40 \\n\",\" 40 \\n\",\" 40 \\n\",\" 40 \\n\",\" 7 \\n\",\" 40 \\n\",\" \\n\",\" \\n\",\" Miss \\n\",\" 181 \\n\",\" 181 \\n\",\" 181 \\n\",\" 181 \\n\",\" 181 \\n\",\" 145 \\n\",\" 181 \\n\",\" 181 \\n\",\" 181 \\n\",\" 181 \\n\",\" 47 \\n\",\" 180 \\n\",\" \\n\",\" \\n\",\" Mlle \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" \\n\",\" \\n\",\" Mme \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" More \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" Mr \\n\",\" 514 \\n\",\" 514 \\n\",\" 514 \\n\",\" 514 \\n\",\" 514 \\n\",\" 396 \\n\",\" 514 \\n\",\" 514 \\n\",\" 514 \\n\",\" 514 \\n\",\" 91 \\n\",\" 514 \\n\",\" \\n\",\" \\n\",\" Mrs \\n\",\" 124 \\n\",\" 124 \\n\",\" 124 \\n\",\" 124 \\n\",\" 124 \\n\",\" 107 \\n\",\" 124 \\n\",\" 124 \\n\",\" 124 \\n\",\" 124 \\n\",\" 43 \\n\",\" 123 \\n\",\" \\n\",\" \\n\",\" Ms \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" Rev \\n\",\" 6 \\n\",\" 6 \\n\",\" 6 \\n\",\" 6 \\n\",\" 6 \\n\",\" 6 \\n\",\" 6 \\n\",\" 6 \\n\",\" 6 \\n\",\" 6 \\n\",\" 0 \\n\",\" 6 \\n\",\" \\n\",\" \\n\",\" Sir \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" hoef \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":290}]},{\"cell_type\":\"code\",\"source\":[\"def SR(x):\\n\",\" if(x == \\\"Mr\\\"):\\n\",\" return \\\"Mr\\\"\\n\",\" if(x == \\\"Mrs\\\" or x == \\\"Mme\\\" ):\\n\",\" return \\\"Mrs\\\"\\n\",\" if(x == \\\"Miss\\\" or x == \\\"ms\\\" or x == \\\"Lady\\\" or x == \\\"Mlle\\\"):\\n\",\" return \\\"Miss\\\"\\n\",\" if(x == \\\"Master\\\"):\\n\",\" return \\\"Master\\\"\\n\",\" #if(x == \\\"Rev\\\" or x == \\\"Dr\\\" or x == \\\"Col\\\" or x == \\\"Capt\\\" or x == \\\"Castellana\\\" or x == \\\"Major\\\" or x == \\\"Countess\\\"):\\n\",\" #return 4\\n\",\" else:\\n\",\" return \\\"other\\\"\\n\",\"df_train[\\\"ID\\\"] = df_train[\\\"ID\\\"].apply(SR)\\n\",\"df_test[\\\"ID\\\"] = df_test[\\\"ID\\\"].apply(SR)\\n\",\"df_test.groupby(\\\"ID\\\").count()\"],\"metadata\":{\"id\":\"0pJNT6kVwQdS\",\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":238},\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741403,\"user_tz\":420,\"elapsed\":271,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"4850cf43-f1dd-4487-9075-5107d307f69b\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Pclass Name Sex Age SibSp Parch Ticket Fare \\\\\\n\",\"ID \\n\",\"Master 21 21 21 21 21 21 21 21 21 \\n\",\"Miss 77 77 77 77 77 77 77 77 77 \\n\",\"Mr 238 238 238 238 238 238 238 238 238 \\n\",\"Mrs 72 72 72 72 72 72 72 72 72 \\n\",\"other 10 10 10 10 10 10 10 10 10 \\n\",\"\\n\",\" Cabin Embarked \\n\",\"ID \\n\",\"Master 2 21 \\n\",\"Miss 11 77 \\n\",\"Mr 41 238 \\n\",\"Mrs 32 72 \\n\",\"other 5 10 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" \\n\",\" \\n\",\" ID \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" Master \\n\",\" 21 \\n\",\" 21 \\n\",\" 21 \\n\",\" 21 \\n\",\" 21 \\n\",\" 21 \\n\",\" 21 \\n\",\" 21 \\n\",\" 21 \\n\",\" 2 \\n\",\" 21 \\n\",\" \\n\",\" \\n\",\" Miss \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 11 \\n\",\" 77 \\n\",\" \\n\",\" \\n\",\" Mr \\n\",\" 238 \\n\",\" 238 \\n\",\" 238 \\n\",\" 238 \\n\",\" 238 \\n\",\" 238 \\n\",\" 238 \\n\",\" 238 \\n\",\" 238 \\n\",\" 41 \\n\",\" 238 \\n\",\" \\n\",\" \\n\",\" Mrs \\n\",\" 72 \\n\",\" 72 \\n\",\" 72 \\n\",\" 72 \\n\",\" 72 \\n\",\" 72 \\n\",\" 72 \\n\",\" 72 \\n\",\" 72 \\n\",\" 32 \\n\",\" 72 \\n\",\" \\n\",\" \\n\",\" other \\n\",\" 10 \\n\",\" 10 \\n\",\" 10 \\n\",\" 10 \\n\",\" 10 \\n\",\" 10 \\n\",\" 10 \\n\",\" 10 \\n\",\" 10 \\n\",\" 5 \\n\",\" 10 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":291}]},{\"cell_type\":\"markdown\",\"source\":[\"## Boy and Girl Feature\"],\"metadata\":{\"id\":\"5fZLoOmZ7TB9\"}},{\"cell_type\":\"code\",\"source\":[\"master = df_train[\\\"Name\\\"].str.contains('Master') # found that master are boys\\n\",\"capt = df_train[\\\"Name\\\"].str.contains('Capt')\\n\",\"mr = df_train[\\\"Name\\\"].str.contains('Mr') # adults\\n\",\"male = df_train[\\\"Sex\\\"] == 'male'\\n\",\"thir = 13\\n\",\"s13 = df_train[\\\"Age\\\"] < thir\\n\",\"girls = ((df_train[\\\"Sex\\\"] == 'female') & (s13))\\n\",\"boys = ((male) & (s13)) | (master) # find only the boys or male and 13 \\n\",\"females = (df_train[\\\"Sex\\\"] == \\\"female\\\")\\n\",\"df_train[\\\"Girl\\\"] = girls # no girls\\n\",\"df_train['Boy'] = boys \\n\",\"\\n\",\"df_train['Female'] = females.astype(int)\\n\",\"\\n\",\"b_a_f = boys | females # takes both females or boys based on plot above\\n\",\"# | = or\\n\",\"\\n\",\"#df_train[\\\"People_s\\\"] = boys | females\\n\",\"\\n\",\"baf = df_train[b_a_f]\\n\",\"\\n\",\"#median\\n\",\"\\n\",\"# Girl not correlated\\n\",\"\\n\",\"#----------------------------------\\n\",\"#df_train[b_a_f].groupby('Ticket')[\\\"Age\\\"].count() #.mean()\\n\",\"x = df_train\\n\",\"x = x[[\\\"Survived\\\", \\\"Boy\\\", \\\"Female\\\", \\\"Girl\\\"]].replace({False: 0, True: 1})\\n\",\"#x\\n\",\"#baf\\n\",\"x[\\\"Girl\\\"].sum() #no girls\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"PjFGHxQXafns\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741403,\"user_tz\":420,\"elapsed\":46,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"ab41e75d-ba4a-4177-a6f7-8d29fb7cd51b\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"32\"]},\"metadata\":{},\"execution_count\":292}]},{\"cell_type\":\"code\",\"source\":[\"x[\\\"Boy\\\"].sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"aEbfX43rlX3s\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741404,\"user_tz\":420,\"elapsed\":40,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"ce0a3cef-f7f9-4a8d-abcb-581c3dea52b5\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"41\"]},\"metadata\":{},\"execution_count\":293}]},{\"cell_type\":\"code\",\"source\":[\"df_train.groupby(\\\"Boy\\\")[\\\"Survived\\\"].sum() # percentage\\n\",\"# shows boys surived more 0.5609756097560976%\\n\",\"#41 total boys, 23 boys surived, already know females surived\\n\",\"23/ 41\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"kLTj29mQc6F-\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741405,\"user_tz\":420,\"elapsed\":38,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"af74dc62-6f34-43b8-e51b-7db265f29147\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"0.5609756097560976\"]},\"metadata\":{},\"execution_count\":294}]},{\"cell_type\":\"code\",\"source\":[\"df_train.groupby(\\\"Boy\\\").mean()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":143},\"id\":\"nexxT99jjbu2\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741405,\"user_tz\":420,\"elapsed\":34,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"b85fe502-21f4-4a65-edb3-b087cf04b35c\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Age SibSp Parch \\\\\\n\",\"Boy \\n\",\"False 447.123529 0.375294 2.292941 31.062777 0.440000 0.335294 \\n\",\"True 422.707317 0.560976 2.634146 4.747838 2.243902 1.341463 \\n\",\"\\n\",\" Fare Girl Female \\n\",\"Boy \\n\",\"False 32.102396 0.037647 0.369412 \\n\",\"True 34.314939 0.000000 0.000000 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Female \\n\",\" \\n\",\" \\n\",\" Boy \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" False \\n\",\" 447.123529 \\n\",\" 0.375294 \\n\",\" 2.292941 \\n\",\" 31.062777 \\n\",\" 0.440000 \\n\",\" 0.335294 \\n\",\" 32.102396 \\n\",\" 0.037647 \\n\",\" 0.369412 \\n\",\" \\n\",\" \\n\",\" True \\n\",\" 422.707317 \\n\",\" 0.560976 \\n\",\" 2.634146 \\n\",\" 4.747838 \\n\",\" 2.243902 \\n\",\" 1.341463 \\n\",\" 34.314939 \\n\",\" 0.000000 \\n\",\" 0.000000 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":295}]},{\"cell_type\":\"code\",\"source\":[\"df_train.groupby(\\\"Boy\\\")[\\\"Survived\\\"].count()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"-lDXcI3tg3ZP\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741405,\"user_tz\":420,\"elapsed\":33,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"3c725e8c-d4ee-4a5e-ce37-ff85f141d8cb\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"Boy\\n\",\"False 850\\n\",\"True 41\\n\",\"Name: Survived, dtype: int64\"]},\"metadata\":{},\"execution_count\":296}]},{\"cell_type\":\"code\",\"source\":[\"df_train.groupby(\\\"Survived\\\")[\\\"PassengerId\\\"].count()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"m4cXD4phhOxz\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741406,\"user_tz\":420,\"elapsed\":32,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"96e57892-f2f5-4b3c-9a02-7c1879b17685\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"Survived\\n\",\"0 549\\n\",\"1 342\\n\",\"Name: PassengerId, dtype: int64\"]},\"metadata\":{},\"execution_count\":297}]},{\"cell_type\":\"code\",\"source\":[\"df_train.groupby(\\\"Female\\\")[\\\"Survived\\\"]\\n\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"umHAHaN1ffv-\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741406,\"user_tz\":420,\"elapsed\":30,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"fc92f947-a0cf-4201-93da-f85df949634a\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"\"]},\"metadata\":{},\"execution_count\":298}]},{\"cell_type\":\"code\",\"source\":[\"baf.groupby(\\\"Survived\\\")[\\\"PassengerId\\\"].count()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"mYiO0HNvh9Pd\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741406,\"user_tz\":420,\"elapsed\":28,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"5fdc67be-c478-472c-f696-0570128f048f\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"Survived\\n\",\"0 99\\n\",\"1 256\\n\",\"Name: PassengerId, dtype: int64\"]},\"metadata\":{},\"execution_count\":299}]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"Girl\\\"]\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"gO-IG_KAdFoY\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189741407,\"user_tz\":420,\"elapsed\":27,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"cdfa7a97-8eec-472d-ce42-41bcadf6acaf\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"0 False\\n\",\"1 False\\n\",\"2 False\\n\",\"3 False\\n\",\"4 False\\n\",\" ... \\n\",\"886 False\\n\",\"887 False\\n\",\"888 False\\n\",\"889 False\\n\",\"890 False\\n\",\"Name: Girl, Length: 891, dtype: bool\"]},\"metadata\":{},\"execution_count\":300}]},{\"cell_type\":\"code\",\"source\":[\"import seaborn as sns\\n\",\"\\n\",\"sns.pairplot(x)\"],\"metadata\":{\"id\":\"D2sAPJmcn8AL\",\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":744},\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189747927,\"user_tz\":420,\"elapsed\":6544,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"4f412ee1-af97-437a-8159-9bfb0671b236\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"\"]},\"metadata\":{},\"execution_count\":301},{\"output_type\":\"display_data\",\"data\":{\"text/plain\":[\"\"],\"image/png\":\"iVBORw0KGgoAAAANSUhEUgAAAsgAAALFCAYAAADeNRWoAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nOzdfZBl91kf+O+j19EqlidhGomdGcVKmFnQTkE5GQbWTi1OjL0jFztKwoskcBWmvJa3CrFs2WHXbKiBHSobXnbZdRYBHsBlTC2WhZNQk8oQeQMmZLEFGjAYvcTaiWyYkZHcsi2LlTV6iZ79o3uUo/ZM9+2ePn1vT38+Vad0zzm/e85zp55761t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"metadata\":{\"id\":\"7ZmMuJ8y_rgb\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"tic_sur = baf.groupby('Cabin')[\\\"Survived\\\"].count()\\n\",\"et = tic_sur.index\\n\",\"df_train['Num_of_Cabin'] = df_train[\\\"Cabin\\\"].replace(tic_sur)\\n\",\"\\n\",\"a = df_train[\\\"Cabin\\\"].isin(et)\\n\",\"df_train.loc[~a,'Num_of_Cabin'] = 0\\n\",\"df_train[\\\"Num_of_Cabin\\\"] = df_train[\\\"Num_of_Cabin\\\"] #.dtype(str)\\n\",\"df_train.groupby(\\\"Num_of_Cabin\\\").count() #.corr()\\n\",\"df_train = df_train.drop(\\\"Num_of_Cabin\\\", axis = 1)\"],\"metadata\":{\"id\":\"Yp9DHMxEp5lT\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"#Here I look at number of tickets by females and boys\"],\"metadata\":{\"id\":\"3rbMx6QPqNKB\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"\\n\",\"n_tic = baf.groupby('Ticket')[\\\"Survived\\\"].count() # number of tickets\\n\",\"tic_sur2 = baf.groupby('Ticket')[\\\"Survived\\\"].median() # taking surived median based on ticket\\n\",\"tic_sur\\n\",\"baf.groupby('Ticket')[\\\"Survived\\\"].mean().sum() #195.25\\n\",\"#baf.groupby('Ticket')[\\\"Survived\\\"].mean().count() #256\\n\",\"#195.25 / 256\\n\",\"#76% \\n\",\"baf[\\\"Survived\\\"].sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"fOZmowf_pPEq\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189747929,\"user_tz\":420,\"elapsed\":16,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"7ebbcce3-8b59-45a7-f247-d5cff2757d29\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"256\"]},\"metadata\":{},\"execution_count\":305}]},{\"cell_type\":\"code\",\"source\":[\"et2 = n_tic.index\\n\",\"a = df_train[\\\"Ticket\\\"].isin(et2)\\n\",\"ca = df_test[\\\"Ticket\\\"].str.contains('C.A')\\n\",\"pc = df_test[\\\"Ticket\\\"].str.contains('PC')\\n\",\"ca = df_test[\\\"Ticket\\\"].str.contains('SC/AH')\\n\",\"print(et)\"],\"metadata\":{\"id\":\"SChgARx40fvH\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189747929,\"user_tz\":420,\"elapsed\":13,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"outputId\":\"3b59833c-167a-4c7e-d930-fa170a63b6a6\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stdout\",\"text\":[\"Index(['A16', 'A34', 'B18', 'B20', 'B22', 'B28', 'B3', 'B35', 'B39', 'B4',\\n\",\" 'B42', 'B49', 'B5', 'B57 B59 B63 B66', 'B58 B60', 'B69', 'B73', 'B77',\\n\",\" 'B78', 'B79', 'B80', 'B96 B98', 'C101', 'C103', 'C123', 'C125', 'C126',\\n\",\" 'C2', 'C22 C26', 'C23 C25 C27', 'C32', 'C45', 'C49', 'C50', 'C54',\\n\",\" 'C62 C64', 'C65', 'C68', 'C7', 'C78', 'C83', 'C85', 'C90', 'C92', 'C93',\\n\",\" 'C99', 'D', 'D11', 'D15', 'D17', 'D20', 'D21', 'D28', 'D33', 'D35',\\n\",\" 'D36', 'D37', 'D47', 'D7', 'D9', 'E101', 'E121', 'E33', 'E34', 'E36',\\n\",\" 'E40', 'E44', 'E49', 'E67', 'E68', 'E77', 'E8', 'F E69', 'F2', 'F33',\\n\",\" 'F4', 'G6'],\\n\",\" dtype='object', name='Cabin')\\n\"]}]},{\"cell_type\":\"code\",\"source\":[\"df_train['Num_of_Ticket'] = df_train[\\\"Ticket\\\"].replace(n_tic)\\n\",\"\\n\",\" #,'Num_of_Ticket'\\n\",\"# if ticket in females and boys, show num, otherwise 0\\n\",\"#df_train.groupby('Ticket')[\\\"Survived\\\"].count()\\n\",\"df_train.loc[~a, \\\"Num_of_Ticket\\\"] = 0 # change to zero if not female ticket\\n\",\"tic_surs = baf.groupby('Ticket')[\\\"Survived\\\"].median()\\n\",\"#----\\n\",\"def tickets(x, y):\\n\",\" if(y == et2):\\n\",\" x[~(y == n_tic.index), \\\"Num_of_Ticket\\\" ] = 0\\n\",\" return x\\n\",\"#-----------\\n\",\"# if ticket is females and boys, show num, otherwise 0 \\n\",\"#\\n\",\"\\n\",\"#df_train[\\\"Ticket_mean\\\"].isnull().sum()\\n\",\"#df_test[\\\"Ticket\\\"].unique()\\n\",\"#ca.sum()\\n\",\"#tickets(df_train[\\\"Ticket\\\"], et)\\n\",\"df_train['Num_of_Ticket'] = df_train['Num_of_Ticket'].astype(int)\\n\",\"df_train.corr()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":458},\"id\":\"aMwimisykjgV\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189747929,\"user_tz\":420,\"elapsed\":10,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"7b8b6398-08eb-4ad4-d95c-ce0c05ed9ddd\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Age SibSp Parch \\\\\\n\",\"PassengerId 1.000000 -0.005007 -0.035144 0.036847 -0.057527 -0.001652 \\n\",\"Survived -0.005007 1.000000 -0.338481 -0.077221 -0.035322 0.081629 \\n\",\"Pclass -0.035144 -0.338481 1.000000 -0.369226 0.083081 0.018443 \\n\",\"Age 0.036847 -0.077221 -0.369226 1.000000 -0.308247 -0.189119 \\n\",\"SibSp -0.057527 -0.035322 0.083081 -0.308247 1.000000 0.414838 \\n\",\"Parch -0.001652 0.081629 0.018443 -0.189119 0.414838 1.000000 \\n\",\"Fare 0.012658 0.257307 -0.549500 0.096067 0.159651 0.216225 \\n\",\"Girl -0.015289 0.083309 0.087510 -0.371591 0.182041 0.260464 \\n\",\"Boy -0.019889 0.079996 0.085554 -0.401830 0.342930 0.261681 \\n\",\"Female -0.042939 0.543351 -0.131900 -0.093254 0.114631 0.245489 \\n\",\"Num_of_Ticket -0.026957 0.218735 -0.033053 -0.314098 0.641970 0.692114 \\n\",\"\\n\",\" Fare Girl Boy Female Num_of_Ticket \\n\",\"PassengerId 0.012658 -0.015289 -0.019889 -0.042939 -0.026957 \\n\",\"Survived 0.257307 0.083309 0.079996 0.543351 0.218735 \\n\",\"Pclass -0.549500 0.087510 0.085554 -0.131900 -0.033053 \\n\",\"Age 0.096067 -0.371591 -0.401830 -0.093254 -0.314098 \\n\",\"SibSp 0.159651 0.182041 0.342930 0.114631 0.641970 \\n\",\"Parch 0.216225 0.260464 0.261681 0.245489 0.692114 \\n\",\"Fare 1.000000 -0.016508 0.009334 0.182333 0.296949 \\n\",\"Girl -0.016508 1.000000 -0.042390 0.261638 0.328052 \\n\",\"Boy 0.009334 -0.042390 1.000000 -0.162017 0.393461 \\n\",\"Female 0.182333 0.261638 -0.162017 1.000000 0.478069 \\n\",\"Num_of_Ticket 0.296949 0.328052 0.393461 0.478069 1.000000 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" 1.000000 \\n\",\" -0.005007 \\n\",\" -0.035144 \\n\",\" 0.036847 \\n\",\" -0.057527 \\n\",\" -0.001652 \\n\",\" 0.012658 \\n\",\" -0.015289 \\n\",\" -0.019889 \\n\",\" -0.042939 \\n\",\" -0.026957 \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" -0.005007 \\n\",\" 1.000000 \\n\",\" -0.338481 \\n\",\" -0.077221 \\n\",\" -0.035322 \\n\",\" 0.081629 \\n\",\" 0.257307 \\n\",\" 0.083309 \\n\",\" 0.079996 \\n\",\" 0.543351 \\n\",\" 0.218735 \\n\",\" \\n\",\" \\n\",\" Pclass \\n\",\" -0.035144 \\n\",\" -0.338481 \\n\",\" 1.000000 \\n\",\" -0.369226 \\n\",\" 0.083081 \\n\",\" 0.018443 \\n\",\" -0.549500 \\n\",\" 0.087510 \\n\",\" 0.085554 \\n\",\" -0.131900 \\n\",\" -0.033053 \\n\",\" \\n\",\" \\n\",\" Age \\n\",\" 0.036847 \\n\",\" -0.077221 \\n\",\" -0.369226 \\n\",\" 1.000000 \\n\",\" -0.308247 \\n\",\" -0.189119 \\n\",\" 0.096067 \\n\",\" -0.371591 \\n\",\" -0.401830 \\n\",\" -0.093254 \\n\",\" -0.314098 \\n\",\" \\n\",\" \\n\",\" SibSp \\n\",\" -0.057527 \\n\",\" -0.035322 \\n\",\" 0.083081 \\n\",\" -0.308247 \\n\",\" 1.000000 \\n\",\" 0.414838 \\n\",\" 0.159651 \\n\",\" 0.182041 \\n\",\" 0.342930 \\n\",\" 0.114631 \\n\",\" 0.641970 \\n\",\" \\n\",\" \\n\",\" Parch \\n\",\" -0.001652 \\n\",\" 0.081629 \\n\",\" 0.018443 \\n\",\" -0.189119 \\n\",\" 0.414838 \\n\",\" 1.000000 \\n\",\" 0.216225 \\n\",\" 0.260464 \\n\",\" 0.261681 \\n\",\" 0.245489 \\n\",\" 0.692114 \\n\",\" \\n\",\" \\n\",\" Fare \\n\",\" 0.012658 \\n\",\" 0.257307 \\n\",\" -0.549500 \\n\",\" 0.096067 \\n\",\" 0.159651 \\n\",\" 0.216225 \\n\",\" 1.000000 \\n\",\" -0.016508 \\n\",\" 0.009334 \\n\",\" 0.182333 \\n\",\" 0.296949 \\n\",\" \\n\",\" \\n\",\" Girl \\n\",\" -0.015289 \\n\",\" 0.083309 \\n\",\" 0.087510 \\n\",\" -0.371591 \\n\",\" 0.182041 \\n\",\" 0.260464 \\n\",\" -0.016508 \\n\",\" 1.000000 \\n\",\" -0.042390 \\n\",\" 0.261638 \\n\",\" 0.328052 \\n\",\" \\n\",\" \\n\",\" Boy \\n\",\" -0.019889 \\n\",\" 0.079996 \\n\",\" 0.085554 \\n\",\" -0.401830 \\n\",\" 0.342930 \\n\",\" 0.261681 \\n\",\" 0.009334 \\n\",\" -0.042390 \\n\",\" 1.000000 \\n\",\" -0.162017 \\n\",\" 0.393461 \\n\",\" \\n\",\" \\n\",\" Female \\n\",\" -0.042939 \\n\",\" 0.543351 \\n\",\" -0.131900 \\n\",\" -0.093254 \\n\",\" 0.114631 \\n\",\" 0.245489 \\n\",\" 0.182333 \\n\",\" 0.261638 \\n\",\" -0.162017 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" \\n\",\" \\n\",\" Num_of_Ticket \\n\",\" -0.026957 \\n\",\" 0.218735 \\n\",\" -0.033053 \\n\",\" -0.314098 \\n\",\" 0.641970 \\n\",\" 0.692114 \\n\",\" 0.296949 \\n\",\" 0.328052 \\n\",\" 0.393461 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":307}]},{\"cell_type\":\"code\",\"source\":[\"baf.groupby('Ticket').count()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":455},\"id\":\"ih4S1rN9tZYX\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189747930,\"user_tz\":420,\"elapsed\":10,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"7957ca3c-a3e1-4ad2-fcb4-4f07a0f454f3\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Name Sex Age SibSp Parch \\\\\\n\",\"Ticket \\n\",\"110152 3 3 3 3 3 3 3 3 \\n\",\"110413 2 2 2 2 2 2 2 2 \\n\",\"110813 1 1 1 1 1 1 1 1 \\n\",\"111361 2 2 2 2 2 2 2 2 \\n\",\"112053 1 1 1 1 1 1 1 1 \\n\",\"... ... ... ... ... ... ... ... ... \\n\",\"W./C. 14258 1 1 1 1 1 1 1 1 \\n\",\"W./C. 6607 1 1 1 1 1 0 1 1 \\n\",\"W./C. 6608 3 3 3 3 3 3 3 3 \\n\",\"W./C. 6609 1 1 1 1 1 0 1 1 \\n\",\"WE/P 5735 1 1 1 1 1 1 1 1 \\n\",\"\\n\",\" Fare Cabin Embarked ID Girl Boy Female \\n\",\"Ticket \\n\",\"110152 3 3 3 3 3 3 3 \\n\",\"110413 2 2 2 2 2 2 2 \\n\",\"110813 1 1 1 1 1 1 1 \\n\",\"111361 2 2 2 2 2 2 2 \\n\",\"112053 1 1 1 1 1 1 1 \\n\",\"... ... ... ... .. ... ... ... \\n\",\"W./C. 14258 1 0 1 1 1 1 1 \\n\",\"W./C. 6607 1 0 1 1 1 1 1 \\n\",\"W./C. 6608 3 0 3 3 3 3 3 \\n\",\"W./C. 6609 1 0 1 1 1 1 1 \\n\",\"WE/P 5735 1 1 1 1 1 1 1 \\n\",\"\\n\",\"[256 rows x 15 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" ID \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" \\n\",\" \\n\",\" Ticket \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 110152 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" \\n\",\" \\n\",\" 110413 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" \\n\",\" \\n\",\" 110813 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" 111361 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" 2 \\n\",\" \\n\",\" \\n\",\" 112053 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" W./C. 14258 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" W./C. 6607 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" W./C. 6608 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 0 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" 3 \\n\",\" \\n\",\" \\n\",\" W./C. 6609 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" WE/P 5735 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
256 rows × 15 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":308}]},{\"cell_type\":\"code\",\"source\":[\"def check(x):\\n\",\" a = df_train[\\\"Ticket\\\"].isin(et2) # for non-integer values convert to 0\\n\",\" #print(a)\\n\",\" if(~a):\\n\",\" return 0\"],\"metadata\":{\"id\":\"mqDQFOLlxUjW\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"baf.groupby('Ticket').mean() #majority of females surived and are rich\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":455},\"id\":\"YMV5NVzgrvcO\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748142,\"user_tz\":420,\"elapsed\":15,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"eff1b32a-514e-450b-e57e-96b41fe409bf\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Age SibSp Parch \\\\\\n\",\"Ticket \\n\",\"110152 507.666667 1.0 1.0 26.333333 0.000000 0.000000 \\n\",\"110413 572.500000 1.0 1.0 28.500000 0.500000 1.500000 \\n\",\"110813 367.000000 1.0 1.0 60.000000 1.000000 0.000000 \\n\",\"111361 427.000000 1.0 1.0 30.000000 0.000000 1.000000 \\n\",\"112053 888.000000 1.0 1.0 19.000000 0.000000 0.000000 \\n\",\"... ... ... ... ... ... ... \\n\",\"W./C. 14258 527.000000 1.0 2.0 50.000000 0.000000 0.000000 \\n\",\"W./C. 6607 889.000000 0.0 3.0 NaN 1.000000 2.000000 \\n\",\"W./C. 6608 440.666667 0.0 3.0 26.000000 1.666667 2.333333 \\n\",\"W./C. 6609 236.000000 0.0 3.0 NaN 0.000000 0.000000 \\n\",\"WE/P 5735 541.000000 1.0 1.0 36.000000 0.000000 2.000000 \\n\",\"\\n\",\" Fare Girl Boy Female \\n\",\"Ticket \\n\",\"110152 86.5000 0.000000 0.0 1.0 \\n\",\"110413 79.6500 0.000000 0.0 1.0 \\n\",\"110813 75.2500 0.000000 0.0 1.0 \\n\",\"111361 57.9792 0.000000 0.0 1.0 \\n\",\"112053 30.0000 0.000000 0.0 1.0 \\n\",\"... ... ... ... ... \\n\",\"W./C. 14258 10.5000 0.000000 0.0 1.0 \\n\",\"W./C. 6607 23.4500 0.000000 0.0 1.0 \\n\",\"W./C. 6608 34.3750 0.333333 0.0 1.0 \\n\",\"W./C. 6609 7.5500 0.000000 0.0 1.0 \\n\",\"WE/P 5735 71.0000 0.000000 0.0 1.0 \\n\",\"\\n\",\"[256 rows x 10 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" \\n\",\" \\n\",\" Ticket \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 110152 \\n\",\" 507.666667 \\n\",\" 1.0 \\n\",\" 1.0 \\n\",\" 26.333333 \\n\",\" 0.000000 \\n\",\" 0.000000 \\n\",\" 86.5000 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" 110413 \\n\",\" 572.500000 \\n\",\" 1.0 \\n\",\" 1.0 \\n\",\" 28.500000 \\n\",\" 0.500000 \\n\",\" 1.500000 \\n\",\" 79.6500 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" 110813 \\n\",\" 367.000000 \\n\",\" 1.0 \\n\",\" 1.0 \\n\",\" 60.000000 \\n\",\" 1.000000 \\n\",\" 0.000000 \\n\",\" 75.2500 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" 111361 \\n\",\" 427.000000 \\n\",\" 1.0 \\n\",\" 1.0 \\n\",\" 30.000000 \\n\",\" 0.000000 \\n\",\" 1.000000 \\n\",\" 57.9792 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" 112053 \\n\",\" 888.000000 \\n\",\" 1.0 \\n\",\" 1.0 \\n\",\" 19.000000 \\n\",\" 0.000000 \\n\",\" 0.000000 \\n\",\" 30.0000 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" W./C. 14258 \\n\",\" 527.000000 \\n\",\" 1.0 \\n\",\" 2.0 \\n\",\" 50.000000 \\n\",\" 0.000000 \\n\",\" 0.000000 \\n\",\" 10.5000 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" W./C. 6607 \\n\",\" 889.000000 \\n\",\" 0.0 \\n\",\" 3.0 \\n\",\" NaN \\n\",\" 1.000000 \\n\",\" 2.000000 \\n\",\" 23.4500 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" W./C. 6608 \\n\",\" 440.666667 \\n\",\" 0.0 \\n\",\" 3.0 \\n\",\" 26.000000 \\n\",\" 1.666667 \\n\",\" 2.333333 \\n\",\" 34.3750 \\n\",\" 0.333333 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" W./C. 6609 \\n\",\" 236.000000 \\n\",\" 0.0 \\n\",\" 3.0 \\n\",\" NaN \\n\",\" 0.000000 \\n\",\" 0.000000 \\n\",\" 7.5500 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\" WE/P 5735 \\n\",\" 541.000000 \\n\",\" 1.0 \\n\",\" 1.0 \\n\",\" 36.000000 \\n\",\" 0.000000 \\n\",\" 2.000000 \\n\",\" 71.0000 \\n\",\" 0.000000 \\n\",\" 0.0 \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
256 rows × 10 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":310}]},{\"cell_type\":\"code\",\"source\":[\"x = baf.groupby('Fare')[\\\"Survived\\\"].mean() #surival rate\\n\",\"x2 = x.index\\n\",\"\\n\",\"df_train['Fare_mean'] = df_train[\\\"Fare\\\"].replace(x)\\n\",\"a = df_train[\\\"Fare\\\"].isin(x2)\\n\",\"df_train.loc[~a,'Fare_mean'] = 0 # change males to 0\\n\",\"df_train['Fare_mean'] = df_train['Fare_mean'].astype(int)\\n\",\"df_train.corr()\\n\",\"#x\\n\",\"x = baf.groupby('Fare')[\\\"Survived\\\"].mean() #surival rate\\n\",\"x2 = x.index\\n\",\"\\n\",\"df_test['Fare_mean'] = df_test[\\\"Fare\\\"].replace(x)\\n\",\"a = df_test[\\\"Fare\\\"].isin(x2)\\n\",\"df_test.loc[~a,'Fare_mean'] = 0 \\n\",\"df_test['Fare_mean'] = df_test['Fare_mean'].astype(int)\\n\",\"df_test.corr()\\n\",\"df_train = df_train.drop(columns = [\\\"Fare_mean\\\"], axis = 1)\"],\"metadata\":{\"id\":\"z7jPV4GQel6s\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"tic_sur = baf.groupby('Ticket')[\\\"Survived\\\"].mean()\\n\",\"et = tic_sur.index\\n\",\"a = df_train[\\\"Ticket\\\"].isin(et)\\n\",\"tic_sur = baf.groupby('Ticket')[\\\"Survived\\\"].mean() # taking surived mean based on ticket\\n\",\"# the ticket passenger who surived based on surival rate\\n\",\"df_train['Ticket_mean'] = df_train[\\\"Ticket\\\"].replace(tic_sur) #.apply(check)\\n\",\"df_train.loc[~a,'Ticket_mean'] = 0 # show boys\\n\",\"df_train['Ticket_mean'] = df_train['Ticket_mean'].astype(int)\\n\",\"df_train.corr()\\n\",\"\\n\",\"#df_train['Ticket_mean'].unique()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":490},\"id\":\"GRWP8G27sh-A\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748143,\"user_tz\":420,\"elapsed\":14,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"0e7713ec-0cf6-40e7-9168-9b9f1b8d1279\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Age SibSp Parch \\\\\\n\",\"PassengerId 1.000000 -0.005007 -0.035144 0.036847 -0.057527 -0.001652 \\n\",\"Survived -0.005007 1.000000 -0.338481 -0.077221 -0.035322 0.081629 \\n\",\"Pclass -0.035144 -0.338481 1.000000 -0.369226 0.083081 0.018443 \\n\",\"Age 0.036847 -0.077221 -0.369226 1.000000 -0.308247 -0.189119 \\n\",\"SibSp -0.057527 -0.035322 0.083081 -0.308247 1.000000 0.414838 \\n\",\"Parch -0.001652 0.081629 0.018443 -0.189119 0.414838 1.000000 \\n\",\"Fare 0.012658 0.257307 -0.549500 0.096067 0.159651 0.216225 \\n\",\"Girl -0.015289 0.083309 0.087510 -0.371591 0.182041 0.260464 \\n\",\"Boy -0.019889 0.079996 0.085554 -0.401830 0.342930 0.261681 \\n\",\"Female -0.042939 0.543351 -0.131900 -0.093254 0.114631 0.245489 \\n\",\"Num_of_Ticket -0.026957 0.218735 -0.033053 -0.314098 0.641970 0.692114 \\n\",\"Ticket_mean -0.015325 0.714892 -0.374292 -0.051335 0.045270 0.159689 \\n\",\"\\n\",\" Fare Girl Boy Female Num_of_Ticket \\\\\\n\",\"PassengerId 0.012658 -0.015289 -0.019889 -0.042939 -0.026957 \\n\",\"Survived 0.257307 0.083309 0.079996 0.543351 0.218735 \\n\",\"Pclass -0.549500 0.087510 0.085554 -0.131900 -0.033053 \\n\",\"Age 0.096067 -0.371591 -0.401830 -0.093254 -0.314098 \\n\",\"SibSp 0.159651 0.182041 0.342930 0.114631 0.641970 \\n\",\"Parch 0.216225 0.260464 0.261681 0.245489 0.692114 \\n\",\"Fare 1.000000 -0.016508 0.009334 0.182333 0.296949 \\n\",\"Girl -0.016508 1.000000 -0.042390 0.261638 0.328052 \\n\",\"Boy 0.009334 -0.042390 1.000000 -0.162017 0.393461 \\n\",\"Female 0.182333 0.261638 -0.162017 1.000000 0.478069 \\n\",\"Num_of_Ticket 0.296949 0.328052 0.393461 0.478069 1.000000 \\n\",\"Ticket_mean 0.359021 0.084365 0.072889 0.584748 0.344902 \\n\",\"\\n\",\" Ticket_mean \\n\",\"PassengerId -0.015325 \\n\",\"Survived 0.714892 \\n\",\"Pclass -0.374292 \\n\",\"Age -0.051335 \\n\",\"SibSp 0.045270 \\n\",\"Parch 0.159689 \\n\",\"Fare 0.359021 \\n\",\"Girl 0.084365 \\n\",\"Boy 0.072889 \\n\",\"Female 0.584748 \\n\",\"Num_of_Ticket 0.344902 \\n\",\"Ticket_mean 1.000000 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" 1.000000 \\n\",\" -0.005007 \\n\",\" -0.035144 \\n\",\" 0.036847 \\n\",\" -0.057527 \\n\",\" -0.001652 \\n\",\" 0.012658 \\n\",\" -0.015289 \\n\",\" -0.019889 \\n\",\" -0.042939 \\n\",\" -0.026957 \\n\",\" -0.015325 \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" -0.005007 \\n\",\" 1.000000 \\n\",\" -0.338481 \\n\",\" -0.077221 \\n\",\" -0.035322 \\n\",\" 0.081629 \\n\",\" 0.257307 \\n\",\" 0.083309 \\n\",\" 0.079996 \\n\",\" 0.543351 \\n\",\" 0.218735 \\n\",\" 0.714892 \\n\",\" \\n\",\" \\n\",\" Pclass \\n\",\" -0.035144 \\n\",\" -0.338481 \\n\",\" 1.000000 \\n\",\" -0.369226 \\n\",\" 0.083081 \\n\",\" 0.018443 \\n\",\" -0.549500 \\n\",\" 0.087510 \\n\",\" 0.085554 \\n\",\" -0.131900 \\n\",\" -0.033053 \\n\",\" -0.374292 \\n\",\" \\n\",\" \\n\",\" Age \\n\",\" 0.036847 \\n\",\" -0.077221 \\n\",\" -0.369226 \\n\",\" 1.000000 \\n\",\" -0.308247 \\n\",\" -0.189119 \\n\",\" 0.096067 \\n\",\" -0.371591 \\n\",\" -0.401830 \\n\",\" -0.093254 \\n\",\" -0.314098 \\n\",\" -0.051335 \\n\",\" \\n\",\" \\n\",\" SibSp \\n\",\" -0.057527 \\n\",\" -0.035322 \\n\",\" 0.083081 \\n\",\" -0.308247 \\n\",\" 1.000000 \\n\",\" 0.414838 \\n\",\" 0.159651 \\n\",\" 0.182041 \\n\",\" 0.342930 \\n\",\" 0.114631 \\n\",\" 0.641970 \\n\",\" 0.045270 \\n\",\" \\n\",\" \\n\",\" Parch \\n\",\" -0.001652 \\n\",\" 0.081629 \\n\",\" 0.018443 \\n\",\" -0.189119 \\n\",\" 0.414838 \\n\",\" 1.000000 \\n\",\" 0.216225 \\n\",\" 0.260464 \\n\",\" 0.261681 \\n\",\" 0.245489 \\n\",\" 0.692114 \\n\",\" 0.159689 \\n\",\" \\n\",\" \\n\",\" Fare \\n\",\" 0.012658 \\n\",\" 0.257307 \\n\",\" -0.549500 \\n\",\" 0.096067 \\n\",\" 0.159651 \\n\",\" 0.216225 \\n\",\" 1.000000 \\n\",\" -0.016508 \\n\",\" 0.009334 \\n\",\" 0.182333 \\n\",\" 0.296949 \\n\",\" 0.359021 \\n\",\" \\n\",\" \\n\",\" Girl \\n\",\" -0.015289 \\n\",\" 0.083309 \\n\",\" 0.087510 \\n\",\" -0.371591 \\n\",\" 0.182041 \\n\",\" 0.260464 \\n\",\" -0.016508 \\n\",\" 1.000000 \\n\",\" -0.042390 \\n\",\" 0.261638 \\n\",\" 0.328052 \\n\",\" 0.084365 \\n\",\" \\n\",\" \\n\",\" Boy \\n\",\" -0.019889 \\n\",\" 0.079996 \\n\",\" 0.085554 \\n\",\" -0.401830 \\n\",\" 0.342930 \\n\",\" 0.261681 \\n\",\" 0.009334 \\n\",\" -0.042390 \\n\",\" 1.000000 \\n\",\" -0.162017 \\n\",\" 0.393461 \\n\",\" 0.072889 \\n\",\" \\n\",\" \\n\",\" Female \\n\",\" -0.042939 \\n\",\" 0.543351 \\n\",\" -0.131900 \\n\",\" -0.093254 \\n\",\" 0.114631 \\n\",\" 0.245489 \\n\",\" 0.182333 \\n\",\" 0.261638 \\n\",\" -0.162017 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 0.584748 \\n\",\" \\n\",\" \\n\",\" Num_of_Ticket \\n\",\" -0.026957 \\n\",\" 0.218735 \\n\",\" -0.033053 \\n\",\" -0.314098 \\n\",\" 0.641970 \\n\",\" 0.692114 \\n\",\" 0.296949 \\n\",\" 0.328052 \\n\",\" 0.393461 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" 0.344902 \\n\",\" \\n\",\" \\n\",\" Ticket_mean \\n\",\" -0.015325 \\n\",\" 0.714892 \\n\",\" -0.374292 \\n\",\" -0.051335 \\n\",\" 0.045270 \\n\",\" 0.159689 \\n\",\" 0.359021 \\n\",\" 0.084365 \\n\",\" 0.072889 \\n\",\" 0.584748 \\n\",\" 0.344902 \\n\",\" 1.000000 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":312}]},{\"cell_type\":\"code\",\"source\":[\"x = baf.groupby('Pclass')[\\\"Survived\\\"].mean() #surival rate\\n\",\"x2 = x.index\\n\",\"\\n\",\"df_train['Pclass_mean'] = df_train[\\\"Pclass\\\"].replace(x)\\n\",\"df_train['Pclass_mean']\\n\",\"\\n\",\"def tests(x):\\n\",\" if(x > .5):\\n\",\" return 1\\n\",\" else:\\n\",\" return 0\\n\",\"df_train['Pclass_mean'] = df_train[\\\"Pclass_mean\\\"].apply(tests)\\n\",\"df_train['Pclass_mean'].unique()\\n\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"HuEqFjwuhXjq\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748143,\"user_tz\":420,\"elapsed\":13,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"07ad0066-f5f6-417d-b335-7be554234427\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"array([0, 1])\"]},\"metadata\":{},\"execution_count\":313}]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"2YcyPelymF_K\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"a = df_train[\\\"Pclass\\\"].isin(x2)\\n\",\"df_train.loc[~a,'Pclass_mean'] = 0 # \\n\",\"df_train['Pclass_mean'] = df_train['Pclass_mean'].astype(int)\\n\",\"df_train.corr()\\n\",\"#df_train['Pclass_mean'].unique()\\n\",\"df_train = df_train.drop(columns = [\\\"Pclass_mean\\\"], axis = 1)\"],\"metadata\":{\"id\":\"Ze7eRe8hiEQR\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"\\n\"],\"metadata\":{\"id\":\"6_vGhHYAmNCi\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"nvBBz-e5nDDW\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"x = baf.groupby('Age')[\\\"Survived\\\"].mean() #surival rate\\n\",\"x2 = x.index\\n\",\"\\n\",\"df_train['Age_mean'] = df_train[\\\"Age\\\"].replace(x)\\n\",\"a = df_train[\\\"Age\\\"].isin(x2)\\n\",\"df_train.loc[~a,'Age_mean'] = 0 \\n\",\"df_train['Age_mean'] = df_train['Age_mean'].astype(int)\\n\",\"df_train.corr()\\n\",\"#x\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":521},\"id\":\"ar85WBCck9kT\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748347,\"user_tz\":420,\"elapsed\":10,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"a0e71024-a91d-4469-c6a4-cf1a90832f7d\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Age SibSp Parch \\\\\\n\",\"PassengerId 1.000000 -0.005007 -0.035144 0.036847 -0.057527 -0.001652 \\n\",\"Survived -0.005007 1.000000 -0.338481 -0.077221 -0.035322 0.081629 \\n\",\"Pclass -0.035144 -0.338481 1.000000 -0.369226 0.083081 0.018443 \\n\",\"Age 0.036847 -0.077221 -0.369226 1.000000 -0.308247 -0.189119 \\n\",\"SibSp -0.057527 -0.035322 0.083081 -0.308247 1.000000 0.414838 \\n\",\"Parch -0.001652 0.081629 0.018443 -0.189119 0.414838 1.000000 \\n\",\"Fare 0.012658 0.257307 -0.549500 0.096067 0.159651 0.216225 \\n\",\"Girl -0.015289 0.083309 0.087510 -0.371591 0.182041 0.260464 \\n\",\"Boy -0.019889 0.079996 0.085554 -0.401830 0.342930 0.261681 \\n\",\"Female -0.042939 0.543351 -0.131900 -0.093254 0.114631 0.245489 \\n\",\"Num_of_Ticket -0.026957 0.218735 -0.033053 -0.314098 0.641970 0.692114 \\n\",\"Ticket_mean -0.015325 0.714892 -0.374292 -0.051335 0.045270 0.159689 \\n\",\"Age_mean 0.013707 0.142433 -0.214786 0.234337 -0.051181 -0.041546 \\n\",\"\\n\",\" Fare Girl Boy Female Num_of_Ticket \\\\\\n\",\"PassengerId 0.012658 -0.015289 -0.019889 -0.042939 -0.026957 \\n\",\"Survived 0.257307 0.083309 0.079996 0.543351 0.218735 \\n\",\"Pclass -0.549500 0.087510 0.085554 -0.131900 -0.033053 \\n\",\"Age 0.096067 -0.371591 -0.401830 -0.093254 -0.314098 \\n\",\"SibSp 0.159651 0.182041 0.342930 0.114631 0.641970 \\n\",\"Parch 0.216225 0.260464 0.261681 0.245489 0.692114 \\n\",\"Fare 1.000000 -0.016508 0.009334 0.182333 0.296949 \\n\",\"Girl -0.016508 1.000000 -0.042390 0.261638 0.328052 \\n\",\"Boy 0.009334 -0.042390 1.000000 -0.162017 0.393461 \\n\",\"Female 0.182333 0.261638 -0.162017 1.000000 0.478069 \\n\",\"Num_of_Ticket 0.296949 0.328052 0.393461 0.478069 1.000000 \\n\",\"Ticket_mean 0.359021 0.084365 0.072889 0.584748 0.344902 \\n\",\"Age_mean 0.119335 -0.005926 -0.029351 0.019217 -0.023339 \\n\",\"\\n\",\" Ticket_mean Age_mean \\n\",\"PassengerId -0.015325 0.013707 \\n\",\"Survived 0.714892 0.142433 \\n\",\"Pclass -0.374292 -0.214786 \\n\",\"Age -0.051335 0.234337 \\n\",\"SibSp 0.045270 -0.051181 \\n\",\"Parch 0.159689 -0.041546 \\n\",\"Fare 0.359021 0.119335 \\n\",\"Girl 0.084365 -0.005926 \\n\",\"Boy 0.072889 -0.029351 \\n\",\"Female 0.584748 0.019217 \\n\",\"Num_of_Ticket 0.344902 -0.023339 \\n\",\"Ticket_mean 1.000000 0.153077 \\n\",\"Age_mean 0.153077 1.000000 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_mean \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" 1.000000 \\n\",\" -0.005007 \\n\",\" -0.035144 \\n\",\" 0.036847 \\n\",\" -0.057527 \\n\",\" -0.001652 \\n\",\" 0.012658 \\n\",\" -0.015289 \\n\",\" -0.019889 \\n\",\" -0.042939 \\n\",\" -0.026957 \\n\",\" -0.015325 \\n\",\" 0.013707 \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" -0.005007 \\n\",\" 1.000000 \\n\",\" -0.338481 \\n\",\" -0.077221 \\n\",\" -0.035322 \\n\",\" 0.081629 \\n\",\" 0.257307 \\n\",\" 0.083309 \\n\",\" 0.079996 \\n\",\" 0.543351 \\n\",\" 0.218735 \\n\",\" 0.714892 \\n\",\" 0.142433 \\n\",\" \\n\",\" \\n\",\" Pclass \\n\",\" -0.035144 \\n\",\" -0.338481 \\n\",\" 1.000000 \\n\",\" -0.369226 \\n\",\" 0.083081 \\n\",\" 0.018443 \\n\",\" -0.549500 \\n\",\" 0.087510 \\n\",\" 0.085554 \\n\",\" -0.131900 \\n\",\" -0.033053 \\n\",\" -0.374292 \\n\",\" -0.214786 \\n\",\" \\n\",\" \\n\",\" Age \\n\",\" 0.036847 \\n\",\" -0.077221 \\n\",\" -0.369226 \\n\",\" 1.000000 \\n\",\" -0.308247 \\n\",\" -0.189119 \\n\",\" 0.096067 \\n\",\" -0.371591 \\n\",\" -0.401830 \\n\",\" -0.093254 \\n\",\" -0.314098 \\n\",\" -0.051335 \\n\",\" 0.234337 \\n\",\" \\n\",\" \\n\",\" SibSp \\n\",\" -0.057527 \\n\",\" -0.035322 \\n\",\" 0.083081 \\n\",\" -0.308247 \\n\",\" 1.000000 \\n\",\" 0.414838 \\n\",\" 0.159651 \\n\",\" 0.182041 \\n\",\" 0.342930 \\n\",\" 0.114631 \\n\",\" 0.641970 \\n\",\" 0.045270 \\n\",\" -0.051181 \\n\",\" \\n\",\" \\n\",\" Parch \\n\",\" -0.001652 \\n\",\" 0.081629 \\n\",\" 0.018443 \\n\",\" -0.189119 \\n\",\" 0.414838 \\n\",\" 1.000000 \\n\",\" 0.216225 \\n\",\" 0.260464 \\n\",\" 0.261681 \\n\",\" 0.245489 \\n\",\" 0.692114 \\n\",\" 0.159689 \\n\",\" -0.041546 \\n\",\" \\n\",\" \\n\",\" Fare \\n\",\" 0.012658 \\n\",\" 0.257307 \\n\",\" -0.549500 \\n\",\" 0.096067 \\n\",\" 0.159651 \\n\",\" 0.216225 \\n\",\" 1.000000 \\n\",\" -0.016508 \\n\",\" 0.009334 \\n\",\" 0.182333 \\n\",\" 0.296949 \\n\",\" 0.359021 \\n\",\" 0.119335 \\n\",\" \\n\",\" \\n\",\" Girl \\n\",\" -0.015289 \\n\",\" 0.083309 \\n\",\" 0.087510 \\n\",\" -0.371591 \\n\",\" 0.182041 \\n\",\" 0.260464 \\n\",\" -0.016508 \\n\",\" 1.000000 \\n\",\" -0.042390 \\n\",\" 0.261638 \\n\",\" 0.328052 \\n\",\" 0.084365 \\n\",\" -0.005926 \\n\",\" \\n\",\" \\n\",\" Boy \\n\",\" -0.019889 \\n\",\" 0.079996 \\n\",\" 0.085554 \\n\",\" -0.401830 \\n\",\" 0.342930 \\n\",\" 0.261681 \\n\",\" 0.009334 \\n\",\" -0.042390 \\n\",\" 1.000000 \\n\",\" -0.162017 \\n\",\" 0.393461 \\n\",\" 0.072889 \\n\",\" -0.029351 \\n\",\" \\n\",\" \\n\",\" Female \\n\",\" -0.042939 \\n\",\" 0.543351 \\n\",\" -0.131900 \\n\",\" -0.093254 \\n\",\" 0.114631 \\n\",\" 0.245489 \\n\",\" 0.182333 \\n\",\" 0.261638 \\n\",\" -0.162017 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 0.584748 \\n\",\" 0.019217 \\n\",\" \\n\",\" \\n\",\" Num_of_Ticket \\n\",\" -0.026957 \\n\",\" 0.218735 \\n\",\" -0.033053 \\n\",\" -0.314098 \\n\",\" 0.641970 \\n\",\" 0.692114 \\n\",\" 0.296949 \\n\",\" 0.328052 \\n\",\" 0.393461 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" 0.344902 \\n\",\" -0.023339 \\n\",\" \\n\",\" \\n\",\" Ticket_mean \\n\",\" -0.015325 \\n\",\" 0.714892 \\n\",\" -0.374292 \\n\",\" -0.051335 \\n\",\" 0.045270 \\n\",\" 0.159689 \\n\",\" 0.359021 \\n\",\" 0.084365 \\n\",\" 0.072889 \\n\",\" 0.584748 \\n\",\" 0.344902 \\n\",\" 1.000000 \\n\",\" 0.153077 \\n\",\" \\n\",\" \\n\",\" Age_mean \\n\",\" 0.013707 \\n\",\" 0.142433 \\n\",\" -0.214786 \\n\",\" 0.234337 \\n\",\" -0.051181 \\n\",\" -0.041546 \\n\",\" 0.119335 \\n\",\" -0.005926 \\n\",\" -0.029351 \\n\",\" 0.019217 \\n\",\" -0.023339 \\n\",\" 0.153077 \\n\",\" 1.000000 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":315}]},{\"cell_type\":\"code\",\"source\":[\"x = baf.groupby('Age')[\\\"Survived\\\"].mean() #surival rate\\n\",\"x2 = x.index\\n\",\"\\n\",\"df_test['Age_mean'] = df_test[\\\"Age\\\"].replace(x)\\n\",\"a = df_test[\\\"Age\\\"].isin(x2)\\n\",\"df_test.loc[~a,'Age_mean'] = 0 \\n\",\"df_test['Age_mean'] = df_test['Age_mean'].astype(int)\\n\",\"df_train.corr()\\n\",\"#x\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":521},\"id\":\"pIL7UIPQosFD\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748347,\"user_tz\":420,\"elapsed\":9,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"878cfa6e-c71e-4e30-ae2b-76fa1efe4a32\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Age SibSp Parch \\\\\\n\",\"PassengerId 1.000000 -0.005007 -0.035144 0.036847 -0.057527 -0.001652 \\n\",\"Survived -0.005007 1.000000 -0.338481 -0.077221 -0.035322 0.081629 \\n\",\"Pclass -0.035144 -0.338481 1.000000 -0.369226 0.083081 0.018443 \\n\",\"Age 0.036847 -0.077221 -0.369226 1.000000 -0.308247 -0.189119 \\n\",\"SibSp -0.057527 -0.035322 0.083081 -0.308247 1.000000 0.414838 \\n\",\"Parch -0.001652 0.081629 0.018443 -0.189119 0.414838 1.000000 \\n\",\"Fare 0.012658 0.257307 -0.549500 0.096067 0.159651 0.216225 \\n\",\"Girl -0.015289 0.083309 0.087510 -0.371591 0.182041 0.260464 \\n\",\"Boy -0.019889 0.079996 0.085554 -0.401830 0.342930 0.261681 \\n\",\"Female -0.042939 0.543351 -0.131900 -0.093254 0.114631 0.245489 \\n\",\"Num_of_Ticket -0.026957 0.218735 -0.033053 -0.314098 0.641970 0.692114 \\n\",\"Ticket_mean -0.015325 0.714892 -0.374292 -0.051335 0.045270 0.159689 \\n\",\"Age_mean 0.013707 0.142433 -0.214786 0.234337 -0.051181 -0.041546 \\n\",\"\\n\",\" Fare Girl Boy Female Num_of_Ticket \\\\\\n\",\"PassengerId 0.012658 -0.015289 -0.019889 -0.042939 -0.026957 \\n\",\"Survived 0.257307 0.083309 0.079996 0.543351 0.218735 \\n\",\"Pclass -0.549500 0.087510 0.085554 -0.131900 -0.033053 \\n\",\"Age 0.096067 -0.371591 -0.401830 -0.093254 -0.314098 \\n\",\"SibSp 0.159651 0.182041 0.342930 0.114631 0.641970 \\n\",\"Parch 0.216225 0.260464 0.261681 0.245489 0.692114 \\n\",\"Fare 1.000000 -0.016508 0.009334 0.182333 0.296949 \\n\",\"Girl -0.016508 1.000000 -0.042390 0.261638 0.328052 \\n\",\"Boy 0.009334 -0.042390 1.000000 -0.162017 0.393461 \\n\",\"Female 0.182333 0.261638 -0.162017 1.000000 0.478069 \\n\",\"Num_of_Ticket 0.296949 0.328052 0.393461 0.478069 1.000000 \\n\",\"Ticket_mean 0.359021 0.084365 0.072889 0.584748 0.344902 \\n\",\"Age_mean 0.119335 -0.005926 -0.029351 0.019217 -0.023339 \\n\",\"\\n\",\" Ticket_mean Age_mean \\n\",\"PassengerId -0.015325 0.013707 \\n\",\"Survived 0.714892 0.142433 \\n\",\"Pclass -0.374292 -0.214786 \\n\",\"Age -0.051335 0.234337 \\n\",\"SibSp 0.045270 -0.051181 \\n\",\"Parch 0.159689 -0.041546 \\n\",\"Fare 0.359021 0.119335 \\n\",\"Girl 0.084365 -0.005926 \\n\",\"Boy 0.072889 -0.029351 \\n\",\"Female 0.584748 0.019217 \\n\",\"Num_of_Ticket 0.344902 -0.023339 \\n\",\"Ticket_mean 1.000000 0.153077 \\n\",\"Age_mean 0.153077 1.000000 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_mean \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" 1.000000 \\n\",\" -0.005007 \\n\",\" -0.035144 \\n\",\" 0.036847 \\n\",\" -0.057527 \\n\",\" -0.001652 \\n\",\" 0.012658 \\n\",\" -0.015289 \\n\",\" -0.019889 \\n\",\" -0.042939 \\n\",\" -0.026957 \\n\",\" -0.015325 \\n\",\" 0.013707 \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" -0.005007 \\n\",\" 1.000000 \\n\",\" -0.338481 \\n\",\" -0.077221 \\n\",\" -0.035322 \\n\",\" 0.081629 \\n\",\" 0.257307 \\n\",\" 0.083309 \\n\",\" 0.079996 \\n\",\" 0.543351 \\n\",\" 0.218735 \\n\",\" 0.714892 \\n\",\" 0.142433 \\n\",\" \\n\",\" \\n\",\" Pclass \\n\",\" -0.035144 \\n\",\" -0.338481 \\n\",\" 1.000000 \\n\",\" -0.369226 \\n\",\" 0.083081 \\n\",\" 0.018443 \\n\",\" -0.549500 \\n\",\" 0.087510 \\n\",\" 0.085554 \\n\",\" -0.131900 \\n\",\" -0.033053 \\n\",\" -0.374292 \\n\",\" -0.214786 \\n\",\" \\n\",\" \\n\",\" Age \\n\",\" 0.036847 \\n\",\" -0.077221 \\n\",\" -0.369226 \\n\",\" 1.000000 \\n\",\" -0.308247 \\n\",\" -0.189119 \\n\",\" 0.096067 \\n\",\" -0.371591 \\n\",\" -0.401830 \\n\",\" -0.093254 \\n\",\" -0.314098 \\n\",\" -0.051335 \\n\",\" 0.234337 \\n\",\" \\n\",\" \\n\",\" SibSp \\n\",\" -0.057527 \\n\",\" -0.035322 \\n\",\" 0.083081 \\n\",\" -0.308247 \\n\",\" 1.000000 \\n\",\" 0.414838 \\n\",\" 0.159651 \\n\",\" 0.182041 \\n\",\" 0.342930 \\n\",\" 0.114631 \\n\",\" 0.641970 \\n\",\" 0.045270 \\n\",\" -0.051181 \\n\",\" \\n\",\" \\n\",\" Parch \\n\",\" -0.001652 \\n\",\" 0.081629 \\n\",\" 0.018443 \\n\",\" -0.189119 \\n\",\" 0.414838 \\n\",\" 1.000000 \\n\",\" 0.216225 \\n\",\" 0.260464 \\n\",\" 0.261681 \\n\",\" 0.245489 \\n\",\" 0.692114 \\n\",\" 0.159689 \\n\",\" -0.041546 \\n\",\" \\n\",\" \\n\",\" Fare \\n\",\" 0.012658 \\n\",\" 0.257307 \\n\",\" -0.549500 \\n\",\" 0.096067 \\n\",\" 0.159651 \\n\",\" 0.216225 \\n\",\" 1.000000 \\n\",\" -0.016508 \\n\",\" 0.009334 \\n\",\" 0.182333 \\n\",\" 0.296949 \\n\",\" 0.359021 \\n\",\" 0.119335 \\n\",\" \\n\",\" \\n\",\" Girl \\n\",\" -0.015289 \\n\",\" 0.083309 \\n\",\" 0.087510 \\n\",\" -0.371591 \\n\",\" 0.182041 \\n\",\" 0.260464 \\n\",\" -0.016508 \\n\",\" 1.000000 \\n\",\" -0.042390 \\n\",\" 0.261638 \\n\",\" 0.328052 \\n\",\" 0.084365 \\n\",\" -0.005926 \\n\",\" \\n\",\" \\n\",\" Boy \\n\",\" -0.019889 \\n\",\" 0.079996 \\n\",\" 0.085554 \\n\",\" -0.401830 \\n\",\" 0.342930 \\n\",\" 0.261681 \\n\",\" 0.009334 \\n\",\" -0.042390 \\n\",\" 1.000000 \\n\",\" -0.162017 \\n\",\" 0.393461 \\n\",\" 0.072889 \\n\",\" -0.029351 \\n\",\" \\n\",\" \\n\",\" Female \\n\",\" -0.042939 \\n\",\" 0.543351 \\n\",\" -0.131900 \\n\",\" -0.093254 \\n\",\" 0.114631 \\n\",\" 0.245489 \\n\",\" 0.182333 \\n\",\" 0.261638 \\n\",\" -0.162017 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 0.584748 \\n\",\" 0.019217 \\n\",\" \\n\",\" \\n\",\" Num_of_Ticket \\n\",\" -0.026957 \\n\",\" 0.218735 \\n\",\" -0.033053 \\n\",\" -0.314098 \\n\",\" 0.641970 \\n\",\" 0.692114 \\n\",\" 0.296949 \\n\",\" 0.328052 \\n\",\" 0.393461 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" 0.344902 \\n\",\" -0.023339 \\n\",\" \\n\",\" \\n\",\" Ticket_mean \\n\",\" -0.015325 \\n\",\" 0.714892 \\n\",\" -0.374292 \\n\",\" -0.051335 \\n\",\" 0.045270 \\n\",\" 0.159689 \\n\",\" 0.359021 \\n\",\" 0.084365 \\n\",\" 0.072889 \\n\",\" 0.584748 \\n\",\" 0.344902 \\n\",\" 1.000000 \\n\",\" 0.153077 \\n\",\" \\n\",\" \\n\",\" Age_mean \\n\",\" 0.013707 \\n\",\" 0.142433 \\n\",\" -0.214786 \\n\",\" 0.234337 \\n\",\" -0.051181 \\n\",\" -0.041546 \\n\",\" 0.119335 \\n\",\" -0.005926 \\n\",\" -0.029351 \\n\",\" 0.019217 \\n\",\" -0.023339 \\n\",\" 0.153077 \\n\",\" 1.000000 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":316}]},{\"cell_type\":\"code\",\"source\":[\"# now focus on test data\\n\",\"master = df_test[\\\"Name\\\"].str.contains('Master')\\n\",\"girls = (master) | ((df_test[\\\"Sex\\\"] =='female') & (s13))\\n\",\"male = df_test[\\\"Sex\\\"] =='male'\\n\",\"s13 = df_test[\\\"Age\\\"] < 13\\n\",\"boys = (master) | ((male) & (s13))\\n\",\"df_test[\\\"Girl\\\"] = girls\\n\",\"females = df_test[\\\"Sex\\\"] == 'female'\\n\",\"df_test['Boy'] = boys \\n\",\"df_test['Female'] = females.astype(int)\\n\",\"\\n\",\"# girls and men do not surive dont matter, so we take the number of tickets for females and boys\\n\",\"\\n\",\"df_test['Num_of_Ticket'] = df_test[\\\"Ticket\\\"].replace(n_tic) \\n\",\"a = df_test[\\\"Ticket\\\"].isin(n_tic.index) \\n\",\"\\n\",\"\\n\",\"#df_test[a]\\n\",\"df_test.loc[~a,\\\"Num_of_Ticket\\\"] = 0 # ticket 0 # produces error\\n\",\"\\n\",\"y = 1 - df_train[\\\"Survived\\\"]\\n\",\"\\n\",\"x = 1 - df_train[\\\"Survived\\\"]\\n\",\"\\n\",\"df_test['Ticket_mean'] = df_test[\\\"Ticket\\\"].replace(tic_sur)\\n\",\"a = df_test[\\\"Ticket\\\"].isin(tic_sur.index)\\n\",\"df_test.loc[~a,'Ticket_mean']= 0\\n\"],\"metadata\":{\"id\":\"5ZXrJe2Td6Dx\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"def fin(x):\\n\",\" #x = str(x)\\n\",\" #print(x)\\n\",\" y = df_train[\\\"Ticket\\\"]\\n\",\" if(isinstance(x, str) == True):\\n\",\" return 0\\n\",\" else:\\n\",\" #print(x)\\n\",\" return x\"],\"metadata\":{\"id\":\"aYazxi_phWys\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665536148906,\"user_tz\":420,\"elapsed\":5,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}}},\"execution_count\":1,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"vyFC1AZITrgP\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"MshC5MzJdDUE\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"# feature engineering title from name\\n\",\"#data['title'] = data['Name'].str.extract(', (\\\\w*).')\\n\",\"#data['Mr'] = (data['title'] == 'Mr').astype(int)\\n\",\"#data['Mrs'] = (data['title'] == 'Mrs').astype(int)\\n\",\"#data['Master'] = (data['title'] == 'Master').astype(int)\\n\",\"#data['Miss'] = (data['title'] == 'Miss').astype(int)\\n\",\"#data['Other'] = (data['title'].isin(['Mr', 'Mrs', 'Miss', 'Master'])).astype(int)\"],\"metadata\":{\"id\":\"KtURv0vr5yKz\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"v4FBBt_DaSN_\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"9rs1vcMjAaM0\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"import random\\n\",\"u = df_train.mean()\\n\",\"std = df_train.std()\\n\",\"val = random.choice([df_train[\\\"Age\\\"].min(), df_train[\\\"Age\\\"].max()])\\n\",\"#print(val)\\n\",\"df_train[\\\"Age\\\"] = df_train[\\\"Age\\\"].replace(np.nan, random.choice([df_train[\\\"Age\\\"].min(), df_train[\\\"Age\\\"].max()]))\\n\",\"df_test[\\\"Age\\\"] = df_test[\\\"Age\\\"].replace(np.nan, random.choice([df_test[\\\"Age\\\"].min(), df_test[\\\"Age\\\"].max()]))\\n\",\"print(df_train[\\\"Age\\\"].isnull().sum())\\n\",\"#age_train = df_train.fillna({\\\"Age\\\": df_train[\\\"Age\\\"].mean()})[\\\"Age\\\"]\\n\",\"#df_train[\\\"Age\\\"] = (age_train - age_train.mean()) / age_train.std()\\n\",\"#df_train[\\\"Fare\\\"] = (df_train[\\\"Fare\\\"] - df_train[\\\"Fare\\\"].mean()) / df_train[\\\"Fare\\\"].std()\\n\",\"def ages(x):\\n\",\" if(x <= 11):\\n\",\" return \\\"Young age\\\" # Young Age\\n\",\" elif(x > 11 and x <= 18): # high school\\n\",\" return \\\"high school\\\" \\n\",\" elif(x > 18 and x <= 22): # college\\n\",\" return \\\"college\\\"\\n\",\" elif(x > 22 and x <= 27): # young adult\\n\",\" return \\\"young adults\\\"\\n\",\" elif(x > 27 and x <= 33): # middle age\\n\",\" return \\\"transit age\\\"\\n\",\" elif(x > 33 and x <= 40): #\\n\",\" return \\\"middle age\\\"\\n\",\" elif(x > 40 and x <= 66): #near old\\n\",\" return \\\"old adults\\\"\\n\",\" elif(x > 66):\\n\",\" #print(x)\\n\",\" return \\\"old old\\\"\\n\",\" \\n\",\"#ages(0)\\n\",\"df_train[\\\"Age_a\\\"] = df_train[\\\"Age\\\"].apply(ages)\\n\",\"df_test[\\\"Age_a\\\"] = df_test[\\\"Age\\\"].apply(ages)\\n\",\"df_train.groupby(\\\"Age_a\\\").count()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":589},\"id\":\"3IQ3X-jGe5It\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748551,\"user_tz\":420,\"elapsed\":14,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"edb4d1cc-b1ce-4a39-8ffa-23ee5f4d4e93\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stdout\",\"text\":[\"0\\n\"]},{\"output_type\":\"stream\",\"name\":\"stderr\",\"text\":[\"/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:2: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError. Select only valid columns before calling the reduction.\\n\",\" \\n\",\"/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:3: FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError. Select only valid columns before calling the reduction.\\n\",\" This is separate from the ipykernel package so we can avoid doing imports until\\n\"]},{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Name Sex Age SibSp Parch \\\\\\n\",\"Age_a \\n\",\"Young age 245 245 245 245 245 245 245 245 \\n\",\"college 92 92 92 92 92 92 92 92 \\n\",\"high school 71 71 71 71 71 71 71 71 \\n\",\"middle age 101 101 101 101 101 101 101 101 \\n\",\"old adults 143 143 143 143 143 143 143 143 \\n\",\"old old 7 7 7 7 7 7 7 7 \\n\",\"transit age 126 126 126 126 126 126 126 126 \\n\",\"young adults 106 106 106 106 106 106 106 106 \\n\",\"\\n\",\" Ticket Fare Cabin Embarked ID Girl Boy Female \\\\\\n\",\"Age_a \\n\",\"Young age 245 245 30 245 245 245 245 245 \\n\",\"college 92 92 12 92 92 92 92 92 \\n\",\"high school 71 71 12 71 71 71 71 71 \\n\",\"middle age 101 101 37 100 101 101 101 101 \\n\",\"old adults 143 143 63 142 143 143 143 143 \\n\",\"old old 7 7 3 7 7 7 7 7 \\n\",\"transit age 126 126 24 126 126 126 126 126 \\n\",\"young adults 106 106 23 106 106 106 106 106 \\n\",\"\\n\",\" Num_of_Ticket Ticket_mean Age_mean \\n\",\"Age_a \\n\",\"Young age 245 245 245 \\n\",\"college 92 92 92 \\n\",\"high school 71 71 71 \\n\",\"middle age 101 101 101 \\n\",\"old adults 143 143 143 \\n\",\"old old 7 7 7 \\n\",\"transit age 126 126 126 \\n\",\"young adults 106 106 106 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" ID \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_mean \\n\",\" \\n\",\" \\n\",\" Age_a \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" Young age \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 30 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" 245 \\n\",\" \\n\",\" \\n\",\" college \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 12 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" 92 \\n\",\" \\n\",\" \\n\",\" high school \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 12 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" 71 \\n\",\" \\n\",\" \\n\",\" middle age \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 37 \\n\",\" 100 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" 101 \\n\",\" \\n\",\" \\n\",\" old adults \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 63 \\n\",\" 142 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" 143 \\n\",\" \\n\",\" \\n\",\" old old \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 3 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" \\n\",\" \\n\",\" transit age \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 24 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" 126 \\n\",\" \\n\",\" \\n\",\" young adults \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 23 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" 106 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":319}]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"Cabin\\\"].unique()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"2e6JErCFFE3J\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748552,\"user_tz\":420,\"elapsed\":11,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"56f2a943-3a7f-421e-de28-f60add98f84c\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"array([nan, 'C85', 'C123', 'E46', 'G6', 'C103', 'D56', 'A6',\\n\",\" 'C23 C25 C27', 'B78', 'D33', 'B30', 'C52', 'B28', 'C83', 'F33',\\n\",\" 'F G73', 'E31', 'A5', 'D10 D12', 'D26', 'C110', 'B58 B60', 'E101',\\n\",\" 'F E69', 'D47', 'B86', 'F2', 'C2', 'E33', 'B19', 'A7', 'C49', 'F4',\\n\",\" 'A32', 'B4', 'B80', 'A31', 'D36', 'D15', 'C93', 'C78', 'D35',\\n\",\" 'C87', 'B77', 'E67', 'B94', 'C125', 'C99', 'C118', 'D7', 'A19',\\n\",\" 'B49', 'D', 'C22 C26', 'C106', 'C65', 'E36', 'C54',\\n\",\" 'B57 B59 B63 B66', 'C7', 'E34', 'C32', 'B18', 'C124', 'C91', 'E40',\\n\",\" 'T', 'C128', 'D37', 'B35', 'E50', 'C82', 'B96 B98', 'E10', 'E44',\\n\",\" 'A34', 'C104', 'C111', 'C92', 'E38', 'D21', 'E12', 'E63', 'A14',\\n\",\" 'B37', 'C30', 'D20', 'B79', 'E25', 'D46', 'B73', 'C95', 'B38',\\n\",\" 'B39', 'B22', 'C86', 'C70', 'A16', 'C101', 'C68', 'A10', 'E68',\\n\",\" 'B41', 'A20', 'D19', 'D50', 'D9', 'A23', 'B50', 'A26', 'D48',\\n\",\" 'E58', 'C126', 'B71', 'B51 B53 B55', 'D49', 'B5', 'B20', 'F G63',\\n\",\" 'C62 C64', 'E24', 'C90', 'C45', 'E8', 'B101', 'D45', 'C46', 'D30',\\n\",\" 'E121', 'D11', 'E77', 'F38', 'B3', 'D6', 'B82 B84', 'D17', 'A36',\\n\",\" 'B102', 'B69', 'E49', 'C47', 'D28', 'E17', 'A24', 'C50', 'B42',\\n\",\" 'C148'], dtype=object)\"]},\"metadata\":{},\"execution_count\":320}]},{\"cell_type\":\"code\",\"source\":[\"def cabins(x):\\n\",\" x = str(x)[0]\\n\",\" #print(i)\\n\",\" #print(x)\\n\",\" if(x == \\\"A\\\"):\\n\",\" return \\\"A\\\"\\n\",\" if(x == \\\"B\\\"):\\n\",\" return \\\"B\\\"\\n\",\" if(x == \\\"C\\\"):\\n\",\" return \\\"C\\\"\\n\",\" if(x == \\\"D\\\"):\\n\",\" return \\\"D\\\"\\n\",\" if(x == \\\"E\\\"):\\n\",\" return \\\"E\\\"\\n\",\" if(x == \\\"F\\\"):\\n\",\" return \\\"F\\\"\\n\",\" if(x == \\\"G\\\"):\\n\",\" return \\\"G\\\"\\n\",\" if(x == \\\"T\\\"):\\n\",\" return \\\"T\\\"\\n\",\" if(x == \\\"n\\\"):\\n\",\" return np.nan\\n\",\" else:\\n\",\" print(x)\\n\",\" return 9\\n\",\"def cabins2(x):\\n\",\" x = str(x)[0]\\n\",\" #print(i)\\n\",\" #print(x)\\n\",\" if(x == \\\"n\\\"):\\n\",\" return \\\"No cabin\\\"\\n\",\" elif(x == \\\"A\\\" or x == \\\"B\\\" or x == \\\"C\\\"):\\n\",\" return \\\" Highest Cabin\\\"\\n\",\" elif(x == \\\"D\\\" or x == \\\"E\\\" or x == \\\"F\\\"):\\n\",\" return \\\"Middle Cabin\\\"\\n\",\" else:\\n\",\" return \\\"Lowest Cabin\\\"\\n\",\"df_train[\\\"Compartment\\\"] = df_train[\\\"Cabin\\\"].apply(cabins)\\n\",\"df_test[\\\"Compartment\\\"] = df_test[\\\"Cabin\\\"].apply(cabins)\\n\",\"df_train.groupby(\\\"Compartment\\\").count()\\n\",\"#df_train[\\\"Compartment\\\"].isnull().sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":396},\"id\":\"rCos_k_RE-Tk\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748752,\"user_tz\":420,\"elapsed\":14,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"bd7426d1-3618-48bc-b904-e96e4913a6bf\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Name Sex Age SibSp Parch \\\\\\n\",\"Compartment \\n\",\"A 15 15 15 15 15 15 15 15 \\n\",\"B 47 47 47 47 47 47 47 47 \\n\",\"C 59 59 59 59 59 59 59 59 \\n\",\"D 33 33 33 33 33 33 33 33 \\n\",\"E 32 32 32 32 32 32 32 32 \\n\",\"F 13 13 13 13 13 13 13 13 \\n\",\"G 4 4 4 4 4 4 4 4 \\n\",\"T 1 1 1 1 1 1 1 1 \\n\",\"\\n\",\" Ticket Fare Cabin Embarked ID Girl Boy Female \\\\\\n\",\"Compartment \\n\",\"A 15 15 15 15 15 15 15 15 \\n\",\"B 47 47 47 45 47 47 47 47 \\n\",\"C 59 59 59 59 59 59 59 59 \\n\",\"D 33 33 33 33 33 33 33 33 \\n\",\"E 32 32 32 32 32 32 32 32 \\n\",\"F 13 13 13 13 13 13 13 13 \\n\",\"G 4 4 4 4 4 4 4 4 \\n\",\"T 1 1 1 1 1 1 1 1 \\n\",\"\\n\",\" Num_of_Ticket Ticket_mean Age_mean Age_a \\n\",\"Compartment \\n\",\"A 15 15 15 15 \\n\",\"B 47 47 47 47 \\n\",\"C 59 59 59 59 \\n\",\"D 33 33 33 33 \\n\",\"E 32 32 32 32 \\n\",\"F 13 13 13 13 \\n\",\"G 4 4 4 4 \\n\",\"T 1 1 1 1 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" ID \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_mean \\n\",\" Age_a \\n\",\" \\n\",\" \\n\",\" Compartment \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" A \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" \\n\",\" \\n\",\" B \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 45 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" 47 \\n\",\" \\n\",\" \\n\",\" C \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" \\n\",\" \\n\",\" D \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" 33 \\n\",\" \\n\",\" \\n\",\" E \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" 32 \\n\",\" \\n\",\" \\n\",\" F \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" 13 \\n\",\" \\n\",\" \\n\",\" G \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" \\n\",\" \\n\",\" T \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":321}]},{\"cell_type\":\"code\",\"source\":[\"x = df_train[\\\"Compartment\\\"].isna()\\n\",\"cnan = df_train[x == True]\\n\",\"cnnan = df_train[x == False]\\n\",\"print(cnan)\\n\",\"print(cnnan)\\n\",\"sam = {}\\n\",\"x = cnan[\\\"Ticket\\\"].unique()\\n\",\"\\n\",\"for i in (x):\\n\",\" y = cnnan[\\\"Ticket\\\"].unique()\\n\",\" if (i in y):\\n\",\" \\n\",\" sam[i] = cnnan[cnnan[\\\"Ticket\\\"] == i]['Cabin']\\n\",\"for i in sam:\\n\",\" valu = sam[i] \\n\",\" indexs = cnan[cnan[\\\"Ticket\\\"] == i]\\n\",\" indexs = indexs.index\\n\",\" cnan.loc[indexs, 'Compartment'] = valu\\n\",\"\\n\",\" tw = 20\\n\",\" hun = 100\\n\",\" fif = 50\\n\",\" fs = cnan[cnan[\\\"Fare\\\"] < tw]\\n\",\" fs = fs.index\\n\",\" df_train.loc[fs, 'Compartment'] = 'F' \\n\",\"\\n\",\" bs = cnan[cnan[\\\"Fare\\\"] > hun]\\n\",\" bs = bs.index\\n\",\" df_train.loc[bs, 'Compartment'] = 'B' \\n\",\" \\n\",\" es = cnan[(cnan[\\\"Fare\\\"] > tw) & (cnan[\\\"Fare\\\"] < fif)]\\n\",\" es = es.index\\n\",\" df_train.loc[es, 'Compartment'] = 'E' \\n\",\" \\n\",\" ds = cnan[(cnan[\\\"Fare\\\"] > fif) & (cnan[\\\"Fare\\\"] < hun)]\\n\",\" ds = ds.index\\n\",\" df_train.loc[ds, 'Compartment'] = 'D'\\n\",\"\\n\",\" \\n\",\"df_train[\\\"Compartment\\\"].isnull().sum()\\n\",\"df_train.groupby(\\\"Compartment\\\").count()\\n\",\"# G and T not important\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":503},\"id\":\"RFM7fVFUBNjd\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748753,\"user_tz\":420,\"elapsed\":13,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"f2cc6286-4d7c-4deb-b359-6e518e389717\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stderr\",\"text\":[\"/usr/local/lib/python3.7/dist-packages/pandas/core/indexing.py:1773: SettingWithCopyWarning: \\n\",\"A value is trying to be set on a copy of a slice from a DataFrame.\\n\",\"Try using .loc[row_indexer,col_indexer] = value instead\\n\",\"\\n\",\"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\\n\",\" self._setitem_single_column(ilocs[0], value, pi)\\n\"]},{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Name Sex Age SibSp Parch \\\\\\n\",\"Compartment \\n\",\"A 15 15 15 15 15 15 15 15 \\n\",\"B 57 57 57 57 57 57 57 57 \\n\",\"C 59 59 59 59 59 59 59 59 \\n\",\"D 62 62 62 62 62 62 62 62 \\n\",\"E 191 191 191 191 191 191 191 191 \\n\",\"F 502 502 502 502 502 502 502 502 \\n\",\"G 4 4 4 4 4 4 4 4 \\n\",\"T 1 1 1 1 1 1 1 1 \\n\",\"\\n\",\" Ticket Fare Cabin Embarked ID Girl Boy Female \\\\\\n\",\"Compartment \\n\",\"A 15 15 15 15 15 15 15 15 \\n\",\"B 57 57 47 55 57 57 57 57 \\n\",\"C 59 59 59 59 59 59 59 59 \\n\",\"D 62 62 33 62 62 62 62 62 \\n\",\"E 191 191 32 191 191 191 191 191 \\n\",\"F 502 502 13 502 502 502 502 502 \\n\",\"G 4 4 4 4 4 4 4 4 \\n\",\"T 1 1 1 1 1 1 1 1 \\n\",\"\\n\",\" Num_of_Ticket Ticket_mean Age_mean Age_a \\n\",\"Compartment \\n\",\"A 15 15 15 15 \\n\",\"B 57 57 57 57 \\n\",\"C 59 59 59 59 \\n\",\"D 62 62 62 62 \\n\",\"E 191 191 191 191 \\n\",\"F 502 502 502 502 \\n\",\"G 4 4 4 4 \\n\",\"T 1 1 1 1 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" ID \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_mean \\n\",\" Age_a \\n\",\" \\n\",\" \\n\",\" Compartment \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" A \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" 15 \\n\",\" \\n\",\" \\n\",\" B \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 47 \\n\",\" 55 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" 57 \\n\",\" \\n\",\" \\n\",\" C \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" 59 \\n\",\" \\n\",\" \\n\",\" D \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 33 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" 62 \\n\",\" \\n\",\" \\n\",\" E \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 32 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" 191 \\n\",\" \\n\",\" \\n\",\" F \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 13 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" 502 \\n\",\" \\n\",\" \\n\",\" G \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" 4 \\n\",\" \\n\",\" \\n\",\" T \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":322}]},{\"cell_type\":\"code\",\"source\":[\"# the goal is the change na based on other columns such as fare\\n\",\"x = df_test[\\\"Compartment\\\"].isna()\\n\",\"# take the Na out\\n\",\"cnan = df_test[x == True]\\n\",\"cnnan = df_test[x == False]\\n\",\"print(cnan)\\n\",\"print(cnnan)\\n\",\"sam = {} # dict\\n\",\"y = cnan[\\\"Ticket\\\"].unique()\\n\",\"for i in y:\\n\",\" x = cnnan[\\\"Ticket\\\"].unique()\\n\",\" if (i in x):\\n\",\" sam[i] = cnnan[cnnan[\\\"Ticket\\\"] == i]['Cabin']\\n\",\"\\n\",\"#Did not use A, since numbers are less\\n\",\"for i in sam:\\n\",\" valu = sam[i] \\n\",\" indexs = cnan[cnan[\\\"Ticket\\\"] == i]\\n\",\" indexs = indexs.index\\n\",\" cnan.loc[indexs, 'Compartment'] = valu\\n\",\" tw = 20\\n\",\" hun = 100\\n\",\" fif = 50\\n\",\"# low class\\n\",\" fs = cnan[cnan[\\\"Fare\\\"] < tw]\\n\",\" fs = fs.index\\n\",\" df_test.loc[fs, 'Compartment'] = 'F' \\n\",\"# high class\\n\",\" bs = cnan[cnan[\\\"Fare\\\"] > hun]\\n\",\" bs = bs.index\\n\",\" df_test.loc[bs, 'Compartment'] = 'B' \\n\",\"# midle class 1\\n\",\" es = cnan[(cnan[\\\"Fare\\\"] > tw) & (cnan[\\\"Fare\\\"] < fif)]\\n\",\" es = es.index\\n\",\" df_test.loc[es, \\\"Compartment\\\"] = 'E' \\n\",\"# middle class 2 \\n\",\" ds = cnan[(cnan[\\\"Fare\\\"] > fif) & (cnan[\\\"Fare\\\"] < hun)]\\n\",\" ds = ds.index\\n\",\" df_test.loc[ds, \\\"Compartment\\\"] = 'D'\\n\",\"\\n\",\" \\n\",\"df_test[\\\"Compartment\\\"].isnull().sum()\\n\",\"df_test.groupby(\\\"Compartment\\\").count()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":471},\"id\":\"TipX9M4xEPMQ\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748982,\"user_tz\":420,\"elapsed\":236,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"b743d39a-0ade-4f9d-8472-a5e48ff974e2\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stderr\",\"text\":[\"/usr/local/lib/python3.7/dist-packages/pandas/core/indexing.py:1773: SettingWithCopyWarning: \\n\",\"A value is trying to be set on a copy of a slice from a DataFrame.\\n\",\"Try using .loc[row_indexer,col_indexer] = value instead\\n\",\"\\n\",\"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\\n\",\" self._setitem_single_column(ilocs[0], value, pi)\\n\"]},{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Pclass Name Sex Age SibSp Parch Ticket Fare \\\\\\n\",\"Compartment \\n\",\"A 7 7 7 7 7 7 7 7 7 \\n\",\"B 22 22 22 22 22 22 22 22 22 \\n\",\"C 35 35 35 35 35 35 35 35 35 \\n\",\"D 28 28 28 28 28 28 28 28 28 \\n\",\"E 89 89 89 89 89 89 89 89 89 \\n\",\"F 236 236 236 236 236 236 236 236 236 \\n\",\"G 1 1 1 1 1 1 1 1 1 \\n\",\"\\n\",\" Cabin Embarked ID Fare_mean Age_mean Girl Boy Female \\\\\\n\",\"Compartment \\n\",\"A 7 7 7 7 7 7 7 7 \\n\",\"B 18 22 22 22 22 22 22 22 \\n\",\"C 35 35 35 35 35 35 35 35 \\n\",\"D 13 28 28 28 28 28 28 28 \\n\",\"E 9 89 89 89 89 89 89 89 \\n\",\"F 8 236 236 236 236 236 236 236 \\n\",\"G 1 1 1 1 1 1 1 1 \\n\",\"\\n\",\" Num_of_Ticket Ticket_mean Age_a \\n\",\"Compartment \\n\",\"A 7 7 7 \\n\",\"B 22 22 22 \\n\",\"C 35 35 35 \\n\",\"D 28 28 28 \\n\",\"E 89 89 89 \\n\",\"F 236 236 236 \\n\",\"G 1 1 1 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" Embarked \\n\",\" ID \\n\",\" Fare_mean \\n\",\" Age_mean \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_a \\n\",\" \\n\",\" \\n\",\" Compartment \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" A \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" 7 \\n\",\" \\n\",\" \\n\",\" B \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 18 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" 22 \\n\",\" \\n\",\" \\n\",\" C \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" 35 \\n\",\" \\n\",\" \\n\",\" D \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 13 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" 28 \\n\",\" \\n\",\" \\n\",\" E \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 9 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" 89 \\n\",\" \\n\",\" \\n\",\" F \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 8 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" 236 \\n\",\" \\n\",\" \\n\",\" G \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":323}]},{\"cell_type\":\"code\",\"source\":[\"\\n\",\"#df_train[\\\"Embarked\\\"] = df_train[\\\"Embarked\\\"].replace({\\\"S\\\" : 0, \\\"C\\\": 1, \\\"Q\\\": 2, np.nan : 0})\\n\",\"\\n\",\"#df_test[\\\"Embarked\\\"] = df_test[\\\"Embarked\\\"].replace({\\\"S\\\" : 0, \\\"C\\\": 1, \\\"Q\\\": 2, np.nan : 0})\\n\",\"df_train.groupby(\\\"Embarked\\\").count()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":239},\"id\":\"wGDLrAOojGYx\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189748983,\"user_tz\":420,\"elapsed\":20,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"12e9189f-11ba-4030-d564-0aa7c0486a87\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Name Sex Age SibSp Parch Ticket \\\\\\n\",\"Embarked \\n\",\"C 168 168 168 168 168 168 168 168 168 \\n\",\"Q 77 77 77 77 77 77 77 77 77 \\n\",\"S 644 644 644 644 644 644 644 644 644 \\n\",\"\\n\",\" Fare Cabin ID Girl Boy Female Num_of_Ticket Ticket_mean \\\\\\n\",\"Embarked \\n\",\"C 168 69 168 168 168 168 168 168 \\n\",\"Q 77 4 77 77 77 77 77 77 \\n\",\"S 644 129 644 644 644 644 644 644 \\n\",\"\\n\",\" Age_mean Age_a Compartment \\n\",\"Embarked \\n\",\"C 168 168 168 \\n\",\"Q 77 77 77 \\n\",\"S 644 644 644 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Name \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Ticket \\n\",\" Fare \\n\",\" Cabin \\n\",\" ID \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_mean \\n\",\" Age_a \\n\",\" Compartment \\n\",\" \\n\",\" \\n\",\" Embarked \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" C \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 69 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" 168 \\n\",\" \\n\",\" \\n\",\" Q \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 4 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" 77 \\n\",\" \\n\",\" \\n\",\" S \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 129 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" 644 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":324}]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"fam\\\"] = df_train[\\\"SibSp\\\"] + df_train[\\\"Parch\\\"] + 1 \\n\",\"df_test[\\\"fam\\\"] = df_test[\\\"SibSp\\\"] + df_test[\\\"Parch\\\"] + 1\\n\",\"def fam(x):\\n\",\" \\n\",\" if (x == 2):\\n\",\" return 'Lit'\\n\",\" elif (x == 3):\\n\",\" return 'Med'\\n\",\" elif (x >= 5):\\n\",\" return 'Large'\\n\",\" else:\\n\",\" return 'UNO'\\n\",\"df_train[\\\"fami\\\"] = df_train[\\\"fam\\\"].apply(fam)\\n\",\"df_test[\\\"fami\\\"] = df_test[\\\"fam\\\"].apply(fam)\"],\"metadata\":{\"id\":\"LS5ShuRwhwXB\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"def Mr(x):\\n\",\" return 0\"],\"metadata\":{\"id\":\"AkMhbKzRJeNu\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"markdown\",\"source\":[\"## Combining variables:*italicized text*\"],\"metadata\":{\"id\":\"D6nGAOn76RV7\"}},{\"cell_type\":\"code\",\"source\":[\"# the goal is to predict the surivors based on tickets and females and boys\\n\",\"def ticks(x):\\n\",\" fs = x[\\\"Num_of_Ticket\\\"] > 0\\n\",\" fs2 = x[\\\"Ticket_mean\\\"] == 0 # dead\\n\",\" if ((fs2) and (fs)): # seeing if surived or not 1 if survived 0 otherwise\\n\",\" return 0 # died\\n\",\" else:\\n\",\" return 1 # surived\\n\",\"def ticks2(x):\\n\",\" fs = x[\\\"Num_of_Ticket\\\"] > 0\\n\",\" fs2 = x[\\\"Ticket_mean\\\"] == 1 # it surived, based on surival rate\\n\",\" if (fs2) and (fs): # seeing if surived or not 1 if survived 0 otherwise\\n\",\" return 1 # surived \\n\",\" else:\\n\",\" return 0 # died\\n\",\"\\n\",\"\\n\",\"def survival(x): # now check surival based on ticket mean()\\n\",\" \\n\",\" if (x[\\\"fam\\\"] == 1):\\n\",\" return ticks(x)\\n\",\" elif (x[\\\"fam\\\"] == 2 or x[\\\"fam\\\"] == 3): #x[\\\"Female\\\"] == 0 # seeing if surived or not 1 if survived 0 otherwise\\n\",\" return ticks2(x) \\n\",\" else:\\n\",\" return 0\\n\",\"# now check surival based on ticket mean()\\n\",\"def survival2(x): \\n\",\" #print(x[\\\"Boy\\\"]\\n\",\" if (x[\\\"Boy\\\"] == True): # for all boys\\n\",\" return ticks2(x)\\n\",\" elif (x[\\\"Female\\\"] == 1): #x[\\\"Female\\\"] == 0 # seeing if surived or not 1 if survived 0 otherwise\\n\",\" return ticks(x) # check females \\n\",\" else:\\n\",\" return 0 # males who died\\n\",\"x = df_train[[\\\"Female\\\",\\\"Boy\\\",\\\"Num_of_Ticket\\\",\\\"Ticket_mean\\\"]]\\n\",\"#print(x)\\n\",\"df_train[\\\"pred\\\"] = x.apply(survival2, axis = 1)\\n\",\"df_test[\\\"pred\\\"] = df_test[[\\\"Female\\\",\\\"Boy\\\",\\\"Num_of_Ticket\\\",\\\"Ticket_mean\\\"]].apply(survival2, axis = 1)\\n\",\"#survival(df_test)#df_test.apply(survival)\\n\",\"df_train.corr()\"],\"metadata\":{\"id\":\"9U2nBzOvwmIM\",\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":584},\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189749219,\"user_tz\":420,\"elapsed\":253,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"c8d06ba2-7603-418f-d475-e68316894ed7\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Age SibSp Parch \\\\\\n\",\"PassengerId 1.000000 -0.005007 -0.035144 0.038177 -0.057527 -0.001652 \\n\",\"Survived -0.005007 1.000000 -0.338481 0.009723 -0.035322 0.081629 \\n\",\"Pclass -0.035144 -0.338481 1.000000 -0.362021 0.083081 0.018443 \\n\",\"Age 0.038177 0.009723 -0.362021 1.000000 -0.185670 -0.050290 \\n\",\"SibSp -0.057527 -0.035322 0.083081 -0.185670 1.000000 0.414838 \\n\",\"Parch -0.001652 0.081629 0.018443 -0.050290 0.414838 1.000000 \\n\",\"Fare 0.012658 0.257307 -0.549500 0.135422 0.159651 0.216225 \\n\",\"Girl -0.015289 0.083309 0.087510 -0.210816 0.182041 0.260464 \\n\",\"Boy -0.019889 0.079996 0.085554 -0.245811 0.342930 0.261681 \\n\",\"Female -0.042939 0.543351 -0.131900 -0.025669 0.114631 0.245489 \\n\",\"Num_of_Ticket -0.026957 0.218735 -0.033053 -0.149557 0.641970 0.692114 \\n\",\"Ticket_mean -0.015325 0.714892 -0.374292 0.034474 0.045270 0.159689 \\n\",\"Age_mean 0.013707 0.142433 -0.214786 0.335107 -0.051181 -0.041546 \\n\",\"fam -0.040143 0.016639 0.065997 -0.152023 0.890712 0.783111 \\n\",\"pred -0.021845 0.793451 -0.267145 -0.040102 -0.000622 0.133855 \\n\",\"\\n\",\" Fare Girl Boy Female Num_of_Ticket \\\\\\n\",\"PassengerId 0.012658 -0.015289 -0.019889 -0.042939 -0.026957 \\n\",\"Survived 0.257307 0.083309 0.079996 0.543351 0.218735 \\n\",\"Pclass -0.549500 0.087510 0.085554 -0.131900 -0.033053 \\n\",\"Age 0.135422 -0.210816 -0.245811 -0.025669 -0.149557 \\n\",\"SibSp 0.159651 0.182041 0.342930 0.114631 0.641970 \\n\",\"Parch 0.216225 0.260464 0.261681 0.245489 0.692114 \\n\",\"Fare 1.000000 -0.016508 0.009334 0.182333 0.296949 \\n\",\"Girl -0.016508 1.000000 -0.042390 0.261638 0.328052 \\n\",\"Boy 0.009334 -0.042390 1.000000 -0.162017 0.393461 \\n\",\"Female 0.182333 0.261638 -0.162017 1.000000 0.478069 \\n\",\"Num_of_Ticket 0.296949 0.328052 0.393461 0.478069 1.000000 \\n\",\"Ticket_mean 0.359021 0.084365 0.072889 0.584748 0.344902 \\n\",\"Age_mean 0.119335 -0.005926 -0.029351 0.019217 -0.023339 \\n\",\"fam 0.217138 0.254542 0.365113 0.200988 0.784533 \\n\",\"pred 0.220963 0.120481 0.112534 0.739249 0.316139 \\n\",\"\\n\",\" Ticket_mean Age_mean fam pred \\n\",\"PassengerId -0.015325 0.013707 -0.040143 -0.021845 \\n\",\"Survived 0.714892 0.142433 0.016639 0.793451 \\n\",\"Pclass -0.374292 -0.214786 0.065997 -0.267145 \\n\",\"Age 0.034474 0.335107 -0.152023 -0.040102 \\n\",\"SibSp 0.045270 -0.051181 0.890712 -0.000622 \\n\",\"Parch 0.159689 -0.041546 0.783111 0.133855 \\n\",\"Fare 0.359021 0.119335 0.217138 0.220963 \\n\",\"Girl 0.084365 -0.005926 0.254542 0.120481 \\n\",\"Boy 0.072889 -0.029351 0.365113 0.112534 \\n\",\"Female 0.584748 0.019217 0.200988 0.739249 \\n\",\"Num_of_Ticket 0.344902 -0.023339 0.784533 0.316139 \\n\",\"Ticket_mean 1.000000 0.153077 0.110719 0.846843 \\n\",\"Age_mean 0.153077 1.000000 -0.055737 0.123907 \\n\",\"fam 0.110719 -0.055737 1.000000 0.066446 \\n\",\"pred 0.846843 0.123907 0.066446 1.000000 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_mean \\n\",\" fam \\n\",\" pred \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" 1.000000 \\n\",\" -0.005007 \\n\",\" -0.035144 \\n\",\" 0.038177 \\n\",\" -0.057527 \\n\",\" -0.001652 \\n\",\" 0.012658 \\n\",\" -0.015289 \\n\",\" -0.019889 \\n\",\" -0.042939 \\n\",\" -0.026957 \\n\",\" -0.015325 \\n\",\" 0.013707 \\n\",\" -0.040143 \\n\",\" -0.021845 \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" -0.005007 \\n\",\" 1.000000 \\n\",\" -0.338481 \\n\",\" 0.009723 \\n\",\" -0.035322 \\n\",\" 0.081629 \\n\",\" 0.257307 \\n\",\" 0.083309 \\n\",\" 0.079996 \\n\",\" 0.543351 \\n\",\" 0.218735 \\n\",\" 0.714892 \\n\",\" 0.142433 \\n\",\" 0.016639 \\n\",\" 0.793451 \\n\",\" \\n\",\" \\n\",\" Pclass \\n\",\" -0.035144 \\n\",\" -0.338481 \\n\",\" 1.000000 \\n\",\" -0.362021 \\n\",\" 0.083081 \\n\",\" 0.018443 \\n\",\" -0.549500 \\n\",\" 0.087510 \\n\",\" 0.085554 \\n\",\" -0.131900 \\n\",\" -0.033053 \\n\",\" -0.374292 \\n\",\" -0.214786 \\n\",\" 0.065997 \\n\",\" -0.267145 \\n\",\" \\n\",\" \\n\",\" Age \\n\",\" 0.038177 \\n\",\" 0.009723 \\n\",\" -0.362021 \\n\",\" 1.000000 \\n\",\" -0.185670 \\n\",\" -0.050290 \\n\",\" 0.135422 \\n\",\" -0.210816 \\n\",\" -0.245811 \\n\",\" -0.025669 \\n\",\" -0.149557 \\n\",\" 0.034474 \\n\",\" 0.335107 \\n\",\" -0.152023 \\n\",\" -0.040102 \\n\",\" \\n\",\" \\n\",\" SibSp \\n\",\" -0.057527 \\n\",\" -0.035322 \\n\",\" 0.083081 \\n\",\" -0.185670 \\n\",\" 1.000000 \\n\",\" 0.414838 \\n\",\" 0.159651 \\n\",\" 0.182041 \\n\",\" 0.342930 \\n\",\" 0.114631 \\n\",\" 0.641970 \\n\",\" 0.045270 \\n\",\" -0.051181 \\n\",\" 0.890712 \\n\",\" -0.000622 \\n\",\" \\n\",\" \\n\",\" Parch \\n\",\" -0.001652 \\n\",\" 0.081629 \\n\",\" 0.018443 \\n\",\" -0.050290 \\n\",\" 0.414838 \\n\",\" 1.000000 \\n\",\" 0.216225 \\n\",\" 0.260464 \\n\",\" 0.261681 \\n\",\" 0.245489 \\n\",\" 0.692114 \\n\",\" 0.159689 \\n\",\" -0.041546 \\n\",\" 0.783111 \\n\",\" 0.133855 \\n\",\" \\n\",\" \\n\",\" Fare \\n\",\" 0.012658 \\n\",\" 0.257307 \\n\",\" -0.549500 \\n\",\" 0.135422 \\n\",\" 0.159651 \\n\",\" 0.216225 \\n\",\" 1.000000 \\n\",\" -0.016508 \\n\",\" 0.009334 \\n\",\" 0.182333 \\n\",\" 0.296949 \\n\",\" 0.359021 \\n\",\" 0.119335 \\n\",\" 0.217138 \\n\",\" 0.220963 \\n\",\" \\n\",\" \\n\",\" Girl \\n\",\" -0.015289 \\n\",\" 0.083309 \\n\",\" 0.087510 \\n\",\" -0.210816 \\n\",\" 0.182041 \\n\",\" 0.260464 \\n\",\" -0.016508 \\n\",\" 1.000000 \\n\",\" -0.042390 \\n\",\" 0.261638 \\n\",\" 0.328052 \\n\",\" 0.084365 \\n\",\" -0.005926 \\n\",\" 0.254542 \\n\",\" 0.120481 \\n\",\" \\n\",\" \\n\",\" Boy \\n\",\" -0.019889 \\n\",\" 0.079996 \\n\",\" 0.085554 \\n\",\" -0.245811 \\n\",\" 0.342930 \\n\",\" 0.261681 \\n\",\" 0.009334 \\n\",\" -0.042390 \\n\",\" 1.000000 \\n\",\" -0.162017 \\n\",\" 0.393461 \\n\",\" 0.072889 \\n\",\" -0.029351 \\n\",\" 0.365113 \\n\",\" 0.112534 \\n\",\" \\n\",\" \\n\",\" Female \\n\",\" -0.042939 \\n\",\" 0.543351 \\n\",\" -0.131900 \\n\",\" -0.025669 \\n\",\" 0.114631 \\n\",\" 0.245489 \\n\",\" 0.182333 \\n\",\" 0.261638 \\n\",\" -0.162017 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 0.584748 \\n\",\" 0.019217 \\n\",\" 0.200988 \\n\",\" 0.739249 \\n\",\" \\n\",\" \\n\",\" Num_of_Ticket \\n\",\" -0.026957 \\n\",\" 0.218735 \\n\",\" -0.033053 \\n\",\" -0.149557 \\n\",\" 0.641970 \\n\",\" 0.692114 \\n\",\" 0.296949 \\n\",\" 0.328052 \\n\",\" 0.393461 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" 0.344902 \\n\",\" -0.023339 \\n\",\" 0.784533 \\n\",\" 0.316139 \\n\",\" \\n\",\" \\n\",\" Ticket_mean \\n\",\" -0.015325 \\n\",\" 0.714892 \\n\",\" -0.374292 \\n\",\" 0.034474 \\n\",\" 0.045270 \\n\",\" 0.159689 \\n\",\" 0.359021 \\n\",\" 0.084365 \\n\",\" 0.072889 \\n\",\" 0.584748 \\n\",\" 0.344902 \\n\",\" 1.000000 \\n\",\" 0.153077 \\n\",\" 0.110719 \\n\",\" 0.846843 \\n\",\" \\n\",\" \\n\",\" Age_mean \\n\",\" 0.013707 \\n\",\" 0.142433 \\n\",\" -0.214786 \\n\",\" 0.335107 \\n\",\" -0.051181 \\n\",\" -0.041546 \\n\",\" 0.119335 \\n\",\" -0.005926 \\n\",\" -0.029351 \\n\",\" 0.019217 \\n\",\" -0.023339 \\n\",\" 0.153077 \\n\",\" 1.000000 \\n\",\" -0.055737 \\n\",\" 0.123907 \\n\",\" \\n\",\" \\n\",\" fam \\n\",\" -0.040143 \\n\",\" 0.016639 \\n\",\" 0.065997 \\n\",\" -0.152023 \\n\",\" 0.890712 \\n\",\" 0.783111 \\n\",\" 0.217138 \\n\",\" 0.254542 \\n\",\" 0.365113 \\n\",\" 0.200988 \\n\",\" 0.784533 \\n\",\" 0.110719 \\n\",\" -0.055737 \\n\",\" 1.000000 \\n\",\" 0.066446 \\n\",\" \\n\",\" \\n\",\" pred \\n\",\" -0.021845 \\n\",\" 0.793451 \\n\",\" -0.267145 \\n\",\" -0.040102 \\n\",\" -0.000622 \\n\",\" 0.133855 \\n\",\" 0.220963 \\n\",\" 0.120481 \\n\",\" 0.112534 \\n\",\" 0.739249 \\n\",\" 0.316139 \\n\",\" 0.846843 \\n\",\" 0.123907 \\n\",\" 0.066446 \\n\",\" 1.000000 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":327}]},{\"cell_type\":\"code\",\"source\":[\"df_train[[\\\"Survived\\\", \\\"Embarked\\\", \\\"Compartment\\\", \\\"Age_a\\\", \\\"ID\\\"]].corr()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":81},\"id\":\"G15peRrRjhhf\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189749220,\"user_tz\":420,\"elapsed\":35,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"3f1f6d69-3b15-4e73-c290-83ea4db24295\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" Survived\\n\",\"Survived 1.0\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" 1.0 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":328}]},{\"cell_type\":\"code\",\"source\":[\"df_train = df_train.replace({\\\"male\\\": 0, \\\"female\\\": 1})\\n\",\"df_test = df_test.replace({\\\"male\\\": 0, \\\"female\\\": 1})\"],\"metadata\":{\"id\":\"DxEcJgWGASVY\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"#df_train[\\\"fam\\\"] = (df_train[\\\"SibSp\\\"] + df_train[\\\"Parch\\\"]) / df_train[\\\"Fare\\\"]\"],\"metadata\":{\"id\":\"MH7-aSgvautI\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_train.corr()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":615},\"id\":\"Ewk2CrU2XMW0\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189749222,\"user_tz\":420,\"elapsed\":28,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"1d5390fd-94b0-43ff-c9f9-9c7f94894314\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived Pclass Sex Age SibSp \\\\\\n\",\"PassengerId 1.000000 -0.005007 -0.035144 -0.042939 0.038177 -0.057527 \\n\",\"Survived -0.005007 1.000000 -0.338481 0.543351 0.009723 -0.035322 \\n\",\"Pclass -0.035144 -0.338481 1.000000 -0.131900 -0.362021 0.083081 \\n\",\"Sex -0.042939 0.543351 -0.131900 1.000000 -0.025669 0.114631 \\n\",\"Age 0.038177 0.009723 -0.362021 -0.025669 1.000000 -0.185670 \\n\",\"SibSp -0.057527 -0.035322 0.083081 0.114631 -0.185670 1.000000 \\n\",\"Parch -0.001652 0.081629 0.018443 0.245489 -0.050290 0.414838 \\n\",\"Fare 0.012658 0.257307 -0.549500 0.182333 0.135422 0.159651 \\n\",\"Girl -0.015289 0.083309 0.087510 0.261638 -0.210816 0.182041 \\n\",\"Boy -0.019889 0.079996 0.085554 -0.162017 -0.245811 0.342930 \\n\",\"Female -0.042939 0.543351 -0.131900 1.000000 -0.025669 0.114631 \\n\",\"Num_of_Ticket -0.026957 0.218735 -0.033053 0.478069 -0.149557 0.641970 \\n\",\"Ticket_mean -0.015325 0.714892 -0.374292 0.584748 0.034474 0.045270 \\n\",\"Age_mean 0.013707 0.142433 -0.214786 0.019217 0.335107 -0.051181 \\n\",\"fam -0.040143 0.016639 0.065997 0.200988 -0.152023 0.890712 \\n\",\"pred -0.021845 0.793451 -0.267145 0.739249 -0.040102 -0.000622 \\n\",\"\\n\",\" Parch Fare Girl Boy Female \\\\\\n\",\"PassengerId -0.001652 0.012658 -0.015289 -0.019889 -0.042939 \\n\",\"Survived 0.081629 0.257307 0.083309 0.079996 0.543351 \\n\",\"Pclass 0.018443 -0.549500 0.087510 0.085554 -0.131900 \\n\",\"Sex 0.245489 0.182333 0.261638 -0.162017 1.000000 \\n\",\"Age -0.050290 0.135422 -0.210816 -0.245811 -0.025669 \\n\",\"SibSp 0.414838 0.159651 0.182041 0.342930 0.114631 \\n\",\"Parch 1.000000 0.216225 0.260464 0.261681 0.245489 \\n\",\"Fare 0.216225 1.000000 -0.016508 0.009334 0.182333 \\n\",\"Girl 0.260464 -0.016508 1.000000 -0.042390 0.261638 \\n\",\"Boy 0.261681 0.009334 -0.042390 1.000000 -0.162017 \\n\",\"Female 0.245489 0.182333 0.261638 -0.162017 1.000000 \\n\",\"Num_of_Ticket 0.692114 0.296949 0.328052 0.393461 0.478069 \\n\",\"Ticket_mean 0.159689 0.359021 0.084365 0.072889 0.584748 \\n\",\"Age_mean -0.041546 0.119335 -0.005926 -0.029351 0.019217 \\n\",\"fam 0.783111 0.217138 0.254542 0.365113 0.200988 \\n\",\"pred 0.133855 0.220963 0.120481 0.112534 0.739249 \\n\",\"\\n\",\" Num_of_Ticket Ticket_mean Age_mean fam pred \\n\",\"PassengerId -0.026957 -0.015325 0.013707 -0.040143 -0.021845 \\n\",\"Survived 0.218735 0.714892 0.142433 0.016639 0.793451 \\n\",\"Pclass -0.033053 -0.374292 -0.214786 0.065997 -0.267145 \\n\",\"Sex 0.478069 0.584748 0.019217 0.200988 0.739249 \\n\",\"Age -0.149557 0.034474 0.335107 -0.152023 -0.040102 \\n\",\"SibSp 0.641970 0.045270 -0.051181 0.890712 -0.000622 \\n\",\"Parch 0.692114 0.159689 -0.041546 0.783111 0.133855 \\n\",\"Fare 0.296949 0.359021 0.119335 0.217138 0.220963 \\n\",\"Girl 0.328052 0.084365 -0.005926 0.254542 0.120481 \\n\",\"Boy 0.393461 0.072889 -0.029351 0.365113 0.112534 \\n\",\"Female 0.478069 0.584748 0.019217 0.200988 0.739249 \\n\",\"Num_of_Ticket 1.000000 0.344902 -0.023339 0.784533 0.316139 \\n\",\"Ticket_mean 0.344902 1.000000 0.153077 0.110719 0.846843 \\n\",\"Age_mean -0.023339 0.153077 1.000000 -0.055737 0.123907 \\n\",\"fam 0.784533 0.110719 -0.055737 1.000000 0.066446 \\n\",\"pred 0.316139 0.846843 0.123907 0.066446 1.000000 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" Pclass \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Ticket_mean \\n\",\" Age_mean \\n\",\" fam \\n\",\" pred \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" 1.000000 \\n\",\" -0.005007 \\n\",\" -0.035144 \\n\",\" -0.042939 \\n\",\" 0.038177 \\n\",\" -0.057527 \\n\",\" -0.001652 \\n\",\" 0.012658 \\n\",\" -0.015289 \\n\",\" -0.019889 \\n\",\" -0.042939 \\n\",\" -0.026957 \\n\",\" -0.015325 \\n\",\" 0.013707 \\n\",\" -0.040143 \\n\",\" -0.021845 \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" -0.005007 \\n\",\" 1.000000 \\n\",\" -0.338481 \\n\",\" 0.543351 \\n\",\" 0.009723 \\n\",\" -0.035322 \\n\",\" 0.081629 \\n\",\" 0.257307 \\n\",\" 0.083309 \\n\",\" 0.079996 \\n\",\" 0.543351 \\n\",\" 0.218735 \\n\",\" 0.714892 \\n\",\" 0.142433 \\n\",\" 0.016639 \\n\",\" 0.793451 \\n\",\" \\n\",\" \\n\",\" Pclass \\n\",\" -0.035144 \\n\",\" -0.338481 \\n\",\" 1.000000 \\n\",\" -0.131900 \\n\",\" -0.362021 \\n\",\" 0.083081 \\n\",\" 0.018443 \\n\",\" -0.549500 \\n\",\" 0.087510 \\n\",\" 0.085554 \\n\",\" -0.131900 \\n\",\" -0.033053 \\n\",\" -0.374292 \\n\",\" -0.214786 \\n\",\" 0.065997 \\n\",\" -0.267145 \\n\",\" \\n\",\" \\n\",\" Sex \\n\",\" -0.042939 \\n\",\" 0.543351 \\n\",\" -0.131900 \\n\",\" 1.000000 \\n\",\" -0.025669 \\n\",\" 0.114631 \\n\",\" 0.245489 \\n\",\" 0.182333 \\n\",\" 0.261638 \\n\",\" -0.162017 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 0.584748 \\n\",\" 0.019217 \\n\",\" 0.200988 \\n\",\" 0.739249 \\n\",\" \\n\",\" \\n\",\" Age \\n\",\" 0.038177 \\n\",\" 0.009723 \\n\",\" -0.362021 \\n\",\" -0.025669 \\n\",\" 1.000000 \\n\",\" -0.185670 \\n\",\" -0.050290 \\n\",\" 0.135422 \\n\",\" -0.210816 \\n\",\" -0.245811 \\n\",\" -0.025669 \\n\",\" -0.149557 \\n\",\" 0.034474 \\n\",\" 0.335107 \\n\",\" -0.152023 \\n\",\" -0.040102 \\n\",\" \\n\",\" \\n\",\" SibSp \\n\",\" -0.057527 \\n\",\" -0.035322 \\n\",\" 0.083081 \\n\",\" 0.114631 \\n\",\" -0.185670 \\n\",\" 1.000000 \\n\",\" 0.414838 \\n\",\" 0.159651 \\n\",\" 0.182041 \\n\",\" 0.342930 \\n\",\" 0.114631 \\n\",\" 0.641970 \\n\",\" 0.045270 \\n\",\" -0.051181 \\n\",\" 0.890712 \\n\",\" -0.000622 \\n\",\" \\n\",\" \\n\",\" Parch \\n\",\" -0.001652 \\n\",\" 0.081629 \\n\",\" 0.018443 \\n\",\" 0.245489 \\n\",\" -0.050290 \\n\",\" 0.414838 \\n\",\" 1.000000 \\n\",\" 0.216225 \\n\",\" 0.260464 \\n\",\" 0.261681 \\n\",\" 0.245489 \\n\",\" 0.692114 \\n\",\" 0.159689 \\n\",\" -0.041546 \\n\",\" 0.783111 \\n\",\" 0.133855 \\n\",\" \\n\",\" \\n\",\" Fare \\n\",\" 0.012658 \\n\",\" 0.257307 \\n\",\" -0.549500 \\n\",\" 0.182333 \\n\",\" 0.135422 \\n\",\" 0.159651 \\n\",\" 0.216225 \\n\",\" 1.000000 \\n\",\" -0.016508 \\n\",\" 0.009334 \\n\",\" 0.182333 \\n\",\" 0.296949 \\n\",\" 0.359021 \\n\",\" 0.119335 \\n\",\" 0.217138 \\n\",\" 0.220963 \\n\",\" \\n\",\" \\n\",\" Girl \\n\",\" -0.015289 \\n\",\" 0.083309 \\n\",\" 0.087510 \\n\",\" 0.261638 \\n\",\" -0.210816 \\n\",\" 0.182041 \\n\",\" 0.260464 \\n\",\" -0.016508 \\n\",\" 1.000000 \\n\",\" -0.042390 \\n\",\" 0.261638 \\n\",\" 0.328052 \\n\",\" 0.084365 \\n\",\" -0.005926 \\n\",\" 0.254542 \\n\",\" 0.120481 \\n\",\" \\n\",\" \\n\",\" Boy \\n\",\" -0.019889 \\n\",\" 0.079996 \\n\",\" 0.085554 \\n\",\" -0.162017 \\n\",\" -0.245811 \\n\",\" 0.342930 \\n\",\" 0.261681 \\n\",\" 0.009334 \\n\",\" -0.042390 \\n\",\" 1.000000 \\n\",\" -0.162017 \\n\",\" 0.393461 \\n\",\" 0.072889 \\n\",\" -0.029351 \\n\",\" 0.365113 \\n\",\" 0.112534 \\n\",\" \\n\",\" \\n\",\" Female \\n\",\" -0.042939 \\n\",\" 0.543351 \\n\",\" -0.131900 \\n\",\" 1.000000 \\n\",\" -0.025669 \\n\",\" 0.114631 \\n\",\" 0.245489 \\n\",\" 0.182333 \\n\",\" 0.261638 \\n\",\" -0.162017 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 0.584748 \\n\",\" 0.019217 \\n\",\" 0.200988 \\n\",\" 0.739249 \\n\",\" \\n\",\" \\n\",\" Num_of_Ticket \\n\",\" -0.026957 \\n\",\" 0.218735 \\n\",\" -0.033053 \\n\",\" 0.478069 \\n\",\" -0.149557 \\n\",\" 0.641970 \\n\",\" 0.692114 \\n\",\" 0.296949 \\n\",\" 0.328052 \\n\",\" 0.393461 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" 0.344902 \\n\",\" -0.023339 \\n\",\" 0.784533 \\n\",\" 0.316139 \\n\",\" \\n\",\" \\n\",\" Ticket_mean \\n\",\" -0.015325 \\n\",\" 0.714892 \\n\",\" -0.374292 \\n\",\" 0.584748 \\n\",\" 0.034474 \\n\",\" 0.045270 \\n\",\" 0.159689 \\n\",\" 0.359021 \\n\",\" 0.084365 \\n\",\" 0.072889 \\n\",\" 0.584748 \\n\",\" 0.344902 \\n\",\" 1.000000 \\n\",\" 0.153077 \\n\",\" 0.110719 \\n\",\" 0.846843 \\n\",\" \\n\",\" \\n\",\" Age_mean \\n\",\" 0.013707 \\n\",\" 0.142433 \\n\",\" -0.214786 \\n\",\" 0.019217 \\n\",\" 0.335107 \\n\",\" -0.051181 \\n\",\" -0.041546 \\n\",\" 0.119335 \\n\",\" -0.005926 \\n\",\" -0.029351 \\n\",\" 0.019217 \\n\",\" -0.023339 \\n\",\" 0.153077 \\n\",\" 1.000000 \\n\",\" -0.055737 \\n\",\" 0.123907 \\n\",\" \\n\",\" \\n\",\" fam \\n\",\" -0.040143 \\n\",\" 0.016639 \\n\",\" 0.065997 \\n\",\" 0.200988 \\n\",\" -0.152023 \\n\",\" 0.890712 \\n\",\" 0.783111 \\n\",\" 0.217138 \\n\",\" 0.254542 \\n\",\" 0.365113 \\n\",\" 0.200988 \\n\",\" 0.784533 \\n\",\" 0.110719 \\n\",\" -0.055737 \\n\",\" 1.000000 \\n\",\" 0.066446 \\n\",\" \\n\",\" \\n\",\" pred \\n\",\" -0.021845 \\n\",\" 0.793451 \\n\",\" -0.267145 \\n\",\" 0.739249 \\n\",\" -0.040102 \\n\",\" -0.000622 \\n\",\" 0.133855 \\n\",\" 0.220963 \\n\",\" 0.120481 \\n\",\" 0.112534 \\n\",\" 0.739249 \\n\",\" 0.316139 \\n\",\" 0.846843 \\n\",\" 0.123907 \\n\",\" 0.066446 \\n\",\" 1.000000 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":331}]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"oVjcNzur5d9D\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"Age\\\"] = df_train[\\\"Age\\\"].fillna({\\\"Age\\\": df_train[\\\"Age\\\"].median()})\\n\",\"df_test[\\\"Age\\\"] = df_test[\\\"Age\\\"].fillna({\\\"Age\\\": df_test[\\\"Age\\\"].median()})\\n\",\"age_train = df_train.fillna({\\\"Age\\\": df_train[\\\"Age\\\"].mean()})[\\\"Age\\\"]\\n\",\"df_train[\\\"Ages\\\"] = (age_train - age_train.mean()) / age_train.std()\\n\",\"df_train[\\\"Fares\\\"] = (df_train[\\\"Fare\\\"] - df_train[\\\"Fare\\\"].mean()) / df_train[\\\"Fare\\\"].std()\\n\",\"df_train\\n\",\"age_test = df_test.fillna({\\\"Age\\\": df_test[\\\"Age\\\"].mean()})[\\\"Age\\\"]\\n\",\"df_test[\\\"Ages\\\"] = (age_test - age_test.mean()) / age_test.std()\\n\",\"df_test[\\\"Fares\\\"] = (df_test[\\\"Fare\\\"] - df_test[\\\"Fare\\\"].mean()) / df_test[\\\"Fare\\\"].std()\\n\",\"df_test[\\\"Fares\\\"] = df_test[\\\"Fares\\\"].fillna({\\\"Fares\\\": df_test[\\\"Fares\\\"].median()})\\n\",\"df_train[\\\"Fares\\\"] = df_train[\\\"Fares\\\"].fillna({\\\"Fares\\\": df_train[\\\"Fares\\\"].median()})\\n\",\"df_train.isnull().sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"vtiCZ5sGEtne\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189749223,\"user_tz\":420,\"elapsed\":20,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"521f9267-eac7-4ac0-beb7-fb94ed84d160\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"PassengerId 0\\n\",\"Survived 0\\n\",\"Pclass 0\\n\",\"Name 0\\n\",\"Sex 0\\n\",\"Age 0\\n\",\"SibSp 0\\n\",\"Parch 0\\n\",\"Ticket 0\\n\",\"Fare 0\\n\",\"Cabin 687\\n\",\"Embarked 2\\n\",\"ID 0\\n\",\"Girl 0\\n\",\"Boy 0\\n\",\"Female 0\\n\",\"Num_of_Ticket 0\\n\",\"Ticket_mean 0\\n\",\"Age_mean 0\\n\",\"Age_a 0\\n\",\"Compartment 0\\n\",\"fam 0\\n\",\"fami 0\\n\",\"pred 0\\n\",\"Ages 0\\n\",\"Fares 0\\n\",\"dtype: int64\"]},\"metadata\":{},\"execution_count\":332}]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"p*fare\\\"] = df_train[\\\"Fare\\\"]*df_train[\\\"Pclass\\\"]\\n\",\"df_test[\\\"p*fare\\\"] = df_test[\\\"Fare\\\"]*df_test[\\\"Pclass\\\"]\\n\",\"df_train.corr()\\n\",\"df_test[\\\"p*fare\\\"] = df_test[\\\"p*fare\\\"].replace(np.nan, df_test[\\\"p*fare\\\"].mean()) #.isnull().sum()\\n\",\"#X_train[\\\"p*fare\\\"].replace(np.nan, X_train[\\\"p*fare\\\"].mean()).unique()\\n\",\"df_test[\\\"Age_a\\\"].isnull().sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"c_pZx_eeGxL1\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189749223,\"user_tz\":420,\"elapsed\":16,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"f8b6cabd-8086-4631-ccc6-aed6e22bbcae\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"0\"]},\"metadata\":{},\"execution_count\":333}]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"nPAlfXUEp3Ya\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"Fare\\\"] = df_train[\\\"Fare\\\"].replace(np.NaN, df_train[\\\"Fare\\\"].median())\\n\",\"df_test[\\\"Fare\\\"] = df_test[\\\"Fare\\\"].replace(np.NaN, df_test[\\\"Fare\\\"].median())\\n\",\"\\n\",\"#df_trains[\\\"Fare\\\"] = df_trains[\\\"Fare\\\"].replace(np.NaN, df_trains[\\\"Fare\\\"].mean())\\n\",\"#df_tests[\\\"Fare\\\"] = df_tests[\\\"Fare\\\"].replace(np.NaN, df_tests[\\\"Fare\\\"].mean())\"],\"metadata\":{\"id\":\"aXoU55P5ztJ2\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"Pclass\\\"] = (df_train[\\\"Pclass\\\"]).astype(str)\\n\",\"df_test[\\\"Pclass\\\"] = (df_test[\\\"Pclass\\\"]).astype(str)\"],\"metadata\":{\"id\":\"YjDN08Pdcp9_\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_tests = pd.get_dummies(df_test.drop(columns = [\\\"Name\\\", \\\"Ticket\\\", \\\"PassengerId\\\", \\\"Fares\\\", \\\"Ages\\\"], axis = 1), dummy_na = True)\\n\",\"df_trains = pd.get_dummies(df_train.drop(columns = [\\\"Name\\\", \\\"Ticket\\\", \\\"PassengerId\\\", \\\"Fares\\\", \\\"Ages\\\"], axis = 1), dummy_na = True)\\n\",\"df_trains\\n\",\"#\\\"Cabin\\\"\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":488},\"id\":\"box5zNaIECa9\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189749418,\"user_tz\":420,\"elapsed\":9,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"3cbd49be-9ce6-4272-a86c-377feedb4622\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" Survived Sex Age SibSp Parch Fare Girl Boy Female \\\\\\n\",\"0 0 0 22.00 1 0 7.2500 False False 0 \\n\",\"1 1 1 38.00 1 0 71.2833 False False 1 \\n\",\"2 1 1 26.00 0 0 7.9250 False False 1 \\n\",\"3 1 1 35.00 1 0 53.1000 False False 1 \\n\",\"4 0 0 35.00 0 0 8.0500 False False 0 \\n\",\".. ... ... ... ... ... ... ... ... ... \\n\",\"886 0 0 27.00 0 0 13.0000 False False 0 \\n\",\"887 1 1 19.00 0 0 30.0000 False False 1 \\n\",\"888 0 1 0.42 1 2 23.4500 False False 1 \\n\",\"889 1 0 26.00 0 0 30.0000 False False 0 \\n\",\"890 0 0 32.00 0 0 7.7500 False False 0 \\n\",\"\\n\",\" Num_of_Ticket ... Compartment_E Compartment_F Compartment_G \\\\\\n\",\"0 0 ... 0 1 0 \\n\",\"1 1 ... 0 0 0 \\n\",\"2 1 ... 0 1 0 \\n\",\"3 1 ... 0 0 0 \\n\",\"4 0 ... 0 1 0 \\n\",\".. ... ... ... ... ... \\n\",\"886 0 ... 0 1 0 \\n\",\"887 1 ... 0 0 0 \\n\",\"888 1 ... 1 0 0 \\n\",\"889 0 ... 0 0 0 \\n\",\"890 0 ... 0 1 0 \\n\",\"\\n\",\" Compartment_T Compartment_nan fami_Large fami_Lit fami_Med fami_UNO \\\\\\n\",\"0 0 0 0 1 0 0 \\n\",\"1 0 0 0 1 0 0 \\n\",\"2 0 0 0 0 0 1 \\n\",\"3 0 0 0 1 0 0 \\n\",\"4 0 0 0 0 0 1 \\n\",\".. ... ... ... ... ... ... \\n\",\"886 0 0 0 0 0 1 \\n\",\"887 0 0 0 0 0 1 \\n\",\"888 0 0 0 0 0 1 \\n\",\"889 0 0 0 0 0 1 \\n\",\"890 0 0 0 0 0 1 \\n\",\"\\n\",\" fami_nan \\n\",\"0 0 \\n\",\"1 0 \\n\",\"2 0 \\n\",\"3 0 \\n\",\"4 0 \\n\",\".. ... \\n\",\"886 0 \\n\",\"887 0 \\n\",\"888 0 \\n\",\"889 0 \\n\",\"890 0 \\n\",\"\\n\",\"[891 rows x 200 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" ... \\n\",\" Compartment_E \\n\",\" Compartment_F \\n\",\" Compartment_G \\n\",\" Compartment_T \\n\",\" Compartment_nan \\n\",\" fami_Large \\n\",\" fami_Lit \\n\",\" fami_Med \\n\",\" fami_UNO \\n\",\" fami_nan \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 22.00 \\n\",\" 1 \\n\",\" 0 \\n\",\" 7.2500 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 38.00 \\n\",\" 1 \\n\",\" 0 \\n\",\" 71.2833 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 2 \\n\",\" 1 \\n\",\" 1 \\n\",\" 26.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 7.9250 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 3 \\n\",\" 1 \\n\",\" 1 \\n\",\" 35.00 \\n\",\" 1 \\n\",\" 0 \\n\",\" 53.1000 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 4 \\n\",\" 0 \\n\",\" 0 \\n\",\" 35.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 8.0500 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" 886 \\n\",\" 0 \\n\",\" 0 \\n\",\" 27.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 13.0000 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 887 \\n\",\" 1 \\n\",\" 1 \\n\",\" 19.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 30.0000 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 888 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0.42 \\n\",\" 1 \\n\",\" 2 \\n\",\" 23.4500 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 889 \\n\",\" 1 \\n\",\" 0 \\n\",\" 26.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 30.0000 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 890 \\n\",\" 0 \\n\",\" 0 \\n\",\" 32.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 7.7500 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
891 rows × 200 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":336}]},{\"cell_type\":\"code\",\"source\":[\"#df_trains = df_trains.drop([\\\"PassengerId\\\"])\\n\",\"df_trains\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":488},\"id\":\"OBbNKdBXYvWg\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189749418,\"user_tz\":420,\"elapsed\":8,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"da40e21e-84de-477c-c59d-c4e7d933b2ba\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" Survived Sex Age SibSp Parch Fare Girl Boy Female \\\\\\n\",\"0 0 0 22.00 1 0 7.2500 False False 0 \\n\",\"1 1 1 38.00 1 0 71.2833 False False 1 \\n\",\"2 1 1 26.00 0 0 7.9250 False False 1 \\n\",\"3 1 1 35.00 1 0 53.1000 False False 1 \\n\",\"4 0 0 35.00 0 0 8.0500 False False 0 \\n\",\".. ... ... ... ... ... ... ... ... ... \\n\",\"886 0 0 27.00 0 0 13.0000 False False 0 \\n\",\"887 1 1 19.00 0 0 30.0000 False False 1 \\n\",\"888 0 1 0.42 1 2 23.4500 False False 1 \\n\",\"889 1 0 26.00 0 0 30.0000 False False 0 \\n\",\"890 0 0 32.00 0 0 7.7500 False False 0 \\n\",\"\\n\",\" Num_of_Ticket ... Compartment_E Compartment_F Compartment_G \\\\\\n\",\"0 0 ... 0 1 0 \\n\",\"1 1 ... 0 0 0 \\n\",\"2 1 ... 0 1 0 \\n\",\"3 1 ... 0 0 0 \\n\",\"4 0 ... 0 1 0 \\n\",\".. ... ... ... ... ... \\n\",\"886 0 ... 0 1 0 \\n\",\"887 1 ... 0 0 0 \\n\",\"888 1 ... 1 0 0 \\n\",\"889 0 ... 0 0 0 \\n\",\"890 0 ... 0 1 0 \\n\",\"\\n\",\" Compartment_T Compartment_nan fami_Large fami_Lit fami_Med fami_UNO \\\\\\n\",\"0 0 0 0 1 0 0 \\n\",\"1 0 0 0 1 0 0 \\n\",\"2 0 0 0 0 0 1 \\n\",\"3 0 0 0 1 0 0 \\n\",\"4 0 0 0 0 0 1 \\n\",\".. ... ... ... ... ... ... \\n\",\"886 0 0 0 0 0 1 \\n\",\"887 0 0 0 0 0 1 \\n\",\"888 0 0 0 0 0 1 \\n\",\"889 0 0 0 0 0 1 \\n\",\"890 0 0 0 0 0 1 \\n\",\"\\n\",\" fami_nan \\n\",\"0 0 \\n\",\"1 0 \\n\",\"2 0 \\n\",\"3 0 \\n\",\"4 0 \\n\",\".. ... \\n\",\"886 0 \\n\",\"887 0 \\n\",\"888 0 \\n\",\"889 0 \\n\",\"890 0 \\n\",\"\\n\",\"[891 rows x 200 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" Sex \\n\",\" Age \\n\",\" SibSp \\n\",\" Parch \\n\",\" Fare \\n\",\" Girl \\n\",\" Boy \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" ... \\n\",\" Compartment_E \\n\",\" Compartment_F \\n\",\" Compartment_G \\n\",\" Compartment_T \\n\",\" Compartment_nan \\n\",\" fami_Large \\n\",\" fami_Lit \\n\",\" fami_Med \\n\",\" fami_UNO \\n\",\" fami_nan \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 22.00 \\n\",\" 1 \\n\",\" 0 \\n\",\" 7.2500 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 38.00 \\n\",\" 1 \\n\",\" 0 \\n\",\" 71.2833 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 2 \\n\",\" 1 \\n\",\" 1 \\n\",\" 26.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 7.9250 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 3 \\n\",\" 1 \\n\",\" 1 \\n\",\" 35.00 \\n\",\" 1 \\n\",\" 0 \\n\",\" 53.1000 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 4 \\n\",\" 0 \\n\",\" 0 \\n\",\" 35.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 8.0500 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" 886 \\n\",\" 0 \\n\",\" 0 \\n\",\" 27.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 13.0000 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 887 \\n\",\" 1 \\n\",\" 1 \\n\",\" 19.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 30.0000 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 888 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0.42 \\n\",\" 1 \\n\",\" 2 \\n\",\" 23.4500 \\n\",\" False \\n\",\" False \\n\",\" 1 \\n\",\" 1 \\n\",\" ... \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 889 \\n\",\" 1 \\n\",\" 0 \\n\",\" 26.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 30.0000 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 890 \\n\",\" 0 \\n\",\" 0 \\n\",\" 32.00 \\n\",\" 0 \\n\",\" 0 \\n\",\" 7.7500 \\n\",\" False \\n\",\" False \\n\",\" 0 \\n\",\" 0 \\n\",\" ... \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
891 rows × 200 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":337}]},{\"cell_type\":\"code\",\"source\":[\"#df_trains[\\\"\\\"].isnull().sum() \\n\",\"#df_tests[\\\"Fares\\\"] = df_tests[\\\"Fares\\\"].replace(np.nan, df_tests[\\\"Fares\\\"].median())\\n\",\"#df_trains[\\\"Fares\\\"] = df_trains[\\\"Fares\\\"].replace(np.nan, df_trains[\\\"Fares\\\"].median()\\n\",\"x = df_train.isnull().sum() != 0\\n\",\"x\\n\",\"df_trains[\\\"Ticket_mean\\\"].isnull().sum()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"vRbAeAy2K4KD\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189749419,\"user_tz\":420,\"elapsed\":8,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"9e58cbe0-1046-465a-eb10-98cfa8c88281\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"0\"]},\"metadata\":{},\"execution_count\":338}]},{\"cell_type\":\"code\",\"source\":[\"from sklearn.ensemble import RandomForestClassifier\\n\",\"#df_trains = df_trains.drop([\\\"PassengerId\\\"])\\n\",\"#df_trains = df_trains.drop([\\\"Survived\\\"])\\n\",\"Y_train = df_train[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"#X_test = df_test[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"Y_test = df[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"X_train = df_trains #.drop([\\\"Survived\\\"]) #[t] #[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex\\\", \\\"ID\\\", \\\"Age_a\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\n\",\"X_test = df_tests #.drop([\\\"Survived\\\"]) #[\\\"Survived\\\"] #[t]\\n\",\"est = 100\\n\",\"spl = 7\\n\",\"leaf = 18\\n\",\"rf = RandomForestClassifier(n_estimators = est, criterion = 'gini', max_features = 'sqrt', min_samples_split = spl,\\n\",\"min_weight_fraction_leaf = 0,max_leaf_nodes = leaf)\\n\",\"rf = rf.fit(X_train, Y_train)\\n\",\"x = rf.feature_importances_ # find feature importance\\n\",\"\\n\",\"ind = np.argsort(x)\\n\",\"ind = ind[::-1] # sort it\\n\",\"\\n\",\"print(' All Feature')\\n\",\"for i in range(X_train.shape[1]):\\n\",\" a = ind[i]\\n\",\" x = X_train.columns[a]\\n\",\" y = rf.feature_importances_[a]\\n\",\" print((i + 1, ind[i], x, y))\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"U8hcwTBXFwEF\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189752413,\"user_tz\":420,\"elapsed\":3000,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"38bb13f7-c307-41e5-a75c-1d0bd0f7c467\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stdout\",\"text\":[\" All Feature\\n\",\"(1, 0, 'Survived', 0.28399020350078374)\\n\",\"(2, 13, 'pred', 0.16294124915182967)\\n\",\"(3, 10, 'Ticket_mean', 0.10692018291905142)\\n\",\"(4, 173, 'ID_Mr', 0.06676936609716985)\\n\",\"(5, 8, 'Female', 0.049341283721228174)\\n\",\"(6, 9, 'Num_of_Ticket', 0.04741499285067726)\\n\",\"(7, 1, 'Sex', 0.036787373599328446)\\n\",\"(8, 14, 'p*fare', 0.027984690650595737)\\n\",\"(9, 5, 'Fare', 0.022745941799075266)\\n\",\"(10, 17, 'Pclass_3', 0.01990731490475823)\\n\",\"(11, 172, 'ID_Miss', 0.017497240808092673)\\n\",\"(12, 166, 'Cabin_nan', 0.015623065112086196)\\n\",\"(13, 15, 'Pclass_1', 0.015360719024911899)\\n\",\"(14, 174, 'ID_Mrs', 0.013423856665718858)\\n\",\"(15, 12, 'fam', 0.009530322591867636)\\n\",\"(16, 195, 'fami_Large', 0.008688050641486023)\\n\",\"(17, 2, 'Age', 0.008292893111434925)\\n\",\"(18, 191, 'Compartment_F', 0.005724065924355608)\\n\",\"(19, 3, 'SibSp', 0.0054681943611773805)\\n\",\"(20, 167, 'Embarked_C', 0.004871531561047773)\\n\",\"(21, 16, 'Pclass_2', 0.004788646078719888)\\n\",\"(22, 187, 'Compartment_B', 0.004660307538637477)\\n\",\"(23, 4, 'Parch', 0.004559119100002327)\\n\",\"(24, 197, 'fami_Med', 0.0035981502215434768)\\n\",\"(25, 177, 'Age_a_Young age', 0.003279907401911854)\\n\",\"(26, 196, 'fami_Lit', 0.002863558751300748)\\n\",\"(27, 11, 'Age_mean', 0.0028564613226965884)\\n\",\"(28, 198, 'fami_UNO', 0.0026488415973423825)\\n\",\"(29, 7, 'Boy', 0.002573770877572282)\\n\",\"(30, 169, 'Embarked_S', 0.002407084654558378)\\n\",\"(31, 189, 'Compartment_D', 0.0020575412185624238)\\n\",\"(32, 171, 'ID_Master', 0.0020022347778097522)\\n\",\"(33, 190, 'Compartment_E', 0.0020020828372702484)\\n\",\"(34, 175, 'ID_other', 0.0017686593117670923)\\n\",\"(35, 139, 'Cabin_E24', 0.0016721865643116918)\\n\",\"(36, 188, 'Compartment_C', 0.001560044191467553)\\n\",\"(37, 140, 'Cabin_E25', 0.001369534295042726)\\n\",\"(38, 184, 'Age_a_young adults', 0.0013642714499797204)\\n\",\"(39, 181, 'Age_a_old adults', 0.001358829964247952)\\n\",\"(40, 178, 'Age_a_college', 0.001258610756453498)\\n\",\"(41, 168, 'Embarked_Q', 0.0010208483536657833)\\n\",\"(42, 24, 'Cabin_A23', 0.0009548832341579184)\\n\",\"(43, 6, 'Girl', 0.0009369578438815356)\\n\",\"(44, 183, 'Age_a_transit age', 0.0008934313955692263)\\n\",\"(45, 180, 'Age_a_middle age', 0.0007400691988978353)\\n\",\"(46, 110, 'Cabin_D10 D12', 0.0006405625869389902)\\n\",\"(47, 134, 'Cabin_E10', 0.0005797367791920182)\\n\",\"(48, 70, 'Cabin_C106', 0.0005570740864054201)\\n\",\"(49, 50, 'Cabin_B49', 0.0005441800122752349)\\n\",\"(50, 120, 'Cabin_D33', 0.0005314568903952716)\\n\",\"(51, 87, 'Cabin_C47', 0.0004937323699272608)\\n\",\"(52, 124, 'Cabin_D45', 0.0004379309040329234)\\n\",\"(53, 52, 'Cabin_B50', 0.00042867550977288097)\\n\",\"(54, 90, 'Cabin_C52', 0.00041248494785658436)\\n\",\"(55, 27, 'Cabin_A31', 0.0003965399876959052)\\n\",\"(56, 32, 'Cabin_A6', 0.0003528756556487365)\\n\",\"(57, 170, 'Embarked_nan', 0.00034629723062914335)\\n\",\"(58, 130, 'Cabin_D56', 0.00033987524696366676)\\n\",\"(59, 81, 'Cabin_C22 C26', 0.00032903992109408316)\\n\",\"(60, 66, 'Cabin_B96 B98', 0.0003283002724113807)\\n\",\"(61, 128, 'Cabin_D49', 0.00031004170383952366)\\n\",\"(62, 182, 'Age_a_old old', 0.0003066928588237951)\\n\",\"(63, 179, 'Age_a_high school', 0.0002996252006894922)\\n\",\"(64, 38, 'Cabin_B20', 0.00029675250027884825)\\n\",\"(65, 114, 'Cabin_D19', 0.0002873297923975755)\\n\",\"(66, 119, 'Cabin_D30', 0.00027593102345882417)\\n\",\"(67, 82, 'Cabin_C23 C25 C27', 0.0002719308462750817)\\n\",\"(68, 161, 'Cabin_F33', 0.0002613608012902571)\\n\",\"(69, 156, 'Cabin_E8', 0.00026055322459584004)\\n\",\"(70, 34, 'Cabin_B101', 0.00023747509964213126)\\n\",\"(71, 136, 'Cabin_E12', 0.00023167202814585285)\\n\",\"(72, 77, 'Cabin_C126', 0.00023036189508571488)\\n\",\"(73, 186, 'Compartment_A', 0.0002277558501582475)\\n\",\"(74, 137, 'Cabin_E121', 0.0002234274937390872)\\n\",\"(75, 138, 'Cabin_E17', 0.0002188116223220625)\\n\",\"(76, 121, 'Cabin_D35', 0.0002163209391996872)\\n\",\"(77, 26, 'Cabin_A26', 0.00021300661044517828)\\n\",\"(78, 53, 'Cabin_B51 B53 B55', 0.00019983497014601552)\\n\",\"(79, 153, 'Cabin_E67', 0.00019727953034085206)\\n\",\"(80, 48, 'Cabin_B41', 0.0001851725686736444)\\n\",\"(81, 192, 'Compartment_G', 0.00018472690804841616)\\n\",\"(82, 55, 'Cabin_B58 B60', 0.00017744419417443813)\\n\",\"(83, 80, 'Cabin_C2', 0.0001761666968975247)\\n\",\"(84, 115, 'Cabin_D20', 0.0001756335573156499)\\n\",\"(85, 155, 'Cabin_E77', 0.00017334133182024113)\\n\",\"(86, 135, 'Cabin_E101', 0.0001682425114826054)\\n\",\"(87, 150, 'Cabin_E50', 0.0001636742170788851)\\n\",\"(88, 69, 'Cabin_C104', 0.00015729864780071208)\\n\",\"(89, 157, 'Cabin_F E69', 0.00014538030043177534)\\n\",\"(90, 39, 'Cabin_B22', 0.0001347777001873481)\\n\",\"(91, 117, 'Cabin_D26', 0.00012154048848529863)\\n\",\"(92, 60, 'Cabin_B78', 0.00011870298756321118)\\n\",\"(93, 93, 'Cabin_C65', 0.00011361121335984816)\\n\",\"(94, 79, 'Cabin_C148', 0.00011352466525318947)\\n\",\"(95, 106, 'Cabin_C93', 9.977350911085616e-05)\\n\",\"(96, 84, 'Cabin_C32', 9.856107472619541e-05)\\n\",\"(97, 19, 'Cabin_A10', 9.820924245084211e-05)\\n\",\"(98, 76, 'Cabin_C125', 9.749506946471939e-05)\\n\",\"(99, 105, 'Cabin_C92', 9.060267422970712e-05)\\n\",\"(100, 74, 'Cabin_C123', 8.581706193647484e-05)\\n\",\"(101, 98, 'Cabin_C82', 8.501517232263767e-05)\\n\",\"(102, 59, 'Cabin_B77', 8.340441440413704e-05)\\n\",\"(103, 107, 'Cabin_C95', 7.706648438480269e-05)\\n\",\"(104, 132, 'Cabin_D7', 7.05530947713562e-05)\\n\",\"(105, 30, 'Cabin_A36', 6.87655837921528e-05)\\n\",\"(106, 97, 'Cabin_C78', 6.798047024129906e-05)\\n\",\"(107, 148, 'Cabin_E46', 6.687328284769766e-05)\\n\",\"(108, 94, 'Cabin_C68', 6.0364888796380745e-05)\\n\",\"(109, 86, 'Cabin_C46', 4.935814506538297e-05)\\n\",\"(110, 99, 'Cabin_C83', 4.33635955724929e-05)\\n\",\"(111, 23, 'Cabin_A20', 4.108609595194832e-05)\\n\",\"(112, 29, 'Cabin_A34', 3.8850831954786254e-05)\\n\",\"(113, 104, 'Cabin_C91', 3.732308375810079e-05)\\n\",\"(114, 109, 'Cabin_D', 3.4343116437445866e-05)\\n\",\"(115, 100, 'Cabin_C85', 3.43063865964235e-05)\\n\",\"(116, 131, 'Cabin_D6', 3.1953704878087557e-05)\\n\",\"(117, 72, 'Cabin_C111', 3.0492117746419594e-05)\\n\",\"(118, 73, 'Cabin_C118', 2.5324580404228615e-05)\\n\",\"(119, 54, 'Cabin_B57 B59 B63 B66', 2.5139337098237217e-05)\\n\",\"(120, 96, 'Cabin_C70', 2.4914946321204736e-05)\\n\",\"(121, 75, 'Cabin_C124', 2.4399469459703213e-05)\\n\",\"(122, 47, 'Cabin_B4', 2.191011464862402e-05)\\n\",\"(123, 113, 'Cabin_D17', 2.0870983430051052e-05)\\n\",\"(124, 31, 'Cabin_A5', 2.0056903690624054e-05)\\n\",\"(125, 64, 'Cabin_B86', 1.7911594736945437e-05)\\n\",\"(126, 25, 'Cabin_A24', 1.6475953574291395e-05)\\n\",\"(127, 101, 'Cabin_C86', 1.1764702046036839e-05)\\n\",\"(128, 163, 'Cabin_F4', 1.1636459391599981e-05)\\n\",\"(129, 145, 'Cabin_E38', 1.1109275372093283e-05)\\n\",\"(130, 78, 'Cabin_C128', 4.190263652567675e-06)\\n\",\"(131, 141, 'Cabin_E31', 0.0)\\n\",\"(132, 28, 'Cabin_A32', 0.0)\\n\",\"(133, 142, 'Cabin_E33', 0.0)\\n\",\"(134, 143, 'Cabin_E34', 0.0)\\n\",\"(135, 144, 'Cabin_E36', 0.0)\\n\",\"(136, 133, 'Cabin_D9', 0.0)\\n\",\"(137, 33, 'Cabin_A7', 0.0)\\n\",\"(138, 22, 'Cabin_A19', 0.0)\\n\",\"(139, 21, 'Cabin_A16', 0.0)\\n\",\"(140, 35, 'Cabin_B102', 0.0)\\n\",\"(141, 20, 'Cabin_A14', 0.0)\\n\",\"(142, 89, 'Cabin_C50', 0.0)\\n\",\"(143, 18, 'Pclass_nan', 0.0)\\n\",\"(144, 160, 'Cabin_F2', 0.0)\\n\",\"(145, 194, 'Compartment_nan', 0.0)\\n\",\"(146, 193, 'Compartment_T', 0.0)\\n\",\"(147, 185, 'Age_a_nan', 0.0)\\n\",\"(148, 176, 'ID_nan', 0.0)\\n\",\"(149, 165, 'Cabin_T', 0.0)\\n\",\"(150, 164, 'Cabin_G6', 0.0)\\n\",\"(151, 162, 'Cabin_F38', 0.0)\\n\",\"(152, 159, 'Cabin_F G73', 0.0)\\n\",\"(153, 146, 'Cabin_E40', 0.0)\\n\",\"(154, 158, 'Cabin_F G63', 0.0)\\n\",\"(155, 154, 'Cabin_E68', 0.0)\\n\",\"(156, 152, 'Cabin_E63', 0.0)\\n\",\"(157, 151, 'Cabin_E58', 0.0)\\n\",\"(158, 37, 'Cabin_B19', 0.0)\\n\",\"(159, 149, 'Cabin_E49', 0.0)\\n\",\"(160, 147, 'Cabin_E44', 0.0)\\n\",\"(161, 36, 'Cabin_B18', 0.0)\\n\",\"(162, 44, 'Cabin_B37', 0.0)\\n\",\"(163, 129, 'Cabin_D50', 0.0)\\n\",\"(164, 71, 'Cabin_C110', 0.0)\\n\",\"(165, 62, 'Cabin_B80', 0.0)\\n\",\"(166, 63, 'Cabin_B82 B84', 0.0)\\n\",\"(167, 65, 'Cabin_B94', 0.0)\\n\",\"(168, 112, 'Cabin_D15', 0.0)\\n\",\"(169, 67, 'Cabin_C101', 0.0)\\n\",\"(170, 68, 'Cabin_C103', 0.0)\\n\",\"(171, 111, 'Cabin_D11', 0.0)\\n\",\"(172, 108, 'Cabin_C99', 0.0)\\n\",\"(173, 127, 'Cabin_D48', 0.0)\\n\",\"(174, 103, 'Cabin_C90', 0.0)\\n\",\"(175, 102, 'Cabin_C87', 0.0)\\n\",\"(176, 83, 'Cabin_C30', 0.0)\\n\",\"(177, 95, 'Cabin_C7', 0.0)\\n\",\"(178, 85, 'Cabin_C45', 0.0)\\n\",\"(179, 92, 'Cabin_C62 C64', 0.0)\\n\",\"(180, 91, 'Cabin_C54', 0.0)\\n\",\"(181, 61, 'Cabin_B79', 0.0)\\n\",\"(182, 116, 'Cabin_D21', 0.0)\\n\",\"(183, 58, 'Cabin_B73', 0.0)\\n\",\"(184, 57, 'Cabin_B71', 0.0)\\n\",\"(185, 40, 'Cabin_B28', 0.0)\\n\",\"(186, 41, 'Cabin_B3', 0.0)\\n\",\"(187, 42, 'Cabin_B30', 0.0)\\n\",\"(188, 43, 'Cabin_B35', 0.0)\\n\",\"(189, 88, 'Cabin_C49', 0.0)\\n\",\"(190, 45, 'Cabin_B38', 0.0)\\n\",\"(191, 46, 'Cabin_B39', 0.0)\\n\",\"(192, 126, 'Cabin_D47', 0.0)\\n\",\"(193, 49, 'Cabin_B42', 0.0)\\n\",\"(194, 125, 'Cabin_D46', 0.0)\\n\",\"(195, 51, 'Cabin_B5', 0.0)\\n\",\"(196, 123, 'Cabin_D37', 0.0)\\n\",\"(197, 122, 'Cabin_D36', 0.0)\\n\",\"(198, 118, 'Cabin_D28', 0.0)\\n\",\"(199, 56, 'Cabin_B69', 0.0)\\n\",\"(200, 199, 'fami_nan', 0.0)\\n\"]}]},{\"cell_type\":\"code\",\"source\":[\"\\n\",\"ms = SelectFromModel(rf, prefit = True) #finding best feature from experience\\n\",\"\\n\"],\"metadata\":{\"id\":\"ZlDamajLGMQh\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"new = ms.transform(X_train)\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"xj-Fj1P54Dm7\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189752413,\"user_tz\":420,\"elapsed\":5,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"35205e66-0167-4750-b3f4-7becb3f3a054\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stderr\",\"text\":[\"/usr/local/lib/python3.7/dist-packages/sklearn/base.py:444: UserWarning: X has feature names, but SelectFromModel was fitted without feature names\\n\",\" f\\\"X has feature names, but {self.__class__.__name__} was fitted without\\\"\\n\"]}]},{\"cell_type\":\"code\",\"source\":[\"val = ind[0: new.shape[1]]\\n\",\"best_features = X_train.columns[val]\\n\"],\"metadata\":{\"id\":\"5dOAq3yJGSAj\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"mtmYMsw9fOqQ\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"markdown\",\"source\":[\"## Code to test Classifier\"],\"metadata\":{\"id\":\"otulVxssILET\"}},{\"cell_type\":\"code\",\"source\":[\"#t = [\\\"ID\\\", \\\"SibSp\\\",\\\"Parch\\\", \\\"Sex\\\", \\\"Pclass\\\", \\\"Embarked\\\", \\\"Fare\\\", \\\"Compartment\\\", \\\"Age\\\", \\\"Age_a\\\"]\\n\",\"t = best_features.drop([\\\"Survived\\\"])\\n\",\"#t = [\\\"Sex\\\", \\\"ID_Mr\\\", \\\"Ticket_mean\\\"]\\n\",\"#t = [\\\"Sex\\\", \\\"ID_Mr\\\", \\\"Fare\\\"]\\n\",\"#t = t.drop([\\\"Cabin_nan\\\"])\\n\",\"#t = t.drop([\\\"Cabin_nan\\\"])\\n\",\"#t = t.drop([\\\"Age\\\"])\\n\",\"#t = t.drop([\\\"Compartment_Num\\\"])\\n\",\"#t = t.drop([\\\"p*fare\\\"])\\n\",\"#t = t.drop([\\\"PassengerId\\\"])\\n\",\"#t = t.drop([\\\"ID_Mr\\\"])\\n\",\"#t = [\\\"Sex\\\"]\\n\",\"#t = t.drop([\\\"fami_Large\\\"])\\n\",\"#t = t.drop([\\\"fam\\\"])\\n\",\"#t = t.drop([\\\"Age\\\"])\\n\",\"#t = t.drop([\\\"Compartment_F\\\"])\\n\",\"#t = t.drop([\\\"SibSp\\\"])\\n\",\"#t = t.drop([\\\"Compartment_n\\\"])\\n\",\"#t = t.drop([\\\"Compartment_n\\\"])\\n\",\"#t = t.drop([\\\"Age\\\"])\\n\",\"#t = t.drop([\\\"Compartment_F\\\"])\\n\",\"#t = t.drop([\\\"SibSp\\\"])\\n\",\"#from sklearn.datasets import load_iris\\n\",\"#from sklearn.model_selection import cross_val_score\\n\",\"#from sklearn.tree import DecisionTreeClassifier\\n\",\" #\\\"Compartment\\\", \\\"Age_a\\\" #df_tests = pd.get_dummies(df_test.drop(columns = [\\\"Name\\\"], axis = 1), dummy_na = True)\\n\",\"#\\\"Age_a\\\", \\\"Fare\\\"\\n\",\"t = [\\\"Sex\\\", \\\"ID_Mr\\\", \\\"Ticket_mean\\\", \\\"pred\\\"]\\n\",\"#X_train = df_train[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"Y_train = df_trains[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"#X_test = df_test[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"Y_test = df[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"X_train = df_trains[t] #[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex\\\", \\\"ID\\\", \\\"Age_a\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\n\",\"X_test = df_tests[t]\\n\",\"est = 100\\n\",\"leaf = 18\\n\",\"spl = 7\\n\",\"dt = MLPClassifier(max_iter = 1000, solver= \\\"adam\\\", activation = \\\"logistic\\\", random_state = 43) #tree.DecisionTreeClassifier() \\n\",\"dt = RandomForestClassifier(n_estimators = est, criterion = 'gini', max_features = 'sqrt', min_samples_split = spl,\\n\",\"min_weight_fraction_leaf = 0, max_leaf_nodes = leaf)\\n\",\"dt.fit(X_train, Y_train) \\n\",\"test = dt.predict(X_test) \\n\",\"Y_pred2 = dt.predict(X_train) \\n\",\"#acc = round(dt.score(Y_train, Y_pred2) * 100, 2)\\n\",\"accuracy_score(Y_train, Y_pred2)\\n\",\"#0.9315375982042648\\n\",\"#0.9876543209876543\\n\",\"#0.9158249158249159\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"FoflJLCJcBui\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189752666,\"user_tz\":420,\"elapsed\":256,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"71d09996-03e2-4e49-c941-e38a78255d84\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\"0.8978675645342312\"]},\"metadata\":{},\"execution_count\":343}]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"L_pJG09L_m8I\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"19BB_D1GBiXv\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"\\n\",\"df_trains[best_features].corr()\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":709},\"id\":\"C_ODHd2ZO4_a\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189752902,\"user_tz\":420,\"elapsed\":237,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"151dc4c4-eafb-4cda-a80a-707f16c4b047\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" Survived pred Ticket_mean ID_Mr Female \\\\\\n\",\"Survived 1.000000 0.793451 0.714892 -0.547896 0.543351 \\n\",\"pred 0.793451 1.000000 0.846843 -0.731236 0.739249 \\n\",\"Ticket_mean 0.714892 0.846843 1.000000 -0.587880 0.584748 \\n\",\"ID_Mr -0.547896 -0.731236 -0.587880 1.000000 -0.861366 \\n\",\"Female 0.543351 0.739249 0.584748 -0.861366 1.000000 \\n\",\"Num_of_Ticket 0.218735 0.316139 0.344902 -0.605872 0.478069 \\n\",\"Sex 0.543351 0.739249 0.584748 -0.861366 1.000000 \\n\",\"p*fare 0.183627 0.160361 0.282302 -0.223248 0.186584 \\n\",\"Fare 0.257307 0.220963 0.359021 -0.186295 0.182333 \\n\",\"Pclass_3 -0.322308 -0.292536 -0.385084 0.163288 -0.137143 \\n\",\"ID_Miss 0.332795 0.463291 0.359278 -0.595676 0.691548 \\n\",\"Cabin_nan -0.316912 -0.234750 -0.312223 0.144270 -0.140391 \\n\",\"Pclass_1 0.285904 0.181364 0.282871 -0.103929 0.098013 \\n\",\"ID_Mrs 0.339040 0.451076 0.363739 -0.471684 0.547600 \\n\",\"fam 0.016639 0.066446 0.110719 -0.335233 0.200988 \\n\",\"fami_Large -0.125147 -0.102624 -0.119199 -0.221115 0.102954 \\n\",\"Age 0.009723 -0.040102 0.034474 0.075057 -0.025669 \\n\",\"Compartment_F -0.259122 -0.198290 -0.324127 0.267521 -0.208006 \\n\",\"SibSp -0.035322 -0.000622 0.045270 -0.249045 0.114631 \\n\",\"\\n\",\" Num_of_Ticket Sex p*fare Fare Pclass_3 \\\\\\n\",\"Survived 0.218735 0.543351 0.183627 0.257307 -0.322308 \\n\",\"pred 0.316139 0.739249 0.160361 0.220963 -0.292536 \\n\",\"Ticket_mean 0.344902 0.584748 0.282302 0.359021 -0.385084 \\n\",\"ID_Mr -0.605872 -0.861366 -0.223248 -0.186295 0.163288 \\n\",\"Female 0.478069 1.000000 0.186584 0.182333 -0.137143 \\n\",\"Num_of_Ticket 1.000000 0.478069 0.481971 0.296949 -0.008114 \\n\",\"Sex 0.478069 1.000000 0.186584 0.182333 -0.137143 \\n\",\"p*fare 0.481971 0.186584 1.000000 0.909188 -0.226034 \\n\",\"Fare 0.296949 0.182333 0.909188 1.000000 -0.413333 \\n\",\"Pclass_3 -0.008114 -0.137143 -0.226034 -0.413333 1.000000 \\n\",\"ID_Miss 0.356579 0.691548 0.130262 0.122266 0.003366 \\n\",\"Cabin_nan -0.087708 -0.140391 -0.289553 -0.482075 0.539291 \\n\",\"Pclass_1 0.055031 0.098013 0.357869 0.591711 -0.626738 \\n\",\"ID_Mrs 0.235560 0.547600 0.103739 0.102627 -0.174671 \\n\",\"fam 0.784533 0.200988 0.486379 0.217138 0.071142 \\n\",\"fami_Large 0.704380 0.102954 0.380857 0.143636 0.175890 \\n\",\"Age -0.149557 -0.025669 0.015772 0.135422 -0.354395 \\n\",\"Compartment_F -0.434136 -0.208006 -0.535405 -0.508947 0.556720 \\n\",\"SibSp 0.641970 0.114631 0.425247 0.159651 0.092548 \\n\",\"\\n\",\" ID_Miss Cabin_nan Pclass_1 ID_Mrs fam fami_Large \\\\\\n\",\"Survived 0.332795 -0.316912 0.285904 0.339040 0.016639 -0.125147 \\n\",\"pred 0.463291 -0.234750 0.181364 0.451076 0.066446 -0.102624 \\n\",\"Ticket_mean 0.359278 -0.312223 0.282871 0.363739 0.110719 -0.119199 \\n\",\"ID_Mr -0.595676 0.144270 -0.103929 -0.471684 -0.335233 -0.221115 \\n\",\"Female 0.691548 -0.140391 0.098013 0.547600 0.200988 0.102954 \\n\",\"Num_of_Ticket 0.356579 -0.087708 0.055031 0.235560 0.784533 0.704380 \\n\",\"Sex 0.691548 -0.140391 0.098013 0.547600 0.200988 0.102954 \\n\",\"p*fare 0.130262 -0.289553 0.357869 0.103739 0.486379 0.380857 \\n\",\"Fare 0.122266 -0.482075 0.591711 0.102627 0.217138 0.143636 \\n\",\"Pclass_3 0.003366 0.539291 -0.626738 -0.174671 0.071142 0.175890 \\n\",\"ID_Miss 1.000000 -0.051946 0.028427 -0.206082 0.109271 0.111105 \\n\",\"Cabin_nan -0.051946 1.000000 -0.788773 -0.118300 0.009175 0.086035 \\n\",\"Pclass_1 0.028427 -0.788773 1.000000 0.088207 -0.046114 -0.092945 \\n\",\"ID_Mrs -0.206082 -0.118300 0.088207 1.000000 0.154164 0.016535 \\n\",\"fam 0.109271 0.009175 -0.046114 0.154164 1.000000 0.814901 \\n\",\"fami_Large 0.111105 0.086035 -0.092945 0.016535 0.814901 1.000000 \\n\",\"Age -0.179504 -0.269711 0.294561 0.167524 -0.152023 -0.142903 \\n\",\"Compartment_F -0.054046 0.549016 -0.632056 -0.217807 -0.408523 -0.292880 \\n\",\"SibSp 0.084945 0.040460 -0.054582 0.060475 0.890712 0.730691 \\n\",\"\\n\",\" Age Compartment_F SibSp \\n\",\"Survived 0.009723 -0.259122 -0.035322 \\n\",\"pred -0.040102 -0.198290 -0.000622 \\n\",\"Ticket_mean 0.034474 -0.324127 0.045270 \\n\",\"ID_Mr 0.075057 0.267521 -0.249045 \\n\",\"Female -0.025669 -0.208006 0.114631 \\n\",\"Num_of_Ticket -0.149557 -0.434136 0.641970 \\n\",\"Sex -0.025669 -0.208006 0.114631 \\n\",\"p*fare 0.015772 -0.535405 0.425247 \\n\",\"Fare 0.135422 -0.508947 0.159651 \\n\",\"Pclass_3 -0.354395 0.556720 0.092548 \\n\",\"ID_Miss -0.179504 -0.054046 0.084945 \\n\",\"Cabin_nan -0.269711 0.549016 0.040460 \\n\",\"Pclass_1 0.294561 -0.632056 -0.054582 \\n\",\"ID_Mrs 0.167524 -0.217807 0.060475 \\n\",\"fam -0.152023 -0.408523 0.890712 \\n\",\"fami_Large -0.142903 -0.292880 0.730691 \\n\",\"Age 1.000000 -0.183839 -0.185670 \\n\",\"Compartment_F -0.183839 1.000000 -0.333756 \\n\",\"SibSp -0.185670 -0.333756 1.000000 \"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" pred \\n\",\" Ticket_mean \\n\",\" ID_Mr \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Sex \\n\",\" p*fare \\n\",\" Fare \\n\",\" Pclass_3 \\n\",\" ID_Miss \\n\",\" Cabin_nan \\n\",\" Pclass_1 \\n\",\" ID_Mrs \\n\",\" fam \\n\",\" fami_Large \\n\",\" Age \\n\",\" Compartment_F \\n\",\" SibSp \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" Survived \\n\",\" 1.000000 \\n\",\" 0.793451 \\n\",\" 0.714892 \\n\",\" -0.547896 \\n\",\" 0.543351 \\n\",\" 0.218735 \\n\",\" 0.543351 \\n\",\" 0.183627 \\n\",\" 0.257307 \\n\",\" -0.322308 \\n\",\" 0.332795 \\n\",\" -0.316912 \\n\",\" 0.285904 \\n\",\" 0.339040 \\n\",\" 0.016639 \\n\",\" -0.125147 \\n\",\" 0.009723 \\n\",\" -0.259122 \\n\",\" -0.035322 \\n\",\" \\n\",\" \\n\",\" pred \\n\",\" 0.793451 \\n\",\" 1.000000 \\n\",\" 0.846843 \\n\",\" -0.731236 \\n\",\" 0.739249 \\n\",\" 0.316139 \\n\",\" 0.739249 \\n\",\" 0.160361 \\n\",\" 0.220963 \\n\",\" -0.292536 \\n\",\" 0.463291 \\n\",\" -0.234750 \\n\",\" 0.181364 \\n\",\" 0.451076 \\n\",\" 0.066446 \\n\",\" -0.102624 \\n\",\" -0.040102 \\n\",\" -0.198290 \\n\",\" -0.000622 \\n\",\" \\n\",\" \\n\",\" Ticket_mean \\n\",\" 0.714892 \\n\",\" 0.846843 \\n\",\" 1.000000 \\n\",\" -0.587880 \\n\",\" 0.584748 \\n\",\" 0.344902 \\n\",\" 0.584748 \\n\",\" 0.282302 \\n\",\" 0.359021 \\n\",\" -0.385084 \\n\",\" 0.359278 \\n\",\" -0.312223 \\n\",\" 0.282871 \\n\",\" 0.363739 \\n\",\" 0.110719 \\n\",\" -0.119199 \\n\",\" 0.034474 \\n\",\" -0.324127 \\n\",\" 0.045270 \\n\",\" \\n\",\" \\n\",\" ID_Mr \\n\",\" -0.547896 \\n\",\" -0.731236 \\n\",\" -0.587880 \\n\",\" 1.000000 \\n\",\" -0.861366 \\n\",\" -0.605872 \\n\",\" -0.861366 \\n\",\" -0.223248 \\n\",\" -0.186295 \\n\",\" 0.163288 \\n\",\" -0.595676 \\n\",\" 0.144270 \\n\",\" -0.103929 \\n\",\" -0.471684 \\n\",\" -0.335233 \\n\",\" -0.221115 \\n\",\" 0.075057 \\n\",\" 0.267521 \\n\",\" -0.249045 \\n\",\" \\n\",\" \\n\",\" Female \\n\",\" 0.543351 \\n\",\" 0.739249 \\n\",\" 0.584748 \\n\",\" -0.861366 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" 0.186584 \\n\",\" 0.182333 \\n\",\" -0.137143 \\n\",\" 0.691548 \\n\",\" -0.140391 \\n\",\" 0.098013 \\n\",\" 0.547600 \\n\",\" 0.200988 \\n\",\" 0.102954 \\n\",\" -0.025669 \\n\",\" -0.208006 \\n\",\" 0.114631 \\n\",\" \\n\",\" \\n\",\" Num_of_Ticket \\n\",\" 0.218735 \\n\",\" 0.316139 \\n\",\" 0.344902 \\n\",\" -0.605872 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 0.481971 \\n\",\" 0.296949 \\n\",\" -0.008114 \\n\",\" 0.356579 \\n\",\" -0.087708 \\n\",\" 0.055031 \\n\",\" 0.235560 \\n\",\" 0.784533 \\n\",\" 0.704380 \\n\",\" -0.149557 \\n\",\" -0.434136 \\n\",\" 0.641970 \\n\",\" \\n\",\" \\n\",\" Sex \\n\",\" 0.543351 \\n\",\" 0.739249 \\n\",\" 0.584748 \\n\",\" -0.861366 \\n\",\" 1.000000 \\n\",\" 0.478069 \\n\",\" 1.000000 \\n\",\" 0.186584 \\n\",\" 0.182333 \\n\",\" -0.137143 \\n\",\" 0.691548 \\n\",\" -0.140391 \\n\",\" 0.098013 \\n\",\" 0.547600 \\n\",\" 0.200988 \\n\",\" 0.102954 \\n\",\" -0.025669 \\n\",\" -0.208006 \\n\",\" 0.114631 \\n\",\" \\n\",\" \\n\",\" p*fare \\n\",\" 0.183627 \\n\",\" 0.160361 \\n\",\" 0.282302 \\n\",\" -0.223248 \\n\",\" 0.186584 \\n\",\" 0.481971 \\n\",\" 0.186584 \\n\",\" 1.000000 \\n\",\" 0.909188 \\n\",\" -0.226034 \\n\",\" 0.130262 \\n\",\" -0.289553 \\n\",\" 0.357869 \\n\",\" 0.103739 \\n\",\" 0.486379 \\n\",\" 0.380857 \\n\",\" 0.015772 \\n\",\" -0.535405 \\n\",\" 0.425247 \\n\",\" \\n\",\" \\n\",\" Fare \\n\",\" 0.257307 \\n\",\" 0.220963 \\n\",\" 0.359021 \\n\",\" -0.186295 \\n\",\" 0.182333 \\n\",\" 0.296949 \\n\",\" 0.182333 \\n\",\" 0.909188 \\n\",\" 1.000000 \\n\",\" -0.413333 \\n\",\" 0.122266 \\n\",\" -0.482075 \\n\",\" 0.591711 \\n\",\" 0.102627 \\n\",\" 0.217138 \\n\",\" 0.143636 \\n\",\" 0.135422 \\n\",\" -0.508947 \\n\",\" 0.159651 \\n\",\" \\n\",\" \\n\",\" Pclass_3 \\n\",\" -0.322308 \\n\",\" -0.292536 \\n\",\" -0.385084 \\n\",\" 0.163288 \\n\",\" -0.137143 \\n\",\" -0.008114 \\n\",\" -0.137143 \\n\",\" -0.226034 \\n\",\" -0.413333 \\n\",\" 1.000000 \\n\",\" 0.003366 \\n\",\" 0.539291 \\n\",\" -0.626738 \\n\",\" -0.174671 \\n\",\" 0.071142 \\n\",\" 0.175890 \\n\",\" -0.354395 \\n\",\" 0.556720 \\n\",\" 0.092548 \\n\",\" \\n\",\" \\n\",\" ID_Miss \\n\",\" 0.332795 \\n\",\" 0.463291 \\n\",\" 0.359278 \\n\",\" -0.595676 \\n\",\" 0.691548 \\n\",\" 0.356579 \\n\",\" 0.691548 \\n\",\" 0.130262 \\n\",\" 0.122266 \\n\",\" 0.003366 \\n\",\" 1.000000 \\n\",\" -0.051946 \\n\",\" 0.028427 \\n\",\" -0.206082 \\n\",\" 0.109271 \\n\",\" 0.111105 \\n\",\" -0.179504 \\n\",\" -0.054046 \\n\",\" 0.084945 \\n\",\" \\n\",\" \\n\",\" Cabin_nan \\n\",\" -0.316912 \\n\",\" -0.234750 \\n\",\" -0.312223 \\n\",\" 0.144270 \\n\",\" -0.140391 \\n\",\" -0.087708 \\n\",\" -0.140391 \\n\",\" -0.289553 \\n\",\" -0.482075 \\n\",\" 0.539291 \\n\",\" -0.051946 \\n\",\" 1.000000 \\n\",\" -0.788773 \\n\",\" -0.118300 \\n\",\" 0.009175 \\n\",\" 0.086035 \\n\",\" -0.269711 \\n\",\" 0.549016 \\n\",\" 0.040460 \\n\",\" \\n\",\" \\n\",\" Pclass_1 \\n\",\" 0.285904 \\n\",\" 0.181364 \\n\",\" 0.282871 \\n\",\" -0.103929 \\n\",\" 0.098013 \\n\",\" 0.055031 \\n\",\" 0.098013 \\n\",\" 0.357869 \\n\",\" 0.591711 \\n\",\" -0.626738 \\n\",\" 0.028427 \\n\",\" -0.788773 \\n\",\" 1.000000 \\n\",\" 0.088207 \\n\",\" -0.046114 \\n\",\" -0.092945 \\n\",\" 0.294561 \\n\",\" -0.632056 \\n\",\" -0.054582 \\n\",\" \\n\",\" \\n\",\" ID_Mrs \\n\",\" 0.339040 \\n\",\" 0.451076 \\n\",\" 0.363739 \\n\",\" -0.471684 \\n\",\" 0.547600 \\n\",\" 0.235560 \\n\",\" 0.547600 \\n\",\" 0.103739 \\n\",\" 0.102627 \\n\",\" -0.174671 \\n\",\" -0.206082 \\n\",\" -0.118300 \\n\",\" 0.088207 \\n\",\" 1.000000 \\n\",\" 0.154164 \\n\",\" 0.016535 \\n\",\" 0.167524 \\n\",\" -0.217807 \\n\",\" 0.060475 \\n\",\" \\n\",\" \\n\",\" fam \\n\",\" 0.016639 \\n\",\" 0.066446 \\n\",\" 0.110719 \\n\",\" -0.335233 \\n\",\" 0.200988 \\n\",\" 0.784533 \\n\",\" 0.200988 \\n\",\" 0.486379 \\n\",\" 0.217138 \\n\",\" 0.071142 \\n\",\" 0.109271 \\n\",\" 0.009175 \\n\",\" -0.046114 \\n\",\" 0.154164 \\n\",\" 1.000000 \\n\",\" 0.814901 \\n\",\" -0.152023 \\n\",\" -0.408523 \\n\",\" 0.890712 \\n\",\" \\n\",\" \\n\",\" fami_Large \\n\",\" -0.125147 \\n\",\" -0.102624 \\n\",\" -0.119199 \\n\",\" -0.221115 \\n\",\" 0.102954 \\n\",\" 0.704380 \\n\",\" 0.102954 \\n\",\" 0.380857 \\n\",\" 0.143636 \\n\",\" 0.175890 \\n\",\" 0.111105 \\n\",\" 0.086035 \\n\",\" -0.092945 \\n\",\" 0.016535 \\n\",\" 0.814901 \\n\",\" 1.000000 \\n\",\" -0.142903 \\n\",\" -0.292880 \\n\",\" 0.730691 \\n\",\" \\n\",\" \\n\",\" Age \\n\",\" 0.009723 \\n\",\" -0.040102 \\n\",\" 0.034474 \\n\",\" 0.075057 \\n\",\" -0.025669 \\n\",\" -0.149557 \\n\",\" -0.025669 \\n\",\" 0.015772 \\n\",\" 0.135422 \\n\",\" -0.354395 \\n\",\" -0.179504 \\n\",\" -0.269711 \\n\",\" 0.294561 \\n\",\" 0.167524 \\n\",\" -0.152023 \\n\",\" -0.142903 \\n\",\" 1.000000 \\n\",\" -0.183839 \\n\",\" -0.185670 \\n\",\" \\n\",\" \\n\",\" Compartment_F \\n\",\" -0.259122 \\n\",\" -0.198290 \\n\",\" -0.324127 \\n\",\" 0.267521 \\n\",\" -0.208006 \\n\",\" -0.434136 \\n\",\" -0.208006 \\n\",\" -0.535405 \\n\",\" -0.508947 \\n\",\" 0.556720 \\n\",\" -0.054046 \\n\",\" 0.549016 \\n\",\" -0.632056 \\n\",\" -0.217807 \\n\",\" -0.408523 \\n\",\" -0.292880 \\n\",\" -0.183839 \\n\",\" 1.000000 \\n\",\" -0.333756 \\n\",\" \\n\",\" \\n\",\" SibSp \\n\",\" -0.035322 \\n\",\" -0.000622 \\n\",\" 0.045270 \\n\",\" -0.249045 \\n\",\" 0.114631 \\n\",\" 0.641970 \\n\",\" 0.114631 \\n\",\" 0.425247 \\n\",\" 0.159651 \\n\",\" 0.092548 \\n\",\" 0.084945 \\n\",\" 0.040460 \\n\",\" -0.054582 \\n\",\" 0.060475 \\n\",\" 0.890712 \\n\",\" 0.730691 \\n\",\" -0.185670 \\n\",\" -0.333756 \\n\",\" 1.000000 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":344}]},{\"cell_type\":\"code\",\"source\":[\"t = best_features.drop([\\\"Survived\\\"])\\n\",\"#t = [\\\"Sex\\\", \\\"ID_Mr\\\", \\\"Ticket_mean\\\"]\\n\",\"t = t.drop([\\\"fami_Large\\\"])\\n\",\"t = t.drop([\\\"fam\\\"])\\n\",\"t = t.drop([\\\"Age\\\"])\\n\",\"t = t.drop([\\\"Compartment_F\\\"])\\n\",\"t = t.drop([\\\"SibSp\\\"])\\n\",\"\\n\",\"t= \\n\",\"#t = t.drop([\\\"p*fare\\\"])\\n\",\"#t = t.drop([\\\"Compartment_B\\\"])\\n\",\"X_train, X_test, Y_train, Y_test = train_test_split(df_trains[t], df_trains[\\\"Survived\\\"], test_size=0.3, random_state= 43)\\n\",\"clf = MLPClassifier(max_iter = 1000,solver= \\\"adam\\\", activation = \\\"logistic\\\", random_state = 43)\\n\",\"clf = tree.DecisionTreeClassifier( random_state = 43)\\n\",\"est = 200\\n\",\"clf = RandomForestClassifier(n_estimators = est, criterion = 'gini', max_features = 'sqrt', min_samples_split = spl,\\n\",\"min_weight_fraction_leaf = 0, max_leaf_nodes = leaf)\\n\",\"#clf = RandomForestClassifier(n_estimators = est, criterion = 'gini', max_features = 'sqrt', min_samples_split = spl,\\n\",\"#min_weight_fraction_leaf = 0, max_leaf_nodes = leaf)\\n\",\"#clf = clf#.fit(X_train, Y_train) \\n\",\"#X_train = df_trains[t] #[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex\\\", \\\"ID\\\", \\\"Age_a\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\n\",\"#X_test = df_tests[t]\\n\",\"\\n\",\"clf.fit(X_train, Y_train) \\n\",\"test2 = clf.predict(X_test) \\n\",\"Y_pred2 = clf.predict(X_train) \\n\",\"print(accuracy_score(Y_train, Y_pred2))\\n\",\"print(accuracy_score(Y_test, test2))\\n\",\"#test2 / len(Y_test)\\n\",\"#0.9373996789727127\\n\",\"#0.8731343283582089\"],\"metadata\":{\"id\":\"5sNU8CyFIUfM\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189808270,\"user_tz\":420,\"elapsed\":846,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"outputId\":\"449a6afb-6779-4052-a96d-f13c35509168\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stdout\",\"text\":[\"0.9357945425361156\\n\",\"0.8768656716417911\\n\"]}]},{\"cell_type\":\"code\",\"source\":[\"print(t)\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\"},\"id\":\"KD3CVwAxDGoM\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189837390,\"user_tz\":420,\"elapsed\":4,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"17a2963a-e776-4048-8ced-7d9ca064c531\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"stream\",\"name\":\"stdout\",\"text\":[\"Index(['pred', 'Ticket_mean', 'ID_Mr', 'Female', 'Num_of_Ticket', 'Sex',\\n\",\" 'p*fare', 'Fare', 'Pclass_3', 'ID_Miss', 'Cabin_nan', 'Pclass_1',\\n\",\" 'ID_Mrs'],\\n\",\" dtype='object')\\n\"]}]},{\"cell_type\":\"code\",\"source\":[\"X_train\"],\"metadata\":{\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":468},\"id\":\"REQmrMvUBw3i\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189882175,\"user_tz\":420,\"elapsed\":160,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"outputId\":\"c67fb986-ab70-44bb-bee6-504425ce60ad\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" pred Ticket_mean ID_Mr Female Num_of_Ticket Sex p*fare Fare \\\\\\n\",\"597 0 0 1 0 0 0 0.0000 0.0000 \\n\",\"476 0 1 1 0 1 0 42.0000 21.0000 \\n\",\"102 0 0 1 0 0 0 77.2875 77.2875 \\n\",\"361 0 0 1 0 0 0 55.4416 27.7208 \\n\",\"230 1 1 0 1 1 1 83.4750 83.4750 \\n\",\".. ... ... ... ... ... ... ... ... \\n\",\"277 0 0 1 0 0 0 0.0000 0.0000 \\n\",\"817 0 1 1 0 1 0 74.0084 37.0042 \\n\",\"255 1 1 0 1 1 1 45.7374 15.2458 \\n\",\"320 0 0 1 0 0 0 21.7500 7.2500 \\n\",\"836 0 0 1 0 0 0 25.9875 8.6625 \\n\",\"\\n\",\" Pclass_3 ID_Miss Cabin_nan Pclass_1 ID_Mrs \\n\",\"597 1 0 1 0 0 \\n\",\"476 0 0 1 0 0 \\n\",\"102 0 0 0 1 0 \\n\",\"361 0 0 1 0 0 \\n\",\"230 0 0 0 1 1 \\n\",\".. ... ... ... ... ... \\n\",\"277 0 0 1 0 0 \\n\",\"817 0 0 1 0 0 \\n\",\"255 1 0 1 0 1 \\n\",\"320 1 0 1 0 0 \\n\",\"836 1 0 1 0 0 \\n\",\"\\n\",\"[623 rows x 13 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" pred \\n\",\" Ticket_mean \\n\",\" ID_Mr \\n\",\" Female \\n\",\" Num_of_Ticket \\n\",\" Sex \\n\",\" p*fare \\n\",\" Fare \\n\",\" Pclass_3 \\n\",\" ID_Miss \\n\",\" Cabin_nan \\n\",\" Pclass_1 \\n\",\" ID_Mrs \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 597 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0.0000 \\n\",\" 0.0000 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 476 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 42.0000 \\n\",\" 21.0000 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 102 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 77.2875 \\n\",\" 77.2875 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 361 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 55.4416 \\n\",\" 27.7208 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 230 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 83.4750 \\n\",\" 83.4750 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" 277 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0.0000 \\n\",\" 0.0000 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 817 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 74.0084 \\n\",\" 37.0042 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 255 \\n\",\" 1 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 1 \\n\",\" 1 \\n\",\" 45.7374 \\n\",\" 15.2458 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" 320 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 21.7500 \\n\",\" 7.2500 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 836 \\n\",\" 0 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" 0 \\n\",\" 25.9875 \\n\",\" 8.6625 \\n\",\" 1 \\n\",\" 0 \\n\",\" 1 \\n\",\" 0 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
623 rows × 13 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":354}]},{\"cell_type\":\"code\",\"source\":[],\"metadata\":{\"id\":\"jCvf4Lpw_5ib\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"dfs = df\\n\",\"\\n\",\"dfs[\\\"Survived\\\"] = test #y_pred_test\\n\",\"dfs\\n\",\"\\n\",\"dfs.to_csv('testq3.csv', index = False)\\n\",\"dfs\"],\"metadata\":{\"id\":\"JG5JHmIr4NJV\",\"executionInfo\":{\"status\":\"ok\",\"timestamp\":1665189753258,\"user_tz\":420,\"elapsed\":12,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":424},\"outputId\":\"1a5d58da-f369-4e2b-e9c8-8cfff1a785ac\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"execute_result\",\"data\":{\"text/plain\":[\" PassengerId Survived\\n\",\"0 892 0\\n\",\"1 893 1\\n\",\"2 894 0\\n\",\"3 895 0\\n\",\"4 896 1\\n\",\".. ... ...\\n\",\"413 1305 0\\n\",\"414 1306 1\\n\",\"415 1307 0\\n\",\"416 1308 0\\n\",\"417 1309 1\\n\",\"\\n\",\"[418 rows x 2 columns]\"],\"text/html\":[\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\"\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" PassengerId \\n\",\" Survived \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" 0 \\n\",\" 892 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 1 \\n\",\" 893 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" 2 \\n\",\" 894 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 3 \\n\",\" 895 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 4 \\n\",\" 896 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" ... \\n\",\" ... \\n\",\" ... \\n\",\" \\n\",\" \\n\",\" 413 \\n\",\" 1305 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 414 \\n\",\" 1306 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\" 415 \\n\",\" 1307 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 416 \\n\",\" 1308 \\n\",\" 0 \\n\",\" \\n\",\" \\n\",\" 417 \\n\",\" 1309 \\n\",\" 1 \\n\",\" \\n\",\" \\n\",\"
\\n\",\"
418 rows × 2 columns
\\n\",\"
\\n\",\"
\\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\" \\n\",\"\\n\",\" \\n\",\"
\\n\",\"
\\n\",\" \"]},\"metadata\":{},\"execution_count\":347}]},{\"cell_type\":\"markdown\",\"source\":[\"# New Section\"],\"metadata\":{\"id\":\"GwQwU8vxqoKa\"}},{\"cell_type\":\"code\",\"source\":[\"clf = MLPClassifier(max_iter= 1000, solver=\\\"adam\\\", random_state = 43) #\\\"p*fare\\\" #activation = \\\"logistic\\\"\\n\",\"\\n\",\"Y_train = df_train[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"#X_test = df_test[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"Y_test = df[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"X_train = df_train[t] #[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex\\\", \\\"ID\\\", \\\"Age_a\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\n\",\"X_test = df_test[t] #[[\\\"Pclass\\\", \\\"Fare\\\", \\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]]\\n\",\"clf.fit(X_train, Y_train)\\n\",\"\\n\",\"#print('Accuracy on training---')\\n\",\"y_pred_train=clf.predict(X_train)\\n\",\"print(accuracy_score(Y_train,y_pred_train))\\n\",\"\\n\",\"test = clf.predict(X_test)\\n\",\"#print(accuracy_score(Y_train,y_pred_train))\\n\",\"#X_test\\n\",\"#0.8249158249158249\\n\",\"#0.8787878787878788\"],\"metadata\":{\"id\":\"6nl_mnJ4_pYX\",\"executionInfo\":{\"status\":\"error\",\"timestamp\":1665189753498,\"user_tz\":420,\"elapsed\":248,\"user\":{\"displayName\":\"Ronel Solomon\",\"userId\":\"05230687019210996793\"}},\"colab\":{\"base_uri\":\"https://localhost:8080/\",\"height\":425},\"outputId\":\"14a7967c-679a-4361-f8c4-cba03e2951fd\"},\"execution_count\":null,\"outputs\":[{\"output_type\":\"error\",\"ename\":\"KeyError\",\"evalue\":\"ignored\",\"traceback\":[\"\\u001b[0;31m---------------------------------------------------------------------------\\u001b[0m\",\"\\u001b[0;31mKeyError\\u001b[0m Traceback (most recent call last)\",\"\\u001b[0;32m\\u001b[0m in \\u001b[0;36m\\u001b[0;34m\\u001b[0m\\n\\u001b[1;32m 4\\u001b[0m \\u001b[0;31m#X_test = df_test[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m 5\\u001b[0m \\u001b[0mY_test\\u001b[0m \\u001b[0;34m=\\u001b[0m \\u001b[0mdf\\u001b[0m\\u001b[0;34m[\\u001b[0m\\u001b[0;34m\\\"Survived\\\"\\u001b[0m\\u001b[0;34m]\\u001b[0m \\u001b[0;31m#.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m----> 6\\u001b[0;31m \\u001b[0mX_train\\u001b[0m \\u001b[0;34m=\\u001b[0m \\u001b[0mdf_train\\u001b[0m\\u001b[0;34m[\\u001b[0m\\u001b[0mt\\u001b[0m\\u001b[0;34m]\\u001b[0m \\u001b[0;31m#[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex\\\", \\\"ID\\\", \\\"Age_a\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[1;32m 7\\u001b[0m \\u001b[0mX_test\\u001b[0m \\u001b[0;34m=\\u001b[0m \\u001b[0mdf_test\\u001b[0m\\u001b[0;34m[\\u001b[0m\\u001b[0mt\\u001b[0m\\u001b[0;34m]\\u001b[0m \\u001b[0;31m#[[\\\"Pclass\\\", \\\"Fare\\\", \\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]]\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m 8\\u001b[0m \\u001b[0mclf\\u001b[0m\\u001b[0;34m.\\u001b[0m\\u001b[0mfit\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0mX_train\\u001b[0m\\u001b[0;34m,\\u001b[0m \\u001b[0mY_train\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\",\"\\u001b[0;32m/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py\\u001b[0m in \\u001b[0;36m__getitem__\\u001b[0;34m(self, key)\\u001b[0m\\n\\u001b[1;32m 3462\\u001b[0m \\u001b[0;32mif\\u001b[0m \\u001b[0mis_iterator\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0mkey\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m:\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m 3463\\u001b[0m \\u001b[0mkey\\u001b[0m \\u001b[0;34m=\\u001b[0m \\u001b[0mlist\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0mkey\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m-> 3464\\u001b[0;31m \\u001b[0mindexer\\u001b[0m \\u001b[0;34m=\\u001b[0m \\u001b[0mself\\u001b[0m\\u001b[0;34m.\\u001b[0m\\u001b[0mloc\\u001b[0m\\u001b[0;34m.\\u001b[0m\\u001b[0m_get_listlike_indexer\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0mkey\\u001b[0m\\u001b[0;34m,\\u001b[0m \\u001b[0maxis\\u001b[0m\\u001b[0;34m=\\u001b[0m\\u001b[0;36m1\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m[\\u001b[0m\\u001b[0;36m1\\u001b[0m\\u001b[0;34m]\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[1;32m 3465\\u001b[0m \\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m 3466\\u001b[0m \\u001b[0;31m# take() does not accept boolean indexers\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\",\"\\u001b[0;32m/usr/local/lib/python3.7/dist-packages/pandas/core/indexing.py\\u001b[0m in \\u001b[0;36m_get_listlike_indexer\\u001b[0;34m(self, key, axis)\\u001b[0m\\n\\u001b[1;32m 1312\\u001b[0m \\u001b[0mkeyarr\\u001b[0m\\u001b[0;34m,\\u001b[0m \\u001b[0mindexer\\u001b[0m\\u001b[0;34m,\\u001b[0m \\u001b[0mnew_indexer\\u001b[0m \\u001b[0;34m=\\u001b[0m \\u001b[0max\\u001b[0m\\u001b[0;34m.\\u001b[0m\\u001b[0m_reindex_non_unique\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0mkeyarr\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m 1313\\u001b[0m \\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m-> 1314\\u001b[0;31m \\u001b[0mself\\u001b[0m\\u001b[0;34m.\\u001b[0m\\u001b[0m_validate_read_indexer\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0mkeyarr\\u001b[0m\\u001b[0;34m,\\u001b[0m \\u001b[0mindexer\\u001b[0m\\u001b[0;34m,\\u001b[0m \\u001b[0maxis\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[1;32m 1315\\u001b[0m \\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m 1316\\u001b[0m if needs_i8_conversion(ax.dtype) or isinstance(\\n\",\"\\u001b[0;32m/usr/local/lib/python3.7/dist-packages/pandas/core/indexing.py\\u001b[0m in \\u001b[0;36m_validate_read_indexer\\u001b[0;34m(self, key, indexer, axis)\\u001b[0m\\n\\u001b[1;32m 1375\\u001b[0m \\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m 1376\\u001b[0m \\u001b[0mnot_found\\u001b[0m \\u001b[0;34m=\\u001b[0m \\u001b[0mlist\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0mensure_index\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0mkey\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m[\\u001b[0m\\u001b[0mmissing_mask\\u001b[0m\\u001b[0;34m.\\u001b[0m\\u001b[0mnonzero\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m[\\u001b[0m\\u001b[0;36m0\\u001b[0m\\u001b[0;34m]\\u001b[0m\\u001b[0;34m]\\u001b[0m\\u001b[0;34m.\\u001b[0m\\u001b[0munique\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[0;32m-> 1377\\u001b[0;31m \\u001b[0;32mraise\\u001b[0m \\u001b[0mKeyError\\u001b[0m\\u001b[0;34m(\\u001b[0m\\u001b[0;34mf\\\"{not_found} not in index\\\"\\u001b[0m\\u001b[0;34m)\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[0m\\u001b[1;32m 1378\\u001b[0m \\u001b[0;34m\\u001b[0m\\u001b[0m\\n\\u001b[1;32m 1379\\u001b[0m \\u001b[0;34m\\u001b[0m\\u001b[0m\\n\",\"\\u001b[0;31mKeyError\\u001b[0m: \\\"['ID_Mr', 'Pclass_3', 'ID_Miss', 'Cabin_nan', 'Pclass_1', 'ID_Mrs', 'Compartment_F'] not in index\\\"\"]}]},{\"cell_type\":\"markdown\",\"source\":[\"clf = MLPClassifier(max_iter= 1000, \\n\",\" solver=\\\"adam\\\", random_state = 43) #\\\"p*fare\\\" #activation = \\\"logistic\\\"\\n\",\"\\n\",\"Y_train = df_train[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"#X_test = df_test[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"Y_test = df[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"X_train = df_train[t] #[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex\\\", \\\"ID\\\", \\\"Age_a\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\n\",\"X_test = df_test[t] #[[\\\"Pclass\\\", \\\"Fare\\\", \\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]]\\n\",\"clf.fit(X_train, Y_train)\\n\",\"\\n\",\"#print('Accuracy on training---')\\n\",\"y_pred_train=clf.predict(X_train)\\n\",\"print(accuracy_score(Y_train,y_pred_train))\\n\",\"\\n\",\"test = clf.predict(X_test)\\n\",\"#print(accuracy_score(Y_train,y_pred_train))\\n\",\"#X_test\\n\",\"0.8249158249158249\\n\",\"\\n\",\"t = [\\\"ID\\\", \\\"SibSp\\\",\\\"Parch\\\", \\\"Sex\\\", \\\"Pclass\\\", \\\"Embarked\\\", \\\"Fare\\\", \\\"Compartment\\\", \\\"Age\\\"]\"],\"metadata\":{\"id\":\"jhvOFMQgGcAK\"}},{\"cell_type\":\"code\",\"source\":[\"dfs = df\\n\",\"\\n\",\"dfs[\\\"Survived\\\"] = test #y_pred_test\\n\",\"dfs\\n\",\"\\n\",\"dfs.to_csv('testa.csv', index = False)\\n\",\"dfs\"],\"metadata\":{\"id\":\"F3pExnSv_XcZ\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"from sklearn.ensemble import RandomForestClassifier\\n\",\"from sklearn.datasets import make_classification\\n\",\"rf = RandomForestClassifier(criterion = \\\"gini\\\", \\n\",\" min_samples_leaf = 1, \\n\",\" min_samples_split = 10, \\n\",\" n_estimators=100, \\n\",\" max_features='auto', \\n\",\" oob_score = True, \\n\",\" random_state=1, \\n\",\" n_jobs=-1)\\n\",\"\\n\",\"rf.fit(X_train, Y_train)\\n\",\"test = rf.predict(X_test)\\n\",\"\\n\",\"rf.score(X_train, Y_train)\"],\"metadata\":{\"id\":\"7a07NGOBIuFh\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"dfs = df\\n\",\"\\n\",\"dfs[\\\"Survived\\\"] = test #y_pred_test\\n\",\"dfs\\n\",\"\\n\",\"dfs.to_csv('test4.csv', index = False)\\n\",\"dfs\"],\"metadata\":{\"id\":\"RwyNxwg8GeiY\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_tests = pd.get_dummies(df_test.drop(columns = [\\\"Name\\\"], axis = 1), dummy_na = True)\\n\",\"df_trains = pd.get_dummies(df_train.drop(columns = [\\\"Name\\\"], axis = 1), dummy_na = True)\\n\",\"df_trains\"],\"metadata\":{\"id\":\"2AUkTx1ECQ8d\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"Age\\\"] = df_train[\\\"Age\\\"].replace(np.NaN, df_train[\\\"Age\\\"].mean())\\n\",\"df_test[\\\"Age\\\"] = df_test[\\\"Age\\\"].replace(np.NaN, df_test[\\\"Age\\\"].mean())\\n\",\"\\n\",\"df_trains[\\\"Age\\\"] = df_trains[\\\"Age\\\"].replace(np.NaN, df_trains[\\\"Age\\\"].mean())\\n\",\"df_tests[\\\"Age\\\"] = df_tests[\\\"Age\\\"].replace(np.NaN, df_tests[\\\"Age\\\"].mean())\"],\"metadata\":{\"id\":\"TIoDFXYN9yfN\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"Fare\\\"] = df_train[\\\"Fare\\\"].replace(np.NaN, 0)\\n\",\"df_test[\\\"Fare\\\"] = df_test[\\\"Fare\\\"].replace(np.NaN, 0)\\n\",\"\\n\",\"df_trains[\\\"Fare\\\"] = df_trains[\\\"Fare\\\"].replace(np.NaN, 0)\\n\",\"df_tests[\\\"Fare\\\"] = df_tests[\\\"Fare\\\"].replace(np.NaN, 0)\"],\"metadata\":{\"id\":\"sXxYROdD-r2g\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"#df_train = df_train #.replace(np.NaN, 0) #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"df_train\"],\"metadata\":{\"id\":\"rxitND20wuCN\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_test = df_test #.replace(np.NaN, 0) #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"df_test\"],\"metadata\":{\"id\":\"tJEXdOzNxYym\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df = df #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"df\"],\"metadata\":{\"id\":\"YK-qj5sdxgER\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_train = df_train.replace({\\\"male\\\": 0, \\\"female\\\": 1})\\n\",\"df_test = df_test.replace({\\\"male\\\": 0, \\\"female\\\": 1})\\n\",\"df_test[\\\"Sex\\\"].values\"],\"metadata\":{\"id\":\"4KKw3ihx1ae0\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"#df_trains[t + [\\\"Survived\\\"]].corr()\"],\"metadata\":{\"id\":\"GM-Jx-ssckLt\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_train[\\\"Fare\\\"].unique()\"],\"metadata\":{\"id\":\"Eg9YyCW8oP1d\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"#adam\\n\",\"t = [\\\"ID\\\", \\\"SibSp\\\",\\\"Parch\\\", \\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Pclass\\\", \\\"Fare\\\", \\\"Embarked_C\\\"]#\\\"Embarked_S\\\"\\n\",\"clf = MLPClassifier(max_iter= 2000,\\n\",\" solver='adam', verbose=1, random_state=43)\\n\",\"#X_train = df_train[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"Y_train = df_train[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"#X_test = df_test[[\\\"Pclass\\\", \\\"Age\\\", \\\"Fare\\\", \\\"Sex\\\"]] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"Y_test = df[\\\"Survived\\\"] #.dropna(axis=0, how='any', thresh=None, subset=None, inplace=False)\\n\",\"X_train = df_trains[t] #[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\n\",\"X_test = df_tests[t] #[[\\\"Pclass\\\", \\\"Fare\\\", \\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]]\\n\",\"clf.fit(X_train, Y_train)\\n\",\"\\n\",\"#print('Accuracy on training---')\\n\",\"y_pred_train=clf.predict(X_train)\\n\",\"print(accuracy_score(Y_train,y_pred_train))\\n\",\"\\n\",\"#print('Accuracy on test---')\\n\",\"y_pred_test=clf.predict(X_test)\\n\",\"print(accuracy_score(Y_test, y_pred_test))\"],\"metadata\":{\"id\":\"wk3LVN09v4KI\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"\\n\",\"\\n\",\"X_train = df_trains[t] #[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\n\",\"X_test = df_tests[t] #[[\\\"Pclass\\\", \\\"Fare\\\", \\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"])\\n\",\"\\n\",\"fea = X_train.to_dict(\\\"records\\\") # from question\\n\",\"\\n\",\"depth = 3\\n\",\"\\n\",\"\\n\",\"vecs = DictVectorizer() # from question\\n\",\"\\n\",\"le = preprocessing.LabelEncoder() # from question\\n\",\"\\n\",\"fea = vecs.fit_transform(fea) # fitting the value\\n\",\"\\n\",\"\\n\",\"X_test = X_test.to_dict(\\\"records\\\") # from question\\n\",\"#print(len(X_test))\\n\",\"\\n\",\"vecs = DictVectorizer() # from question\\n\",\"le = preprocessing.LabelEncoder() # from question\\n\",\"X_test = vecs.fit_transform(X_test)\\n\",\"\\n\",\"clf = tree.DecisionTreeClassifier(max_depth = depth) #max_features = 869\\n\",\"clf.fit(fea, Y_train)\\n\",\"\\n\",\"gen = [0, 1]\\n\",\"le.fit(gen)\\n\",\"Y_train = le.transform(Y_train)\\n\",\"\\n\",\"\\n\",\"Y_test = df[\\\"Survived\\\"]\\n\",\"\\n\",\"\\n\",\"Y_train = np.array(Y_train)\\n\",\"\\n\",\"Y_train.reshape(1, -1)\\n\",\"y_pred_train = clf.predict(X_train)\\n\",\"test = clf.predict(X_test)\\n\",\"test = le.transform(test)\\n\",\"\\n\",\"acc = accuracy_score(Y_train,y_pred_train)\\n\",\"print(acc)\"],\"metadata\":{\"id\":\"rH7JVxYVIlsv\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_trains\"],\"metadata\":{\"id\":\"i4XMliWGNJSp\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"df_trains\\n\",\"import seaborn as sns\\n\",\"# Create the default pairplot\\n\",\"#sns.pairplot(df_trains)\"],\"metadata\":{\"id\":\"26VRib5DP1Xb\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"X_train = df_trains[t] #[[\\\"Pclass\\\", \\\"Fare\\\",\\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"]).drop(columns = [\\\"Name\\\"]).drop(columns = [\\\"Embarked\\\"]).replace(np.NaN, 0) #\\\"Name\\\"\\n\",\"X_test = df_tests[t] #[[\\\"Pclass\\\", \\\"Fare\\\", \\\"Sex_male\\\", \\\"Sex_female\\\", \\\"Embarked_S\\\"]] #.replace(np.NaN, 0) #.drop(columns = [\\\"Survived\\\"])\\n\",\"\\n\",\"fea = X_train.to_dict(\\\"records\\\") # from question\\n\",\"\\n\",\"depth = 3\\n\",\"\\n\",\"\\n\",\"vecs = DictVectorizer() # from question\\n\",\"\\n\",\"le = preprocessing.LabelEncoder() # from question\\n\",\"\\n\",\"fea = vecs.fit_transform(fea) # fitting the value\\n\",\"\\n\",\"\\n\",\"X_test = X_test.to_dict(\\\"records\\\") # from question\\n\",\"#print(len(X_test))\\n\",\"\\n\",\"vecs = DictVectorizer() # from question\\n\",\"le = preprocessing.LabelEncoder() # from question\\n\",\"X_test = vecs.fit_transform(X_test)\\n\",\"\\n\",\"clf = tree.DecisionTreeClassifier(max_depth = depth) #max_features = 869\\n\",\"clf.fit(fea, Y_train)\\n\",\"\\n\",\"gen = [0, 1]\\n\",\"le.fit(gen)\\n\",\"Y_train = le.transform(Y_train)\\n\",\"\\n\",\"\\n\",\"Y_test = df[\\\"Survived\\\"]\\n\",\"\\n\",\"\\n\",\"Y_train = np.array(Y_train)\\n\",\"\\n\",\"Y_train.reshape(1, -1)\\n\",\"test = clf.predict(X_test)\\n\",\"test = le.transform(test)\\n\",\"\\n\",\"acc = accuracy_score(test, Y_test)\\n\",\"print(acc)\\n\",\"\\n\",\"#0.9760765550239234\"],\"metadata\":{\"id\":\"YzQT9mq1xLeG\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"dfs = df\\n\",\"\\n\",\"dfs[\\\"Survived\\\"] = test #y_pred_test\\n\",\"dfs\"],\"metadata\":{\"id\":\"4Em_q4OJ3c71\"},\"execution_count\":null,\"outputs\":[]},{\"cell_type\":\"code\",\"source\":[\"dfs.to_csv('test2.csv', index = False)\"],\"metadata\":{\"id\":\"LG6TSx49Kvlt\"},\"execution_count\":null,\"outputs\":[]}]}",
+ "size": 367686,
+ "language": "unknown"
+ }
+ },
+ "_cache_metadata": {
+ "url": "https://github.com/ronelsolomon/dma.git",
+ "content_type": "github",
+ "cached_at": "2026-03-02T22:49:45.640838",
+ "cache_key": "d4b14584b9a950a926ce9d7c55e3590b"
+ }
+}
\ No newline at end of file