{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"\nimport numpy as np \nimport pandas as pd \n\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-21T08:26:51.006214Z","iopub.execute_input":"2023-03-21T08:26:51.006697Z","iopub.status.idle":"2023-03-21T08:27:24.276091Z","shell.execute_reply.started":"2023-03-21T08:26:51.006656Z","shell.execute_reply":"2023-03-21T08:27:24.274576Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd \nimport numpy as np                    \nimport seaborn as sns \n","metadata":{"execution":{"iopub.status.busy":"2023-03-21T08:55:50.607740Z","iopub.execute_input":"2023-03-21T08:55:50.608238Z","iopub.status.idle":"2023-03-21T08:56:03.375143Z","shell.execute_reply.started":"2023-03-21T08:55:50.608196Z","shell.execute_reply":"2023-03-21T08:56:03.373824Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data = pd.read_csv('/kaggle/input/asl-signs/train.csv')","metadata":{"execution":{"iopub.status.busy":"2023-03-21T08:56:12.877312Z","iopub.execute_input":"2023-03-21T08:56:12.878409Z","iopub.status.idle":"2023-03-21T08:56:13.152556Z","shell.execute_reply.started":"2023-03-21T08:56:12.878349Z","shell.execute_reply":"2023-03-21T08:56:13.150995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"parquet_file = '/kaggle/input/asl-signs/train_landmark_files/16069/100015657.parquet'\nnew_parquet_df = pd.read_parquet(parquet_file)","metadata":{"execution":{"iopub.status.busy":"2023-03-21T10:24:05.702848Z","iopub.execute_input":"2023-03-21T10:24:05.703449Z","iopub.status.idle":"2023-03-21T10:24:05.781404Z","shell.execute_reply.started":"2023-03-21T10:24:05.703394Z","shell.execute_reply":"2023-03-21T10:24:05.779647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sign_to_prediction_index_map = {\n                                  \"TV\": 0,\n                                  \"after\": 1,\n                                  \"airplane\": 2,\n                                  \"all\": 3,\n                                  \"alligator\": 4,\n                                  \"animal\": 5,\n                                  \"another\": 6,\n                                  \"any\": 7,\n                                  \"apple\": 8,\n                                  \"arm\": 9,\n                                  \"aunt\": 10,\n                                  \"awake\": 11,\n                                  \"backyard\": 12,\n                                  \"bad\": 13,\n                                  \"balloon\": 14,\n                                  \"bath\": 15,\n                                  \"because\": 16,\n                                  \"bed\": 17,\n                                  \"bedroom\": 18,\n                                  \"bee\": 19,\n                                  \"before\": 20,\n                                  \"beside\": 21,\n                                  \"better\": 22,\n                                  \"bird\": 23,\n                                  \"black\": 24,\n                                  \"blow\": 25,\n                                  \"blue\": 26,\n                                  \"boat\": 27,\n                                  \"book\": 28,\n                                  \"boy\": 29,\n                                  \"brother\": 30,\n                                  \"brown\": 31,\n                                  \"bug\": 32,\n                                  \"bye\": 33,\n                                  \"callonphone\": 34,\n                                  \"can\": 35,\n                                  \"car\": 36,\n                                  \"carrot\": 37,\n                                  \"cat\": 38,\n                                  \"cereal\": 39,\n                                  \"chair\": 40,\n                                  \"cheek\": 41,\n                                  \"child\": 42,\n                                  \"chin\": 43,\n                                  \"chocolate\": 44,\n                                  \"clean\": 45,\n                                  \"close\": 46,\n                                  \"closet\": 47,\n                                  \"cloud\": 48,\n                                  \"clown\": 49,\n                                  \"cow\": 50,\n                                  \"cowboy\": 51,\n                                  \"cry\": 52,\n                                  \"cut\": 53,\n                                  \"cute\": 54,\n                                  \"dad\": 55,\n                                  \"dance\": 56,\n                                  \"dirty\": 57,\n                                  \"dog\": 58,\n                                  \"doll\": 59,\n                                  \"donkey\": 60,\n                                  \"down\": 61,\n                                  \"drawer\": 62,\n                                  \"drink\": 63,\n                                  \"drop\": 64,\n                                  \"dry\": 65,\n                                  \"dryer\": 66,\n                                  \"duck\": 67,\n                                  \"ear\": 68,\n                                  \"elephant\": 69,\n                                  \"empty\": 70,\n                                  \"every\": 71,\n                                  \"eye\": 72,\n                                  \"face\": 73,\n                                  \"fall\": 74,\n                                  \"farm\": 75,\n                                  \"fast\": 76,\n                                  \"feet\": 77,\n                                  \"find\": 78,\n                                  \"fine\": 79,\n                                  \"finger\": 80,\n                                  \"finish\": 81,\n                                  \"fireman\": 82,\n                                  \"first\": 83,\n                                  \"fish\": 84,\n                                  \"flag\": 85,\n                                  \"flower\": 86,\n                                  \"food\": 87,\n                                  \"for\": 88,\n                                  \"frenchfries\": 89,\n                                  \"frog\": 90,\n                                  \"garbage\": 91,\n                                  \"gift\": 92,\n                                  \"giraffe\": 93,\n                                  \"girl\": 94,\n                                  \"give\": 95,\n                                  \"glasswindow\": 96,\n                                  \"go\": 97,\n                                  \"goose\": 98,\n                                  \"grandma\": 99,\n                                  \"grandpa\": 100,\n                                  \"grass\": 101,\n                                  \"green\": 102,\n                                  \"gum\": 103,\n                                  \"hair\": 104,\n                                  \"happy\": 105,\n                                  \"hat\": 106,\n                                  \"hate\": 107,\n                                  \"have\": 108,\n                                  \"haveto\": 109,\n                                  \"head\": 110,\n                                  \"hear\": 111,\n                                  \"helicopter\": 112,\n                                  \"hello\": 113,\n                                  \"hen\": 114,\n                                  \"hesheit\": 115,\n                                  \"hide\": 116,\n                                  \"high\": 117,\n                                  \"home\": 118,\n                                  \"horse\": 119,\n                                  \"hot\": 120,\n                                  \"hungry\": 121,\n                                  \"icecream\": 122,\n                                  \"if\": 123,\n                                  \"into\": 124,\n                                  \"jacket\": 125,\n                                  \"jeans\": 126,\n                                  \"jump\": 127,\n                                  \"kiss\": 128,\n                                  \"kitty\": 129,\n                                  \"lamp\": 130,\n                                  \"later\": 131,\n                                  \"like\": 132,\n                                  \"lion\": 133,\n                                  \"lips\": 134,\n                                  \"listen\": 135,\n                                  \"look\": 136,\n                                  \"loud\": 137,\n                                  \"mad\": 138,\n                                  \"make\": 139,\n                                  \"man\": 140,\n                                  \"many\": 141,\n                                  \"milk\": 142,\n                                  \"minemy\": 143,\n                                  \"mitten\": 144,\n                                  \"mom\": 145,\n                                  \"moon\": 146,\n                                  \"morning\": 147,\n                                  \"mouse\": 148,\n                                  \"mouth\": 149,\n                                  \"nap\": 150,\n                                  \"napkin\": 151,\n                                  \"night\": 152,\n                                  \"no\": 153,\n                                  \"noisy\": 154,\n                                  \"nose\": 155,\n                                  \"not\": 156,\n                                  \"now\": 157,\n                                  \"nuts\": 158,\n                                  \"old\": 159,\n                                  \"on\": 160,\n                                  \"open\": 161,\n                                  \"orange\": 162,\n                                  \"outside\": 163,\n                                  \"owie\": 164,\n                                  \"owl\": 165,\n                                  \"pajamas\": 166,\n                                  \"pen\": 167,\n                                  \"pencil\": 168,\n                                  \"penny\": 169,\n                                  \"person\": 170,\n                                  \"pig\": 171,\n                                  \"pizza\": 172,\n                                  \"please\": 173,\n                                  \"police\": 174,\n                                  \"pool\": 175,\n                                  \"potty\": 176,\n                                  \"pretend\": 177,\n                                  \"pretty\": 178,\n                                  \"puppy\": 179,\n                                  \"puzzle\": 180,\n                                  \"quiet\": 181,\n                                  \"radio\": 182,\n                                  \"rain\": 183,\n                                  \"read\": 184,\n                                  \"red\": 185,\n                                  \"refrigerator\": 186,\n                                  \"ride\": 187,\n                                  \"room\": 188,\n                                  \"sad\": 189,\n                                  \"same\": 190,\n                                  \"say\": 191,\n                                  \"scissors\": 192,\n                                  \"see\": 193,\n                                  \"shhh\": 194,\n                                  \"shirt\": 195,\n                                  \"shoe\": 196,\n                                  \"shower\": 197,\n                                  \"sick\": 198,\n                                  \"sleep\": 199,\n                                  \"sleepy\": 200,\n                                  \"smile\": 201,\n                                  \"snack\": 202,\n                                  \"snow\": 203,\n                                  \"stairs\": 204,\n                                  \"stay\": 205,\n                                  \"sticky\": 206,\n                                  \"store\": 207,\n                                  \"story\": 208,\n                                  \"stuck\": 209,\n                                  \"sun\": 210,\n                                  \"table\": 211,\n                                  \"talk\": 212,\n                                  \"taste\": 213,\n                                  \"thankyou\": 214,\n                                  \"that\": 215,\n                                  \"there\": 216,\n                                  \"think\": 217,\n                                  \"thirsty\": 218,\n                                  \"tiger\": 219,\n                                  \"time\": 220,\n                                  \"tomorrow\": 221,\n                                  \"tongue\": 222,\n                                  \"tooth\": 223,\n                                  \"toothbrush\": 224,\n                                  \"touch\": 225,\n                                  \"toy\": 226,\n                                  \"tree\": 227,\n                                  \"uncle\": 228,\n                                  \"underwear\": 229,\n                                  \"up\": 230,\n                                  \"vacuum\": 231,\n                                  \"wait\": 232,\n                                  \"wake\": 233,\n                                  \"water\": 234,\n                                  \"wet\": 235,\n                                  \"weus\": 236,\n                                  \"where\": 237,\n                                  \"white\": 238,\n                                  \"who\": 239,\n                                  \"why\": 240,\n                                  \"will\": 241,\n                                  \"wolf\": 242,\n                                  \"yellow\": 243,\n                                  \"yes\": 244,\n                                  \"yesterday\": 245,\n                                  \"yourself\": 246,\n                                  \"yucky\": 247,\n                                  \"zebra\": 248,\n                                  \"zipper\": 249\n}","metadata":{"execution":{"iopub.status.busy":"2023-03-21T10:30:36.409819Z","iopub.execute_input":"2023-03-21T10:30:36.410305Z","iopub.status.idle":"2023-03-21T10:30:36.445385Z","shell.execute_reply.started":"2023-03-21T10:30:36.410266Z","shell.execute_reply":"2023-03-21T10:30:36.443802Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"new_parquet_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-03-21T08:57:27.864962Z","iopub.execute_input":"2023-03-21T08:57:27.865528Z","iopub.status.idle":"2023-03-21T08:57:27.891252Z","shell.execute_reply.started":"2023-03-21T08:57:27.865481Z","shell.execute_reply":"2023-03-21T08:57:27.889183Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"new_parquet_df.tail()\n#x,y,z values have missing values\n#NB check how many rows have x,y and z have NaN\n","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:48:54.261712Z","iopub.execute_input":"2023-03-21T09:48:54.263179Z","iopub.status.idle":"2023-03-21T09:48:54.281891Z","shell.execute_reply.started":"2023-03-21T09:48:54.263097Z","shell.execute_reply":"2023-03-21T09:48:54.280224Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"new_parquet_df.shape","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:23:39.093023Z","iopub.execute_input":"2023-03-21T09:23:39.093624Z","iopub.status.idle":"2023-03-21T09:23:39.104492Z","shell.execute_reply.started":"2023-03-21T09:23:39.093578Z","shell.execute_reply":"2023-03-21T09:23:39.102104Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"the landmark file has 57015 observations and 7 columns","metadata":{}},{"cell_type":"code","source":"new_parquet_df.keys()","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:14:59.416283Z","iopub.execute_input":"2023-03-21T09:14:59.416855Z","iopub.status.idle":"2023-03-21T09:14:59.428346Z","shell.execute_reply.started":"2023-03-21T09:14:59.416813Z","shell.execute_reply":"2023-03-21T09:14:59.427008Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"we have six colums namely frame, row_id, type, landmark_index, 'x', 'y', 'z","metadata":{}},{"cell_type":"code","source":"new_parquet_df.dtypes","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:40:45.109111Z","iopub.execute_input":"2023-03-21T09:40:45.109802Z","iopub.status.idle":"2023-03-21T09:40:45.122739Z","shell.execute_reply.started":"2023-03-21T09:40:45.109743Z","shell.execute_reply":"2023-03-21T09:40:45.120896Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# finding how many different frames we have\n\nnew_parquet_df['frame'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:43:42.260464Z","iopub.execute_input":"2023-03-21T09:43:42.262042Z","iopub.status.idle":"2023-03-21T09:43:42.277298Z","shell.execute_reply.started":"2023-03-21T09:43:42.261977Z","shell.execute_reply":"2023-03-21T09:43:42.275449Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"new_parquet_df['type'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:13:07.261943Z","iopub.execute_input":"2023-03-21T09:13:07.262500Z","iopub.status.idle":"2023-03-21T09:13:07.276625Z","shell.execute_reply.started":"2023-03-21T09:13:07.262448Z","shell.execute_reply":"2023-03-21T09:13:07.274636Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"features being closely looked at to predict the sign are the face,left hand,pose,and right hand","metadata":{}},{"cell_type":"code","source":"import pickle","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:11:13.346421Z","iopub.execute_input":"2023-03-21T09:11:13.346961Z","iopub.status.idle":"2023-03-21T09:11:13.353757Z","shell.execute_reply.started":"2023-03-21T09:11:13.346918Z","shell.execute_reply":"2023-03-21T09:11:13.352098Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"frames = new_parquet_df['frame']\nrowID = new_parquet_df['row_id']\ntypes = new_parquet_df['type']\nlandmark_index = new_parquet_df['landmark_index']\nX = new_parquet_df['x']\nY = new_parquet_df['y']\nZ =  new_parquet_df['z']\n\n\nprint(len(frames))\nprint(len(rowID))\nprint(len(types))\nprint(len(landmark_index))\nprint(len(X))\nprint(len(Y))\nprint(len(Z))","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:21:50.061264Z","iopub.execute_input":"2023-03-21T09:21:50.063624Z","iopub.status.idle":"2023-03-21T09:21:50.078821Z","shell.execute_reply.started":"2023-03-21T09:21:50.063497Z","shell.execute_reply":"2023-03-21T09:21:50.076839Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"no missing values in any column","metadata":{}},{"cell_type":"code","source":"data.tail(3) # last three observations","metadata":{"execution":{"iopub.status.busy":"2023-03-21T08:57:47.702251Z","iopub.execute_input":"2023-03-21T08:57:47.702835Z","iopub.status.idle":"2023-03-21T08:57:47.718065Z","shell.execute_reply.started":"2023-03-21T08:57:47.702787Z","shell.execute_reply":"2023-03-21T08:57:47.716289Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#import pandas as pd\n#import pyarrow.parquet as pq\n\n##data = pq.read_table('/kaggle/input/asl-signs/train_landmark_files')\n#df = data.to_pandas()\n#print(df.head())","metadata":{"execution":{"iopub.status.busy":"2023-03-21T08:27:36.289559Z","iopub.execute_input":"2023-03-21T08:27:36.290448Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#3import pandas as pd   #import the pandas library\n\n#parquet_file = '/kaggle/input/asl-signs/train_landmark_files'\n#pd.read_parquet(parquet_file, engine='pyarrow')","metadata":{"execution":{"iopub.status.busy":"2023-03-21T08:51:53.216550Z","iopub.execute_input":"2023-03-21T08:51:53.217089Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#import pandas as pd\n\n#df =  pd.read_parquet('/kaggle/input/asl-signs/train_landmark_files', engine='pyarrow')\n#print(df)\n\n#cols = [\"Name\"]\n#df1 = pd.read_parquet('/kaggle/input/asl-signs/train_landmark_files', columns=cols)\n#print(df1)","metadata":{"execution":{"iopub.status.busy":"2023-03-21T08:47:14.823320Z","iopub.execute_input":"2023-03-21T08:47:14.824548Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.shape\n#94477 observations and 4 columns","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:04:49.244877Z","iopub.execute_input":"2023-03-21T09:04:49.246667Z","iopub.status.idle":"2023-03-21T09:04:49.255953Z","shell.execute_reply.started":"2023-03-21T09:04:49.246581Z","shell.execute_reply":"2023-03-21T09:04:49.254596Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.dtypes\n#column names are participant_id, sequence_id ,sign and the path where the image is located","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:04:56.680855Z","iopub.execute_input":"2023-03-21T09:04:56.681440Z","iopub.status.idle":"2023-03-21T09:04:56.694221Z","shell.execute_reply.started":"2023-03-21T09:04:56.681379Z","shell.execute_reply":"2023-03-21T09:04:56.692652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#missing data\ndata.isnull()","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:05:04.459664Z","iopub.execute_input":"2023-03-21T09:05:04.461443Z","iopub.status.idle":"2023-03-21T09:05:04.497514Z","shell.execute_reply.started":"2023-03-21T09:05:04.461335Z","shell.execute_reply":"2023-03-21T09:05:04.495922Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data.info()\n#no null values","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:05:10.306505Z","iopub.execute_input":"2023-03-21T09:05:10.308942Z","iopub.status.idle":"2023-03-21T09:05:10.359723Z","shell.execute_reply.started":"2023-03-21T09:05:10.308860Z","shell.execute_reply":"2023-03-21T09:05:10.358202Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data['sign'].unique() #250 data types","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:05:24.499441Z","iopub.execute_input":"2023-03-21T09:05:24.501986Z","iopub.status.idle":"2023-03-21T09:05:24.530805Z","shell.execute_reply.started":"2023-03-21T09:05:24.501831Z","shell.execute_reply":"2023-03-21T09:05:24.527184Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data['participant_id'].nunique()#number of participants","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:05:36.021488Z","iopub.execute_input":"2023-03-21T09:05:36.022120Z","iopub.status.idle":"2023-03-21T09:05:36.043967Z","shell.execute_reply.started":"2023-03-21T09:05:36.022061Z","shell.execute_reply":"2023-03-21T09:05:36.039671Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data['sequence_id'].nunique() #each hand movenent has its own unique id","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:05:39.655347Z","iopub.execute_input":"2023-03-21T09:05:39.656597Z","iopub.status.idle":"2023-03-21T09:05:39.672810Z","shell.execute_reply.started":"2023-03-21T09:05:39.656532Z","shell.execute_reply":"2023-03-21T09:05:39.671592Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data['sign'].value_counts() #number of images with a certain sign","metadata":{"execution":{"iopub.status.busy":"2023-03-21T09:05:48.092773Z","iopub.execute_input":"2023-03-21T09:05:48.093287Z","iopub.status.idle":"2023-03-21T09:05:48.112916Z","shell.execute_reply.started":"2023-03-21T09:05:48.093245Z","shell.execute_reply":"2023-03-21T09:05:48.111139Z"},"trusted":true},"execution_count":null,"outputs":[]}]}