hexsha
stringlengths 40
40
| size
int64 6
14.9M
| ext
stringclasses 1
value | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 6
260
| max_stars_repo_name
stringlengths 6
119
| max_stars_repo_head_hexsha
stringlengths 40
41
| max_stars_repo_licenses
list | max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 6
260
| max_issues_repo_name
stringlengths 6
119
| max_issues_repo_head_hexsha
stringlengths 40
41
| max_issues_repo_licenses
list | max_issues_count
int64 1
67k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 6
260
| max_forks_repo_name
stringlengths 6
119
| max_forks_repo_head_hexsha
stringlengths 40
41
| max_forks_repo_licenses
list | max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | avg_line_length
float64 2
1.04M
| max_line_length
int64 2
11.2M
| alphanum_fraction
float64 0
1
| cells
list | cell_types
list | cell_type_groups
list |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cb690a821c21718795da4070b4725e0fcadb8245 | 12,459 | ipynb | Jupyter Notebook | 07Logistic-Regression/02Implement-Logistic-Regression.ipynb | ovtenng/ML-Algorithms-Action | b184f751d5a4e6b02df6a7963e5666a936e456b4 | [
"MIT"
]
| 2 | 2018-11-22T12:36:41.000Z | 2018-12-19T05:00:38.000Z | 07Logistic-Regression/02Implement-Logistic-Regression.ipynb | keithtu/ML-Algorithms-Action | b184f751d5a4e6b02df6a7963e5666a936e456b4 | [
"MIT"
]
| null | null | null | 07Logistic-Regression/02Implement-Logistic-Regression.ipynb | keithtu/ML-Algorithms-Action | b184f751d5a4e6b02df6a7963e5666a936e456b4 | [
"MIT"
]
| 2 | 2018-11-29T08:40:32.000Z | 2018-12-22T01:09:32.000Z | 62.60804 | 8,608 | 0.819167 | [
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn import datasets\n\niris = datasets.load_iris()",
"_____no_output_____"
],
[
"X = iris.data\ny = iris.target",
"_____no_output_____"
],
[
"X = X[y<2, :2]\ny = y[y<2]",
"_____no_output_____"
],
[
"plt.scatter(X[y==0, 0], X[y==0, 1], color=\"green\")\nplt.scatter(X[y==1, 0], X[y==1, 1], color=\"red\")",
"_____no_output_____"
]
],
[
[
"# Use our LogisticRegression",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import train_test_split\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, random_state=500)",
"_____no_output_____"
],
[
"from LogisticRegression import LogisticRegression",
"_____no_output_____"
],
[
"log_reg = LogisticRegression()",
"_____no_output_____"
],
[
"log_reg.fit(X_train, y_train)",
"_____no_output_____"
],
[
"log_reg.score(X_test, y_test)",
"_____no_output_____"
],
[
"log_reg.predict_proba(X_test)",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code"
]
| [
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6920d930401aa2539950134b908faa39f5c822 | 19,414 | ipynb | Jupyter Notebook | source/notebooks/preprocessing/image-to-sequence-preprocess-labels.ipynb | purrwhite/fuzzy-blue | 90b3495d43ea2d4547be80c0f6091c4ca723905f | [
"MIT"
]
| 1 | 2022-03-01T20:38:58.000Z | 2022-03-01T20:38:58.000Z | source/notebooks/preprocessing/image-to-sequence-preprocess-labels.ipynb | purrwhite/fuzzy-blue | 90b3495d43ea2d4547be80c0f6091c4ca723905f | [
"MIT"
]
| 8 | 2022-02-24T10:43:24.000Z | 2022-02-24T10:44:56.000Z | source/notebooks/preprocessing/image-to-sequence-preprocess-labels.ipynb | purrwhite/fuzzy-blue | 90b3495d43ea2d4547be80c0f6091c4ca723905f | [
"MIT"
]
| null | null | null | 35.298182 | 236 | 0.506233 | [
[
[
"import os\nimport re\nimport torch\nimport pickle\nimport pandas as pd\nimport numpy as np\nfrom tqdm.auto import tqdm\n\ntqdm.pandas()",
"_____no_output_____"
]
],
[
[
"# 1. Pre-processing\n\n### Create a combined dataframe\n> This creates a dataframe containing the image IDs & labels for both original images provided by the Bristol Myers Squibb pharmaceutical company, and the augmentations generated per each original image.",
"_____no_output_____"
]
],
[
[
"train_df = pd.read_csv('../../../../../../../../../Downloads/train/train_labels.csv')",
"_____no_output_____"
]
],
[
[
"### InChI pre-processing\n> This, firstly, splits the first part of the InChI string (the chemical formula) into sequences of text and numbers. Secondly, this splits the second part of the InChI string (the other layers) into sequences of text and numbers.",
"_____no_output_____"
]
],
[
[
"def split_inchi_formula(formula: str) -> str:\n \n \"\"\"\n This function splits the chemical formula (in the first layer of InChI) \n into its separate element and number components.\n \n :param formula: chemical formula, e.g. C13H20OS\n :type formula: string\n :return: splitted chemical formula\n :rtype: string\n \"\"\"\n \n string = ''\n \n # for each chemical element in the formula\n for i in re.findall(r\"[A-Z][^A-Z]*\", formula):\n \n # return each separate element, i.e. text\n elem = re.match(r\"\\D+\", i).group()\n # return each separate number\n num = i.replace(elem, \"\")\n # add either the element or both element and number (space-separated) to the string \n if num == \"\":\n string += f\"{elem} \"\n else:\n string += f\"{elem} {str(num)} \"\n \n return string.rstrip(' ')",
"_____no_output_____"
],
[
"def split_inchi_layers(layers: str) -> str:\n \n \"\"\"\n This function splits the layers (following the first layer of InChI)\n into separate element and number components.\n \n :param layers: layer string, e.g. c1-9(2)8-15-13-6-5-10(3)7-12(13)11(4)14/h5-7,9,11,14H,8H2,1-4H3\n :type layers: string\n :return: splitted layer info\n :rtype: string\n \"\"\"\n \n string = ''\n \n # for each layer in layers\n for i in re.findall(r\"[a-z][^a-z]*\", layers):\n # get the character preceding the layer info\n elem = i[0]\n # get the number string succeeding the character\n num = i.replace(elem, \"\").replace(\"/\", \"\")\n num_string = ''\n \n # for each number string\n for j in re.findall(r\"[0-9]+[^0-9]*\", num):\n # get the list of numbers\n num_list = list(re.findall(r'\\d+', j))\n # get the first number\n _num = num_list[0]\n # add the number string to the overall result\n if j == _num:\n num_string += f\"{_num} \"\n else:\n extra = j.replace(_num, \"\")\n num_string += f\"{_num} {' '.join(list(extra))} \"\n \n string += f\"/{elem} {num_string}\"\n\n return string.rstrip(' ')",
"_____no_output_____"
]
],
[
[
"### Tokenize texts and predict captions\n> This tokenizes each text by converting it to a sequence of characters. Backward compatibility is also maintained, i.e. sequence to text conversion. Image caption predictions also take place within the Tokenizer class.",
"_____no_output_____"
]
],
[
[
"class Tokenizer(object):\n \n def __init__(self):\n # string to integer mapping\n self.stoi = {}\n # integer to string mapping\n self.itos = {}\n \n def __len__(self) -> None:\n \n \"\"\"\n This method returns the length of token:index map.\n \n :return: length of map\n :rtype: int\n \"\"\"\n # return the length of the map\n return len(self.stoi)\n \n def fit_on_texts(self, texts: list) -> None:\n \n \"\"\"\n This method creates a vocabulary of all tokens contained in provided texts,\n and updates the mapping of token to index, and index to token.\n \n :param texts: list of texts\n :type texts: list\n \"\"\"\n \n # create a storage for all tokens\n vocab = set()\n \n # add tokens from each text to vocabulary\n for text in texts:\n vocab.update(text.split(' '))\n \n # sort the vocabulary in alphabetical order\n vocab = sorted(vocab)\n \n # add start, end and pad for sentence\n vocab.append('<sos>')\n vocab.append('<eos>')\n vocab.append('<pad>')\n \n # update the string to integer mapping, where integer is the index of the token\n for i, s in enumerate(vocab):\n self.stoi[s] = i\n \n # reverse the previous vocabulary to create integer to string mapping\n self.itos = {item[1]: item[0] for item in self.stoi.items()}\n \n def text_to_sequence(self, text: str) -> list:\n \n \"\"\"\n This method converts the given text to a list of its individual tokens,\n including start and end of string symbols.\n \n :param text: input textual data\n :type text: str\n :return: list of tokens\n :rtype: list\n \"\"\"\n \n # storage to append symbols to\n sequence = []\n \n # add the start of string symbol to storage\n sequence.append(self.stoi['<sos>'])\n \n # add each token in text to storage\n for s in text.split(' '):\n sequence.append(self.stoi[s])\n \n # add the end of string symbol to storage\n sequence.append(self.stoi['<eos>'])\n \n return sequence\n \n def texts_to_sequences(self, texts: list) -> list:\n \n \"\"\"\n This method converts each text in the provided list into sequences of characters.\n Each sequence is appended to a list and the said list is returned.\n \n :param texts: a list of input texts\n :type texts: list\n :return: a list of sequences\n :rtype: list\n \"\"\"\n \n # storage to append sequences to\n sequences = []\n \n # for each text do\n for text in texts:\n # convert the text to a list of characters\n sequence = self.text_to_sequence(text)\n # append the lists of characters to an aggregated list storage\n sequences.append(sequence)\n\n return sequences\n \n def sequence_to_text(self, sequence: list) -> str:\n \n \"\"\"\n This method converts the sequence of characters back into text.\n \n :param sequence: list of characters\n :type sequence: list\n :return: text\n :rtype: str \n \"\"\"\n # join the characters with no space in between\n return ''.join(list(map(lambda i: self.itos[i], sequence)))\n \n def sequences_to_texts(self, sequences: list) -> list:\n \n \"\"\"\n This method converts each provided sequence into text and returns all texts inside a list.\n \n :param sequences: list of character sequences\n :type sequences: list\n :return: list of texts\n :rtype: list\n \"\"\"\n \n # storage for texts\n texts = []\n \n # convert each sequence to text and append to storage\n for sequence in sequences:\n text = self.sequence_to_text(sequence)\n texts.append(text)\n\n return texts\n \n def predict_caption(self, sequence: list) -> str:\n \n \"\"\"\n This method predicts the caption by adding each symbol in sequence to a resulting string.\n This keeps happening up until the end of sentence or padding is met.\n \n :param sequence: list of characters\n :type sequence: list\n :return: image caption\n :rtype: string\n \"\"\"\n \n # storage for the final caption\n caption = ''\n \n # for each index in a sequence of symbols\n for i in sequence:\n # if symbol is the end of sentence or padding, break\n if i == self.stoi['<eos>'] or i == self.stoi['<pad>']:\n break\n # otherwise, add the symbol to the final caption\n caption += self.itos[i]\n \n return caption\n \n def predict_captions(self, sequences: list) -> list:\n \n \"\"\"\n This method predicts the captions for each sequence in a list of sequences.\n \n :param sequences: list of sequences\n :type sequences: list\n :return: list of final image captions\n :rtype: list\n \"\"\"\n \n # storage for captions\n captions = []\n \n # for each sequence, do\n for sequence in sequences:\n \n # predict the caption per sequence\n caption = self.predict_caption(sequence)\n \n # append to the storage of captions\n captions.append(caption)\n \n return captions",
"_____no_output_____"
],
[
"# split the InChI string with the backslash delimiter\ntrain_df['InChI_chemical_formula'] = train_df['InChI'].apply(lambda x: x.split('/')[1])",
"_____no_output_____"
]
],
[
[
"### Pre-process\n> This performs all preprocessing steps, mainly: (1) converting InChI string to space separated list of elements,\n(2) tokenizing the InChI string by creating lists of elements, and (3) computing the actual lengths of each such list. The results are returned in `train_df`.",
"_____no_output_____"
]
],
[
[
"# split the InChI string into the chemical formula part and the other layers part\ntrain_df['InChI_text'] = (\n train_df['InChI_chemical_formula'].apply(split_inchi_formula) \n + ' ' \n + train_df['InChI'].apply(lambda x: '/'.join(x.split('/')[2:])).apply(split_inchi_layers).values\n + ' '\n + train_df['InChI'].apply(lambda x: x[x.find('/h'):]).apply(split_inchi_layers).values\n)",
"_____no_output_____"
],
[
"# adjust for cases where hydrogen was not found and NaN was returned\nfor idx in range(len(train_df['InChI_text'])):\n if '/h' not in train_df.loc[idx, 'InChI']:\n train_df.loc[idx, 'InChI_text'] = (\n split_inchi_formula(train_df.loc[idx, 'InChI_chemical_formula'])\n +\n ' '\n +\n split_inchi_layers('/'.join(train_df.loc[idx, 'InChI'].split('/')[2:])\n )\n )",
"_____no_output_____"
],
[
"# save the train_df in a separate csv\ntrain_df.to_csv('../../../data/train_df.csv')",
"_____no_output_____"
],
[
"# create a tokenizer class\ntokenizer = Tokenizer()\n\n# create a vocabulary of all InChI tokens\ntokenizer.fit_on_texts(train_df['InChI_text'].values)\n\n# save the tokenizer\ntorch.save(tokenizer, '../../../data/tokenizer.pth')\n\n# store all sequence lengths\nlengths = []\n\n# creates a progress bar around the iterable\ntk = tqdm(train_df['InChI_text'].values, total=len(train_df))\n\n# for each text, i.e. InChI string, in the iterable, do\nfor text in tk:\n \n # convert text to sequence of characters\n seq = tokenizer.text_to_sequence(text)\n \n # update the caption length (reduced by 2 for <end> and <pad>) and append to the aggregated storage\n length = len(seq) - 2\n lengths.append(length)\n \n# write down the lengths in the dataframe\ntrain_df['InChI_length'] = lengths\n\n# save as a pickle file\ntrain_df.to_pickle('../../../data/train.pkl')\n\nprint('Saved the train dataframe as a pickle file.')",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
]
]
|
cb69248468ef66f3298ee2670666b07c61663dc5 | 21,809 | ipynb | Jupyter Notebook | prototyping/auto-segmentation/sb/00-stage-0-prototyping/04-mask-with-edge-falloff.ipynb | dg1an3/pymedphys | bdca9c783aae8b5e1f231e6cb0bc69895e4b9329 | [
"Apache-2.0"
]
| 2 | 2020-02-04T03:21:20.000Z | 2020-04-11T14:17:53.000Z | prototyping/auto-segmentation/sb/00-stage-0-prototyping/04-mask-with-edge-falloff.ipynb | SimonBiggs/pymedphys | 83f02eac6549ac155c6963e0a8d1f9284359b652 | [
"Apache-2.0"
]
| null | null | null | prototyping/auto-segmentation/sb/00-stage-0-prototyping/04-mask-with-edge-falloff.ipynb | SimonBiggs/pymedphys | 83f02eac6549ac155c6963e0a8d1f9284359b652 | [
"Apache-2.0"
]
| null | null | null | 28.886093 | 128 | 0.480077 | [
[
[
"import functools\nimport pathlib\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nimport shapely.geometry\nimport skimage.draw\n\nimport tensorflow as tf\n\nimport pydicom\n\nimport pymedphys\nimport pymedphys._dicom.structure as dcm_struct",
"_____no_output_____"
],
[
"# Put all of the DICOM data here, file structure doesn't matter:\ndata_path_root = pathlib.Path.home().joinpath('.data/dicom-ct-and-structures')\n\ndcm_paths = list(data_path_root.rglob('**/*.dcm'))",
"_____no_output_____"
],
[
"dcm_headers = []\n\nfor dcm_path in dcm_paths:\n dcm_headers.append(pydicom.read_file(\n dcm_path, force=True, specific_tags=['SOPInstanceUID', 'SOPClassUID']))",
"_____no_output_____"
],
[
"ct_image_paths = {\n header.SOPInstanceUID: path\n for header, path in zip(dcm_headers, dcm_paths)\n if header.SOPClassUID.name == \"CT Image Storage\"\n}",
"_____no_output_____"
],
[
"structure_set_paths = {\n header.SOPInstanceUID: path\n for header, path in zip(dcm_headers, dcm_paths)\n if header.SOPClassUID.name == \"RT Structure Set Storage\"\n}",
"_____no_output_____"
],
[
"# names = set()\n\n# for uid, path in structure_set_paths.items():\n# dcm = pydicom.read_file(\n# path, force=True, specific_tags=['StructureSetROISequence'])\n# for item in dcm.StructureSetROISequence:\n# names.add(item.ROIName)",
"_____no_output_____"
],
[
"names_map = {\n 'BB': \"bite_block\",\n 'Bladder': \"bladder\",\n \"Bladder_obj\": None,\n \"Bowel\": 'bowel',\n \"Bowel_obj\": None,\n \"Box Adapter\": None,\n \"BoxAdaptor\": None,\n \"Brain\": \"brain\",\n \"Brainstem\": \"brainstem\",\n \"brainstem\": \"brainstem\",\n \"Bulla Lt\": \"bulla_left\",\n \"L bulla\": \"bulla_left\",\n \"Bulla Rt\": \"bulla_right\",\n \"Bulla L\": \"bulla_left\",\n \"Bulla Left\": \"bulla_left\",\n \"Bulla R\": \"bulla_right\",\n \"Bulla Right\": \"bulla_right\",\n \"R bulla\": \"bulla_right\",\n \"CTV\": None,\n \"CTV Eval\": None,\n \"CTV thyroids\": None,\n \"CTVCT\": None,\n \"CTVMRI\": None,\n \"CTVSmall\": None,\n \"CTVeval\": None,\n \"CTVnew\": None,\n \"Chiasm\": \"chiasm\",\n \"Colon\": \"colon\",\n \"colon\": \"colon\",\n \"Colon_obj\": None,\n \"Cord\": \"spinal_cord\",\n \"SPINAL CORD\": \"spinal_cord\",\n \"Spinal Cord\": \"spinal_cord\",\n \"Cord PRV\": None,\n \"Couch Edge\": None,\n \"Couch Foam Half Couch\": None,\n \"Couch Outer Half Couch\": None,\n \"GTV\": None,\n \"24.000Gy\": None,\n \"15.000Gy_AH\": None,\n \"15.000Gy_NC\": None,\n \"15.000Gy_v\": None,\n \"30.000Gy_AH\": None,\n \"30.000Gy_NC\": None,\n \"30.000Gy_v\": None,\n \"95%_Large\": None,\n \"95.00%_SMALL\": None,\n \"BowelObj_Large\": None,\n \"BowelObj_small\": None,\n \"AdrenalGTV\": None,\n \"Bone_or\": None,\n \"BrainObj\": None,\n \"CTV1\": None,\n \"CTV_LN\": None,\n \"CTV_obj\": None,\n \"CTV_uncropped\": None,\n \"CTVmargin\": None,\n \"CTVmargin_eval\": None,\n \"CTVobj\": None,\n \"CTVobjnew\": None,\n \"CTVoptimise\": None,\n \"CTVoptimisenew\": None,\n \"Cauda equina\": \"cauda_equina\",\n \"GTV LN\": None,\n \"GTV thyroids\": None,\n \"GTV+SCAR\": None,\n \"GTV-2\": None,\n \"GTV/scar\": None,\n \"GTVCT\": None,\n \"GTVMRI\": None,\n \"GTV_Combined\": None,\n \"GTVcombined\": None,\n \"GTVobj\": None,\n \"GTVoptimise\": None,\n \"Heart\": \"heart\",\n \"Heart/GVs\": None,\n \"INGUINALobj\": None,\n \"Implant\": None,\n \"Implant_Avoid\": None,\n \"InguinalLn\": None,\n \"Kidney Lt\": \"kidney_left\",\n \"Lkidney\": \"kidney_left\",\n \"Kidney Rt\": \"kidney_right\",\n \"Rkidney\": \"kidney_right\",\n \"LN\": None,\n \"LN GTV\": None,\n \"LN Mandibular\": None,\n \"LN Retropharyngeal\": None,\n \"LNCTV\": None,\n \"LNeval\": None,\n \"Lacrimal Lt\": \"lacrimal_left\",\n \"Lacrimal Rt\": \"lacrimal_right\",\n \"Larynx\": \"larynx\",\n \"Larynx/trachea\": None,\n \"Liver\": \"liver\",\n \"Lung Lt\": \"lung_left\",\n \"Lung Left\": \"lung_left\",\n \"Lung Rt\": \"lung_right\",\n \"Lung_Combined\": None,\n \"Lung_L\": \"lung_left\",\n \"Lung_R\": \"lung_right\",\n \"Lung Right\": \"lung_right\",\n \"Oesophagus\": \"oesophagus\",\n \"Esophagus\": 'oesophagus',\n \"esophagus\": 'oesophagus',\n \"OD\": \"lens_right\",\n \"OD Lens\": \"lens_right\",\n \"Lens OD\": \"lens_right\",\n \"ODlens\": \"lens_right\",\n \"OS\": \"lens_left\",\n \"OS lens\": \"lens_left\",\n \"Lens OS\": \"lens_left\",\n \"OSlens\": \"lens_left\",\n \"OpPathPRV\": None,\n \"L optic N\": \"optic_nerve_left\",\n \"OpticNLeft\": \"optic_nerve_left\",\n \"LopticN\": \"optic_nerve_left\",\n \"OpticL\": \"optic_nerve_left\",\n \"Loptic\": \"optic_nerve_left\",\n \"OpticNRight\": \"optic_nerve_right\",\n \"OpticR\": \"optic_nerve_right\",\n \"R optic N\": \"optic_nerve_right\",\n \"Roptic\": \"optic_nerve_right\",\n \"RopticN\": \"optic_nerve_right\",\n \"PTV\": None,\n \"PTV LN eval\": None,\n \"PTV Prostate\": None,\n \"PTV bladder\": None,\n \"PTV crop\": None,\n \"PTV eval\": None,\n \"PTV nodes\": None,\n \"PTV thyroids\": None,\n \"PTV thyroid eval\": None,\n \"PTV uncropped\": None,\n \"PTV+2cm\": None,\n \"PTV+4cm\": None,\n \"PTV_Combined\": None,\n \"PTV_INGUINAL\": None,\n 'Pituitary': 'pituitary',\n \"Prostate\": 'prostate',\n \"prostate\": 'prostate',\n \"Rectum\": 'rectum',\n \"OpticPathway\": 'optic_pathway',\n \"Small Bowel\": \"small_bowel\",\n \"Spleen\": \"spleen\",\n \"Stomach\": \"stomach\",\n \"Thyroid\": \"thyroid\",\n \"Tongue\": \"tongue\",\n \"tongue\": \"tongue\",\n \"Trachea\": \"trachea\",\n \"trachea\": \"trachea\",\n \"Urethra\": \"urethra\",\n \"Vacbag\": \"vacuum_bag\",\n \"vacbag\": \"vacuum_bag\",\n \"patient\": \"patient\",\n \"testicles\": \"testicles\"\n}\n\nignore_list = [\n 'CTV start',\n 'CTV_Combined',\n 'ColonObj_large',\n 'ColonObj_small',\n 'CordPRV',\n 'CORDprv',\n 'Couch Foam Full Couch',\n 'Couch Outer Full Couch',\n 'Couch Parts Full Couch',\n 'LnCTV',\n 'LnGTV',\n 'Mand Ln',\n 'OpPathway',\n 'PTV Ln',\n 'PTV Ln PreSc',\n 'PTV total combined',\n 'PTVCombined_Large',\n 'PTVCombined_Small',\n 'PTVLarge',\n 'PTVSmall',\n 'PTV_Eval',\n 'PTV_LN',\n 'PTV_LN_15/2',\n 'PTV_LNeval',\n 'PTV_eval',\n 'PTV_eval_small',\n 'PTV_obj',\n 'PTVcombined',\n 'PTVcombined_15/2',\n 'PTVcombined_Eval',\n 'PTVeval',\n 'PTVeval_combined',\n 'PTVnew',\n 'PTVobj',\n 'PTVobjnew',\n 'PTVoptimise',\n 'PTVoptimisenew',\n 'PTVpituitary',\n 'PTVprimary',\n 'PTVsmooth',\n 'Patient small',\n 'Patient-bolus',\n 'R prescap Ln',\n 'Rectal_Syringe',\n 'RectumObj_large',\n 'RectumObj_small',\n 'Rectum_obj',\n 'RetroLn',\n 'CTVcombined',\n 'CTVlns',\n 'CTVprimary',\n 'CombinedLung',\n 'Cord-PTV',\n 'External',\n 'GTVscar',\n 'HeartCTV',\n 'HeartGTV',\n 'HeartPTV',\n 'Inguinal LnCTV',\n 'Inguinal+2cm',\n 'InguinalPTV_eval',\n 'Kidneys (Combined)',\n 'LN CTV',\n 'LN_PTV_eval',\n 'LN_ring',\n 'Lung',\n 'Lung total',\n 'LungGTV1',\n 'LungGTV2',\n 'LungGTV3',\n 'LungGTV4',\n 'LungGTV5',\n 'LungGTVMIP',\n 'LungPTV',\n 'MandiblePTV_eval',\n 'Mandible_ring',\n 'Nasal PTVeval',\n 'Nasal_ring',\n 'ODnew',\n 'OR_ Bone',\n 'OR_Metal',\n 'OR_Tissue',\n 'PTV Eval',\n 'PTVLn',\n 'PTV_Combined_eval',\n 'PTV_Distal',\n 'PTV_Distal_Crop',\n 'PTV_LN_Inguinal',\n 'PTV_LN_Popliteal',\n 'PTV_LN_Smooth',\n 'PTV_Sup',\n 'PTVdistal_eval',\n 'PTVsubSIB2mm',\n 'Popliteal LnCTV',\n 'Popliteal+2cm',\n 'SC_Olap',\n 'SC_Olap2',\n 'SC_Olapnew',\n 'SC_Olapnew2',\n 'SIB',\n 'Scar',\n 'Scar marker',\n 'Skin Spare',\n 'Skin Sparing',\n 'Skin spare',\n 'Small Bowel Replan',\n 'Small Bowel replan',\n 'SmallPTV',\n 'Small_PTV_Combined',\n 'Structure1',\n 'Structure2',\n 'Structure3',\n 'Structure4',\n 'Structure5',\n 'Syringe fill',\n 'TEST',\n 'Tissue_or',\n 'Tracheaoesophagus',\n 'Urethra/vulva',\n 'Urinary System',\n 'bolus_5mm',\n 'bowel_obj',\n 'brain-PTV',\n 'brain-ptv',\n 'combined PTV',\n 'ctv cropped',\n 'lungs',\n 'p',\n 'patient & bolus',\n 'patient no bolus',\n 'patient&Bolus',\n 'patient&bolus',\n 'patient-bolus',\n 'patient_1',\n 'patientbol',\n 'skin spare', \n 'urethra_PRV', \n 'whole lung'\n]\n\nfor key in ignore_list:\n names_map[key] = None",
"_____no_output_____"
],
[
"# mapped_names = set(names_map.keys())\n# print(mapped_names.difference(names))\n# names.difference(mapped_names)",
"_____no_output_____"
],
[
"set([item for key, item in names_map.items()]).difference({None})",
"_____no_output_____"
],
[
"# structure_uid = list(structure_set_paths.items())[0][0]\nstructure_uid = '1.2.840.10008.5.1.4.1.1.481.3.1574822743'",
"_____no_output_____"
],
[
"structure_set_path = structure_set_paths[structure_uid]\nstructure_set_path\n\nstructure_set = pydicom.read_file(\n structure_set_path, \n force=True, \n specific_tags=['ROIContourSequence', 'StructureSetROISequence'])",
"_____no_output_____"
],
[
"number_to_name_map = {\n roi_sequence_item.ROINumber: names_map[roi_sequence_item.ROIName]\n for roi_sequence_item in structure_set.StructureSetROISequence\n if names_map[roi_sequence_item.ROIName] is not None\n}\n\nnumber_to_name_map",
"_____no_output_____"
],
[
"contours_by_ct_uid = {}\n\nfor roi_contour_sequence_item in structure_set.ROIContourSequence:\n try:\n structure_name = number_to_name_map[roi_contour_sequence_item.ReferencedROINumber]\n except KeyError:\n continue\n \n for contour_sequence_item in roi_contour_sequence_item.ContourSequence:\n ct_uid = contour_sequence_item.ContourImageSequence[0].ReferencedSOPInstanceUID\n \n try:\n _ = contours_by_ct_uid[ct_uid]\n except KeyError:\n contours_by_ct_uid[ct_uid] = dict()\n \n try:\n contours_by_ct_uid[ct_uid][structure_name].append(contour_sequence_item.ContourData)\n except KeyError:\n contours_by_ct_uid[ct_uid][structure_name] = [contour_sequence_item.ContourData]",
"_____no_output_____"
],
[
"# ct_uid = list(contours_by_ct_uid.keys())[50]\nct_uid = '1.2.840.113704.1.111.2804.1556591059.12956'",
"_____no_output_____"
],
[
"ct_path = ct_image_paths[ct_uid]\ndcm_ct = pydicom.read_file(ct_path, force=True)\ndcm_ct.file_meta.TransferSyntaxUID = pydicom.uid.ImplicitVRLittleEndian",
"_____no_output_____"
],
[
"def get_image_transformation_parameters(dcm_ct):\n # From Matthew Coopers work in ../old/data_generator.py\n \n position = dcm_ct.ImagePositionPatient\n spacing = [x for x in dcm_ct.PixelSpacing] + [dcm_ct.SliceThickness]\n orientation = dcm_ct.ImageOrientationPatient\n\n dx, dy, *_ = spacing\n Cx, Cy, *_ = position\n Ox, Oy = orientation[0], orientation[4]\n \n return dx, dy, Cx, Cy, Ox, Oy\n",
"_____no_output_____"
],
[
"contours_by_ct_uid[ct_uid].keys()",
"_____no_output_____"
],
[
"organ = 'urethra'",
"_____no_output_____"
],
[
"original_contours = contours_by_ct_uid[ct_uid][organ]",
"_____no_output_____"
],
[
"def reduce_expanded_mask(expanded_mask, img_size, expansion):\n return np.mean(np.mean(\n tf.reshape(expanded_mask, (img_size, expansion, img_size, expansion)),\n axis=1), axis=2)",
"_____no_output_____"
],
[
"def calculate_aliased_mask(contours, dcm_ct, expansion=5):\n dx, dy, Cx, Cy, Ox, Oy = get_image_transformation_parameters(dcm_ct)\n \n ct_size = np.shape(dcm_ct.pixel_array)\n x_grid = np.arange(Cx, Cx + ct_size[0]*dx*Ox, dx*Ox)\n y_grid = np.arange(Cy, Cy + ct_size[1]*dy*Oy, dy*Oy)\n \n new_ct_size = np.array(ct_size) * expansion\n \n expanded_mask = np.zeros(new_ct_size)\n \n for xyz in contours:\n x = np.array(xyz[0::3])\n y = np.array(xyz[1::3])\n z = xyz[2::3]\n\n assert len(set(z)) == 1\n\n r = (((y - Cy) / dy * Oy)) * expansion + (expansion - 1) * 0.5\n c = (((x - Cx) / dx * Ox)) * expansion + (expansion - 1) * 0.5\n\n expanded_mask = np.logical_or(expanded_mask, skimage.draw.polygon2mask(new_ct_size, np.array(list(zip(r, c)))))\n \n mask = reduce_expanded_mask(expanded_mask, ct_size[0], expansion)\n mask = 2 * mask - 1\n \n return x_grid, y_grid, mask",
"_____no_output_____"
],
[
"def get_contours_from_mask(x_grid, y_grid, mask):\n cs = plt.contour(x_grid, y_grid, mask, [0]);\n \n contours = [\n path.vertices for path in cs.collections[0].get_paths()\n ]\n \n plt.close()\n \n return contours",
"_____no_output_____"
],
[
"x_grid, y_grid, mask_with_aliasing = calculate_aliased_mask(original_contours, dcm_ct)\n_, _, mask_without_aliasing = calculate_aliased_mask(original_contours, dcm_ct, expansion=1)",
"_____no_output_____"
],
[
"contours_with_aliasing = get_contours_from_mask(x_grid, y_grid, mask_with_aliasing)\ncontours_without_aliasing = get_contours_from_mask(x_grid, y_grid, mask_without_aliasing)",
"_____no_output_____"
],
[
"plt.figure(figsize=(10,10))\n\nfor xyz in original_contours:\n x = np.array(xyz[0::3])\n y = np.array(xyz[1::3])\n \n plt.plot(x, y)\n \nplt.axis('equal') ",
"_____no_output_____"
],
[
"plt.figure(figsize=(10,10))\n\nfor contour in contours_with_aliasing:\n plt.plot(contour[:,0], contour[:,1])\n plt.plot(contour[:,0], contour[:,1])\n\nplt.axis('equal')",
"_____no_output_____"
],
[
"plt.figure(figsize=(10,10))\n\nfor contour in contours_with_aliasing:\n plt.plot(contour[:,0], contour[:,1])\n plt.plot(contour[:,0], contour[:,1])\n\nfor xyz in original_contours:\n x = np.array(xyz[0::3])\n y = np.array(xyz[1::3])\n \n plt.plot(x, y)\n \nplt.axis('equal') ",
"_____no_output_____"
],
[
"plt.figure(figsize=(10,10))\n\nfor contour in contours_without_aliasing:\n plt.plot(contour[:,0], contour[:,1])\n plt.plot(contour[:,0], contour[:,1])\n\nplt.axis('equal')",
"_____no_output_____"
],
[
"plt.figure(figsize=(10,10))\n\nfor contour in contours_without_aliasing:\n plt.plot(contour[:,0], contour[:,1])\n plt.plot(contour[:,0], contour[:,1])\n\nfor xyz in original_contours:\n x = np.array(xyz[0::3])\n y = np.array(xyz[1::3])\n \n plt.plot(x, y)\n \nplt.axis('equal') ",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb69258a10a0676a1d7d16bb61719305a93f2ea6 | 59,048 | ipynb | Jupyter Notebook | Conditional_GAN.ipynb | fracogno/Conditional_GAN | af6c9acf2f1385913c81fe6a2623d09188b73a8e | [
"MIT"
]
| 1 | 2019-01-17T13:02:06.000Z | 2019-01-17T13:02:06.000Z | Conditional_GAN.ipynb | fracogno/Conditional_GAN | af6c9acf2f1385913c81fe6a2623d09188b73a8e | [
"MIT"
]
| null | null | null | Conditional_GAN.ipynb | fracogno/Conditional_GAN | af6c9acf2f1385913c81fe6a2623d09188b73a8e | [
"MIT"
]
| null | null | null | 87.738484 | 23,124 | 0.74221 | [
[
[
"import numpy as np\nimport tensorflow as tf\nimport matplotlib.pyplot as plt\nfrom keras.datasets import mnist",
"_____no_output_____"
],
[
"(x_train, y_train), _ = mnist.load_data()\nx_train = x_train / 255.0\n\nx_train = np.expand_dims(x_train, axis=3)\n\nprint(x_train.shape)\nprint(y_train.shape)\n\nnum_classes = 10",
"(60000, 28, 28, 1)\n(60000,)\n"
],
[
"plt.imshow(np.squeeze(x_train[10]))\nplt.show()\nprint(y_train[10])",
"_____no_output_____"
],
[
"'''def generator(z, y, reuse=False, verbose=True):\n \n with tf.variable_scope(\"generator\", reuse=reuse):\n # Concatenate noise and conditional one-hot variable\n inputs = tf.concat([z, y], 1)\n\n # FC layer\n fc1 = tf.layers.dense(inputs=inputs, units= 7 * 7 * 128, activation=tf.nn.leaky_relu)\n\n reshaped = tf.reshape(fc1, shape=[-1, 7, 7, 128])\n\n upconv1 = tf.layers.conv2d_transpose(inputs=reshaped,\n filters=32,\n kernel_size=[5,5],\n kernel_initializer=tf.truncated_normal_initializer(stddev=0.1),\n strides=[2,2],\n activation=tf.nn.leaky_relu,\n padding='same', \n name='upscore1')\n \n upconv2 = tf.layers.conv2d_transpose(inputs=upconv1,\n filters=1,\n kernel_size=[3,3],\n kernel_initializer=tf.truncated_normal_initializer(stddev=0.1),\n strides=[2,2],\n activation=None,\n padding='same', \n name='upscore2')\n \n prob = tf.nn.sigmoid(upconv2)\n \n if verbose:\n print(\"\\nGenerator:\")\n print(inputs)\n print(fc1)\n print(reshaped)\n print(upconv1)\n print(upconv2)\n \n return prob\n\n\ndef discriminator(x, y, reuse=False, verbose=True):\n \n with tf.variable_scope(\"discriminator\", reuse=reuse): \n \n conv1 = tf.layers.conv2d(inputs=x, \n filters=64, \n kernel_size=[5,5], \n kernel_initializer=tf.truncated_normal_initializer(stddev=0.1),\n strides=[1,1], \n activation=tf.nn.leaky_relu, \n padding='same', \n name='Conv1')\n \n pool1 = tf.layers.max_pooling2d(inputs=conv1, \n pool_size=[2,2], \n strides=[2,2], \n padding='same', \n name='Pool1')\n \n \n conv2 = tf.layers.conv2d(inputs=pool1, \n filters=32, \n kernel_size=[3,3], \n kernel_initializer=tf.truncated_normal_initializer(stddev=0.1),\n strides=[2,2], \n activation=tf.nn.leaky_relu, \n padding='same', \n name='Conv2')\n \n pool2 = tf.layers.max_pooling2d(inputs=conv2, \n pool_size=[2,2], \n strides=[2,2], \n padding='same', \n name='Pool2')\n\n flattened = tf.layers.flatten(pool2)\n concatened = tf.concat([flattened, y], 1)\n fc1 = tf.layers.dense(inputs=concatened, units=256, activation=tf.nn.leaky_relu)\n fc2 = tf.layers.dense(inputs=fc1, units=1, activation=None)\n prob = tf.nn.sigmoid(fc2)\n \n if verbose:\n print(\"\\nDiscriminator:\")\n print(conv1)\n print(pool1)\n print(conv2)\n print(pool2)\n print(flattened)\n print(concatened)\n print(fc1)\n print(fc2)\n \n return prob, fc2'''",
"_____no_output_____"
],
[
"def sample_Z(batch_size, img_size):\n # Sample noise for generator\n return np.random.uniform(-1., 1., size=[batch_size, img_size])\n\n\ndef one_hot(batch_size, num_classes, labels):\n assert(batch_size == len(labels))\n y_one_hot = np.zeros(shape=[batch_size, num_classes])\n y_one_hot[np.arange(batch_size), labels] = 1\n \n return y_one_hot",
"_____no_output_____"
],
[
"def generator(z, y, reuse=False, verbose=True):\n \n with tf.variable_scope(\"generator\", reuse=reuse):\n inputs = tf.concat([z, y], 1)\n \n fc1 = tf.layers.dense(inputs=inputs, units=256, activation=tf.nn.leaky_relu)\n fc2 = tf.layers.dense(inputs=fc1, units=784, activation=None)\n logits = tf.nn.sigmoid(fc2)\n \n if verbose:\n print(\"\\nGenerator:\")\n print(inputs)\n print(fc1)\n print(fc2)\n \n return logits\n\n\ndef discriminator(x, y, reuse=False, verbose=True):\n \n with tf.variable_scope(\"discriminator\", reuse=reuse):\n inputs = tf.concat([x, y], 1)\n fc1 = tf.layers.dense(inputs=inputs, units=256, activation=tf.nn.leaky_relu)\n fc2 = tf.layers.dense(inputs=fc1, units=1, activation=None)\n prob = tf.nn.sigmoid(fc2)\n \n if verbose:\n print(\"\\nDiscriminator:\")\n print(inputs)\n print(fc1)\n print(fc2)\n \n return prob, fc2",
"_____no_output_____"
],
[
"tf.reset_default_graph()\n\n# Discriminator input\n#X = tf.placeholder(tf.float32, shape=[None, x_train.shape[1], x_train.shape[2], 1], name='X')\nX = tf.placeholder(tf.float32, shape=[None, x_train.shape[1] * x_train.shape[2] * 1], name='X')\n\n# Generator noise input\nZ_dim = 100\nZ = tf.placeholder(tf.float32, shape=[None, Z_dim], name='Z')\n\n# Generator conditional\nY = tf.placeholder(tf.float32, shape=[None, num_classes], name='Y')\n\n# Print shapes\nprint(\"Inputs:\")\nprint(\"Discriminator input: \" + str(X))\nprint(\"Conditional variable: \" + str(Y))\nprint(\"Generator input noise: \" + str(Z))\n\n# Networks\ngen_sample = generator(Z, Y)\nD_real, D_logit_real = discriminator(X, Y)\nD_fake, D_logit_fake = discriminator(gen_sample, Y, reuse=True, verbose=False)",
"Inputs:\nDiscriminator input: Tensor(\"X:0\", shape=(?, 784), dtype=float32)\nConditional variable: Tensor(\"Y:0\", shape=(?, 10), dtype=float32)\nGenerator input noise: Tensor(\"Z:0\", shape=(?, 100), dtype=float32)\n\nGenerator:\nTensor(\"generator/concat:0\", shape=(?, 110), dtype=float32)\nTensor(\"generator/dense/LeakyRelu:0\", shape=(?, 256), dtype=float32)\nTensor(\"generator/dense_1/BiasAdd:0\", shape=(?, 784), dtype=float32)\n\nDiscriminator:\nTensor(\"discriminator/concat:0\", shape=(?, 794), dtype=float32)\nTensor(\"discriminator/dense/LeakyRelu:0\", shape=(?, 256), dtype=float32)\nTensor(\"discriminator/dense_1/BiasAdd:0\", shape=(?, 1), dtype=float32)\n"
]
],
[
[
"## Theoretical remark",
"_____no_output_____"
],
[
"### Binary cross entropy loss\n\\begin{equation*}\nL(\\theta) = - \\frac{1}{n} \\sum_{i=1}^n [y_i log(p_i) + (1 - y_i) log(1 - p_i)]\n\\end{equation*}\n\n- Discriminator final probability is 1 => REAL IMAGE\n- Discriminator final probability is 0 => FAKE IMAGE\n\nLog values:\n- Log(1) => Loss would be 0\n- Log(0+) => Loss would be to - ∞\n\n### Generator:\n\nMaximize D(G(z))\n\n\n### Discriminator:\n\nMaximize D(x) AND minimize D(G(z))",
"_____no_output_____"
]
],
[
[
"# Losses have minus sign because I have to maximize them\nD_loss = - tf.reduce_mean( tf.log(D_real) + tf.log(1. - D_fake) )\nG_loss = - tf.reduce_mean( tf.log(D_fake) )\n\n# Optimizers\nD_var = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='discriminator')\nD_optimizer = tf.train.AdamOptimizer(learning_rate=0.0005).minimize(D_loss, var_list=D_var)\n\nG_var = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='generator')\nG_optimizer = tf.train.AdamOptimizer(learning_rate=0.0005).minimize(G_loss, var_list=G_var)",
"_____no_output_____"
]
],
[
[
"## Training of the generator and discriminator network",
"_____no_output_____"
]
],
[
[
"batch_size = 64\n\nwith tf.Session() as sess:\n\n # Run the initializer\n saver = tf.train.Saver()\n sess.run(tf.global_variables_initializer())\n \n # Epochs\n for n in range(30):\n print(\"Epoch \" + str(n+1))\n \n for i in range(len(x_train) // batch_size):\n \n X_tmp = np.reshape(x_train[i*batch_size:(i+1)*batch_size], (batch_size, -1))\n #X_tmp = x_train[i*batch_size:(i+1)*batch_size]\n \n sampled_noise = sample_Z(batch_size, Z_dim)\n one_hot_sampled = one_hot(batch_size, num_classes, y_train[i*batch_size:(i+1)*batch_size])\n \n _, D_loss_val = sess.run([D_optimizer, D_loss], feed_dict={X: X_tmp, \n Y: one_hot_sampled,\n Z: sampled_noise})\n\n _, G_loss_val = sess.run([G_optimizer, G_loss], feed_dict={Y: one_hot_sampled,\n Z: sampled_noise})\n \n if i % 300 == 0:\n print(str(D_loss_val) + \" \" + str(G_loss_val))\n save_path = saver.save(sess, \"./checkpoints/model.ckpt\")",
"Epoch 1\n0.95421404 2.7137277\n0.16300228 4.1718526\n0.013767928 5.6764627\n0.013310271 6.8244886\nEpoch 2\n0.006558732 8.058235\n0.0042580855 10.943196\n0.0054634595 8.849958\n0.04933323 3.9225428\nEpoch 3\n0.20747188 4.1831617\n0.026214357 8.469037\n0.04072192 7.346262\n0.031122517 5.530775\nEpoch 4\n0.046090726 5.11003\n0.10653249 6.1811914\n0.17848419 4.4241347\n0.08084142 4.8053803\nEpoch 5\n0.23476085 5.18079\n0.07258764 5.5152216\n0.059076965 5.4870343\n0.06739945 5.7131615\nEpoch 6\n0.014707347 8.53326\n0.061251864 6.100748\n0.046907976 5.397523\n0.050764 6.3975506\nEpoch 7\n0.12136417 6.4027653\n0.11473328 5.735597\n0.12664294 5.3891563\n0.21780637 5.6415553\nEpoch 8\n0.16854784 6.121756\n0.16422081 4.4690456\n0.12301879 5.350264\n0.16067845 4.7910204\nEpoch 9\n0.22020595 5.8412743\n0.20873132 3.664666\n0.23085178 4.1530704\n0.2533369 4.857728\nEpoch 10\n0.24765852 4.557816\n0.22004695 3.4729404\n0.2738728 4.0640154\n0.40452164 4.2124043\nEpoch 11\n0.3247204 3.8793058\n0.41095752 3.597\n0.470631 2.990757\n0.470249 2.769702\nEpoch 12\n0.4585572 3.290328\n0.44131833 3.5321622\n0.449372 2.8683414\n0.41017365 2.880132\nEpoch 13\n0.46287364 3.1273148\n0.43746972 2.8026934\n0.4182534 2.9048421\n0.51053816 3.5538886\nEpoch 14\n0.51813316 3.352604\n0.41244042 2.688943\n0.4439724 2.6302154\n0.5396354 3.5026073\nEpoch 15\n0.5260041 2.417328\n0.48333907 3.2186046\n0.41663694 3.8180304\n0.5617603 3.5638638\nEpoch 16\n0.44995552 2.9590058\n0.51086545 2.5292003\n0.41565672 3.0935984\n0.54793745 3.145947\nEpoch 17\n0.72692466 2.1899939\n0.80327255 2.0908456\n0.60116035 3.2365272\n0.51467735 2.7812507\nEpoch 18\n0.42777276 2.6575816\n0.43597516 2.9297204\n0.63173753 2.6818922\n0.45614332 3.1636071\nEpoch 19\n0.6495122 3.1494155\n0.4465957 2.3796701\n0.50720423 2.1689343\n0.4916851 2.8152337\nEpoch 20\n0.51391214 2.6834903\n0.534864 2.8063793\n0.54428625 2.5500538\n0.50708604 2.8288333\nEpoch 21\n0.649691 2.5629652\n0.49599117 3.0103395\n0.50717974 2.4034843\n0.51282674 3.0892022\nEpoch 22\n0.64791065 2.2763448\n0.41610396 3.06706\n0.5095854 2.1509743\n0.43552715 2.736646\nEpoch 23\n0.5028825 2.349042\n0.5256474 2.818008\n0.71356356 2.1300406\n0.54162276 2.7645075\nEpoch 24\n0.6501664 2.8713064\n0.38340417 2.6284382\n0.62390625 2.049768\n0.5201373 2.7279048\nEpoch 25\n0.6313869 2.3506942\n0.5935847 2.646382\n0.46828043 2.7511795\n0.4332309 2.8218865\nEpoch 26\n0.72029173 1.9618573\n0.47048056 2.8291447\n0.50303066 2.4152875\n0.46554768 2.657115\nEpoch 27\n0.7475612 1.990246\n0.6741786 2.9049273\n0.59012496 2.116159\n0.60404503 2.9997172\nEpoch 28\n0.6444097 2.197825\n0.6950371 2.2540197\n0.6491702 1.9789178\n0.45835873 2.8133078\nEpoch 29\n0.78513944 2.2246947\n0.46310037 2.607898\n0.6105846 2.2612214\n0.689813 2.2617636\nEpoch 30\n0.82628155 1.8768739\n0.592319 2.2971644\n0.73581344 2.1264715\n0.6310841 2.716111\n"
]
],
[
[
"## Generate images with constraint (Y)",
"_____no_output_____"
]
],
[
[
"generate_number = 9\n\nwith tf.Session() as sess:\n \n saver = tf.train.Saver()\n sess.run(tf.global_variables_initializer())\n saver.restore(sess, \"./checkpoints/model.ckpt\")\n \n sampled_noise = sample_Z(1, Z_dim)\n one_hot_sampled = one_hot(1, num_classes, [generate_number])\n \n generated = sess.run(gen_sample, feed_dict={Y: one_hot_sampled, \n Z: sampled_noise})\n img_generated = np.reshape(generated, (28, 28))\n \n plt.imshow(img_generated)\n plt.show()",
"INFO:tensorflow:Restoring parameters from ./checkpoints/model.ckpt\n"
],
[
"fig, axes = plt.subplots(4, 4)\nfig.subplots_adjust(hspace=0.1)\n\nwith tf.Session() as sess:\n \n saver = tf.train.Saver()\n sess.run(tf.global_variables_initializer())\n saver.restore(sess, \"./checkpoints/model.ckpt\")\n \n for i, ax in enumerate(axes.flat):\n generate_number = int(i / 4)\n sampled_noise = sample_Z(1, Z_dim)\n one_hot_sampled = one_hot(1, num_classes, [generate_number])\n\n generated = sess.run(gen_sample, feed_dict={Y: one_hot_sampled, \n Z: sampled_noise})\n img_generated = np.reshape(generated, (28, 28))\n\n ax.imshow(img_generated) \n ax.set_xticks([])\n ax.set_yticks([])\n\n plt.show()",
"INFO:tensorflow:Restoring parameters from ./checkpoints/model.ckpt\n"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb69286a76cf898487ab323d48a8a3b73b0d98e7 | 193,772 | ipynb | Jupyter Notebook | notebooks/pbpstats_exploration.ipynb | matteosox/nba | e993bd1167242fd18355bbf78a8d8245978ab3a2 | [
"Apache-2.0"
]
| 4 | 2021-11-05T15:02:49.000Z | 2021-12-19T14:06:02.000Z | notebooks/pbpstats_exploration.ipynb | matteosox/nba | e993bd1167242fd18355bbf78a8d8245978ab3a2 | [
"Apache-2.0"
]
| 17 | 2021-04-04T05:22:19.000Z | 2022-03-08T06:26:22.000Z | notebooks/pbpstats_exploration.ipynb | matteosox/nba | e993bd1167242fd18355bbf78a8d8245978ab3a2 | [
"Apache-2.0"
]
| null | null | null | 39.051189 | 170 | 0.379962 | [
[
[
"import os\n\nimport pandas as pd\nfrom pbpstats.client import Client\n\nfrom pynba.config import config\n\n\nSETTINGS = {\n \"dir\": os.path.join(config.local_data_directory, config.pbpstats_directory),\n \"Boxscore\": {\"source\": \"file\", \"data_provider\": \"stats_nba\"},\n \"EnhancedPbp\": {\"source\": \"file\", \"data_provider\": \"stats_nba\"},\n \"Games\": {\"source\": \"file\", \"data_provider\": \"stats_nba\"},\n \"Pbp\": {\"source\": \"file\", \"data_provider\": \"stats_nba\"},\n \"Possessions\": {\"source\": \"file\", \"data_provider\": \"stats_nba\"},\n \"Shots\": {\"source\": \"file\", \"data_provider\": \"stats_nba\"},\n}\nclient = Client(SETTINGS)",
"_____no_output_____"
],
[
"season = client.Season(\"nba\", \"2019-20\", \"Regular Season\")\nseason_data = pd.DataFrame(season.games.final_games)\nseason_data",
"_____no_output_____"
],
[
"game_id = season.games.final_games[-1]['game_id']\ngame = client.Game(game_id)\nboxscore = game.boxscore\nteams_boxscore_data = pd.DataFrame(boxscore.team_items)\nteams_boxscore_data",
"_____no_output_____"
],
[
"players_boxscore_data = pd.DataFrame(boxscore.player_items)\nplayers_boxscore_data",
"_____no_output_____"
],
[
"shots = game.shots\nshots_data = pd.DataFrame(shots.data)\nshots_data",
"_____no_output_____"
],
[
"possessions = game.possessions\nteam_stats_data = pd.DataFrame(possessions.team_stats)\nteam_stats_data",
"_____no_output_____"
],
[
"player_stats_data = pd.DataFrame(possessions.player_stats)\nplayer_stats_data",
"_____no_output_____"
],
[
"lineup_stats_data = pd.DataFrame(possessions.lineup_stats)\nlineup_stats_data",
"_____no_output_____"
],
[
"lineup_opponent_stats_data = pd.DataFrame(possessions.lineup_opponent_stats)\nlineup_opponent_stats_data",
"_____no_output_____"
],
[
"possession = possessions.items[0]\npossession_stats_data = pd.DataFrame(possession.possession_stats)\npossession_stats_data",
"_____no_output_____"
],
[
"possession_data = possession.data\npossession_data",
"_____no_output_____"
],
[
"event = possession.events[-1]\nevent_stats_data = pd.DataFrame(event.event_stats)\nevent_stats_data",
"_____no_output_____"
],
[
"event_base_stats_data = pd.DataFrame(event.base_stats)\nevent_base_stats_data",
"_____no_output_____"
],
[
"event_data = event.data\nevent_data",
"_____no_output_____"
],
[
"event_shot_data = event.shot_data\nevent_shot_data",
"_____no_output_____"
],
[
"pbp = game.pbp\npbp_data = pd.DataFrame(pbp.data)\npbp_data",
"_____no_output_____"
],
[
"pbp_item = pbp.items[0]\npbp_item_data = pbp_item.data\npbp_item_data",
"_____no_output_____"
],
[
"enhanced_pbp = game.enhanced_pbp\nenhanced_pbp_data = pd.DataFrame(enhanced_pbp.data)\nenhanced_pbp_data",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb692a769f8546d041a4316d85c0e4bea5d97431 | 285,735 | ipynb | Jupyter Notebook | datasets/hrea/hrea-example.ipynb | ianthomas23/PlanetaryComputerExamples | 490f353c95ef2de48374c45818e35aef90cf424a | [
"MIT"
]
| 112 | 2021-04-15T19:58:38.000Z | 2022-03-30T18:00:31.000Z | datasets/hrea/hrea-example.ipynb | ruiduobao/PlanetaryComputerExamples | 2296dfbd4824f840954b07dcb85ce1b8c6f4e628 | [
"MIT"
]
| 61 | 2021-04-19T13:55:30.000Z | 2022-03-31T23:52:48.000Z | datasets/hrea/hrea-example.ipynb | ruiduobao/PlanetaryComputerExamples | 2296dfbd4824f840954b07dcb85ce1b8c6f4e628 | [
"MIT"
]
| 54 | 2021-04-19T20:37:46.000Z | 2022-03-28T19:47:09.000Z | 667.60514 | 135,076 | 0.951777 | [
[
[
"## Accessing High Resolution Electricity Access (HREA) data with the Planetary Computer STAC API\n\nThe HREA project aims to provide open access to new indicators of electricity access and reliability across the world. Leveraging VIIRS satellite imagery with computational methods, these high-resolution data provide new tools to track progress towards reliable and sustainable energy access across the world.\n\nThis notebook provides an example of accessing HREA data using the Planetary Computer STAC API.",
"_____no_output_____"
],
[
"### Environment setup\n\nThis notebook works with or without an API key, but you will be given more permissive access to the data with an API key. The Planetary Computer Hub is pre-configured to use your API key.",
"_____no_output_____"
]
],
[
[
"import matplotlib.colors as colors\nimport matplotlib.pyplot as plt\nimport planetary_computer as pc\nimport rasterio\nimport rioxarray\n\nfrom pystac_client import Client\nfrom rasterio.plot import show",
"_____no_output_____"
]
],
[
[
"### Selecting a region and querying the API\n\nThe HREA dataset covers all of Africa as well as Ecuador. Let's pick up an area of interest that covers Djibouti and query the Planetary Computer API for data coverage for the year 2019.",
"_____no_output_____"
]
],
[
[
"area_of_interest = {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [41.693115234375, 10.865675826639414],\n [43.275146484375, 10.865675826639414],\n [43.275146484375, 12.554563528593656],\n [41.693115234375, 12.554563528593656],\n [41.693115234375, 10.865675826639414],\n ]\n ],\n}",
"_____no_output_____"
],
[
"catalog = Client.open(\"https://planetarycomputer.microsoft.com/api/stac/v1\")\n\nsearch = catalog.search(\n collections=[\"hrea\"], intersects=area_of_interest, datetime=\"2019-12-31\"\n)\n\n# Check how many items were returned, there could be more pages of results as well\nitems = [pc.sign(item) for item in search.get_items()]\nprint(f\"Returned {len(items)} Items\")",
"Returned 3 Items\n"
]
],
[
[
"We found 3 items for our search. We'll grab jsut the one for Djibouti and see what data assets are available on it.",
"_____no_output_____"
]
],
[
[
"(item,) = [x for x in items if \"Djibouti\" in x.id]\ndata_assets = [\n f\"{key}: {asset.title}\"\n for key, asset in item.assets.items()\n if \"data\" in asset.roles\n]\n\nprint(*data_assets, sep=\"\\n\")",
"lightscore: Probability of electrification\nlight-composite: Nighttime light annual composite\nnight-proportion: Proportion of nights a settlement is brighter than uninhabited areas\nestimated-brightness: Estimated brightness levels\n"
]
],
[
[
"### Plotting the data\n\nLet's pick the variable `light-composite`, and read in the entire GeoTIFF to plot.",
"_____no_output_____"
]
],
[
[
"light_comp_asset = item.assets[\"light-composite\"]\ndata_array = rioxarray.open_rasterio(light_comp_asset.href)\n\nfig, ax = plt.subplots(1, 1, figsize=(14, 7), dpi=100)\nshow(\n data_array,\n ax=ax,\n norm=colors.PowerNorm(1, vmin=0.01, vmax=1.4),\n cmap=\"magma\",\n title=\"Djibouti (2019)\",\n)\nplt.axis(\"off\")\nplt.show()",
"_____no_output_____"
]
],
[
[
"### Read a window\n\nCloud Optimized GeoTIFFs (COGs) allows us to effeciently download and read sections of a file, rather than the entire file, when only part of the region is required. The COGs are stored on disk with an internal set of windows. You can read sections of any shape and size, but reading them in the file-defined window size is most efficient. Let's read the same asset, but this time only request the second window. ",
"_____no_output_____"
]
],
[
[
"# Reading only the second window of the file, as an example\ni_window = 2\nwith rasterio.open(light_comp_asset.href) as src:\n windows = list(src.block_windows())\n print(\"Available windows:\", *windows, sep=\"\\n\")\n _, window = windows[i_window]\n section = data_array.rio.isel_window(window)\n\nfig, xsection = plt.subplots(1, 1, figsize=(14, 7))\nshow(\n section,\n ax=xsection,\n norm=colors.PowerNorm(1, vmin=0.01, vmax=1.4),\n cmap=\"magma\",\n title=\"Reading a single window\",\n)\nplt.axis(\"off\")\nplt.show()",
"Available windows:\n((0, 0), Window(col_off=0, row_off=0, width=256, height=256))\n((0, 1), Window(col_off=256, row_off=0, width=142, height=256))\n((1, 0), Window(col_off=0, row_off=256, width=256, height=165))\n((1, 1), Window(col_off=256, row_off=256, width=142, height=165))\n"
]
],
[
[
"### Zoom in on a region within the retrieved window\n\nLet's plot the region around the city of Dikhil, situated within that second data window, around this bounding box (in x/y coordinates, which is latitude / longitude):\n\n```\n(42.345868941491204, 11.079694223371735, 42.40420227530527, 11.138027557181712)\n```",
"_____no_output_____"
]
],
[
[
"fig, xsection = plt.subplots(1, 1, figsize=(14, 7))\nshow(\n section.sel(\n x=slice(42.345868941491204, 42.40420227530527),\n y=slice(11.138027557181712, 11.079694223371735),\n ),\n ax=xsection,\n norm=colors.PowerNorm(1, vmin=0.01, vmax=1.4),\n cmap=\"magma\",\n title=\"Dikhil (2019)\",\n)\nplt.axis(\"off\")\nplt.show()",
"_____no_output_____"
]
],
[
[
"### Plot change over time\n\nThe HREA dataset goes back several years. Let's search again for the same area, but this time over a longer temporal span.",
"_____no_output_____"
]
],
[
[
"search = catalog.search(\n collections=[\"hrea\"], intersects=area_of_interest, datetime=\"2012-12-31/2019-12-31\"\n)\n\nitems = [\n pc.sign(item).to_dict() for item in search.get_items() if \"Djibouti\" in item.id\n]\nprint(f\"Returned {len(items)} Items:\")",
"Returned 8 Items:\n"
]
],
[
[
"We got 8 items this time, each corresponding to single year. To plot the change of light intensity over time, we'll open the same asset on each of these year-items and read in the window with Dikhil. Since we're using multiple items, we'll use `stackstac` to stack them together into a single DataArray for us.",
"_____no_output_____"
]
],
[
[
"import stackstac\n\nbounds_latlon = (\n 42.345868941491204,\n 11.079694223371735,\n 42.40420227530527,\n 11.138027557181712,\n)\ndikhil = (\n stackstac.stack(items, assets=[\"light-composite\"], bounds_latlon=bounds_latlon)\n .squeeze()\n .compute()\n .quantile(0.9, dim=[\"y\", \"x\"])\n)",
"_____no_output_____"
],
[
"fig, ax = plt.subplots(figsize=(12, 6))\n\ndikhil.plot(ax=ax)\n\nax.set(title=\"Dikhil composite light output\", ylabel=\"Annual light output, normalize\");",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb692f34e1fab777064548af1999156e1c9cd52b | 1,006 | ipynb | Jupyter Notebook | 2021 Осенний семестр/Практическое задание 4_5/Севастьянов_Задание_4_5_1.ipynb | mosalov/Notebook_For_AI_Main | a693d29bf0bdcf824cb4f1eca86ff54b67ba7428 | [
"MIT"
]
| 6 | 2021-09-20T10:28:18.000Z | 2022-03-14T18:39:17.000Z | 2021 Осенний семестр/Практическое задание 4_5/Севастьянов_Задание_4_5_1.ipynb | mosalov/Notebook_For_AI_Main | a693d29bf0bdcf824cb4f1eca86ff54b67ba7428 | [
"MIT"
]
| 122 | 2020-09-07T11:57:57.000Z | 2022-03-22T06:47:03.000Z | 2021 Осенний семестр/Практическое задание 4_5/Севастьянов_Задание_4_5_1.ipynb | mosalov/Notebook_For_AI_Main | a693d29bf0bdcf824cb4f1eca86ff54b67ba7428 | [
"MIT"
]
| 97 | 2020-09-07T11:32:19.000Z | 2022-03-31T10:27:38.000Z | 1,006 | 1,006 | 0.617296 | [
[
[
"import numpy\nimport pandas\nimport matplotlib.pyplot\nx = numpy.ones((4,4))\ni = 0\nwhile i < 4:\n j = 0\n while j < 4:\n x[i][j]=5\n j += 1\n i += 1\nx = x.reshape((2,8))\nx",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code"
]
]
|
cb693bcb1222bba1db497adf3968947d1019e263 | 74,808 | ipynb | Jupyter Notebook | jupyter/Magic Keywords.ipynb | awwong1/nd101 | ec9163fb9ff00234d7368f525b35a58384405e89 | [
"MIT"
]
| null | null | null | jupyter/Magic Keywords.ipynb | awwong1/nd101 | ec9163fb9ff00234d7368f525b35a58384405e89 | [
"MIT"
]
| null | null | null | jupyter/Magic Keywords.ipynb | awwong1/nd101 | ec9163fb9ff00234d7368f525b35a58384405e89 | [
"MIT"
]
| null | null | null | 292.21875 | 69,044 | 0.919968 | [
[
[
"from math import sqrt\n\ndef fibo1(n): # Recursive Fibonacci number\n if n == 0:\n return 0\n elif n == 1:\n return 1\n return fibo1(n-1) + fibo1(n-2)\n\ndef fibo2(n): # Closed Form\n return ((1+sqrt(5))**n-(1-sqrt(5))**n)/(2**n*sqrt(5))",
"_____no_output_____"
],
[
"%timeit fibo1(20)",
"100 loops, best of 3: 3.55 ms per loop\n"
],
[
"%timeit fibo2(20)",
"The slowest run took 14.23 times longer than the fastest. This could mean that an intermediate result is being cached.\n1000000 loops, best of 3: 921 ns per loop\n"
],
[
"import random",
"_____no_output_____"
],
[
"%%timeit\nprize = 0\nfor ii in range(100):\n # roll a die\n roll = random.randint(1, 6)\n if roll % 2 == 0:\n prize += roll\n else:\n prize -= 1",
"10000 loops, best of 3: 152 µs per loop\n"
],
[
"%%timeit\nrolls = (random.randint(1, 6) for _ in range(100))\nprize = sum(roll if roll % 2 == 0 else -1 for roll in rolls)",
"10000 loops, best of 3: 158 µs per loop\n"
]
],
[
[
"# Matplotlib visualizations!",
"_____no_output_____"
]
],
[
[
"%matplotlib inline\n%config InlineBackend.figure_format = 'retina'\n\nimport matplotlib.pyplot as plt\nimport numpy as np",
"_____no_output_____"
],
[
"x = np.linspace(0, 1, 300)\nfor w in range(2, 6, 2):\n plt.plot(x, np.sin(np.pi*x) * np.sin(2*w*np.pi*x))",
"_____no_output_____"
]
],
[
[
"# Debugging",
"_____no_output_____"
]
],
[
[
"%pdb",
"Automatic pdb calling has been turned ON\n"
],
[
"numbers = 'hello'\nsum(numbers)",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb69624116051ca7b9ee5ebfdf2bc98646cdcbfa | 4,697 | ipynb | Jupyter Notebook | src/13100ADD15112.ipynb | VoyagerIII/DigiX-- | f753d994be30e2174cd152ba08722e5b030f1dcf | [
"MIT"
]
| 2 | 2020-04-14T07:11:50.000Z | 2020-05-14T03:46:59.000Z | src/13100ADD15112.ipynb | VoyagerIII/DigiX-Human-Age-group-Classification | f753d994be30e2174cd152ba08722e5b030f1dcf | [
"MIT"
]
| null | null | null | src/13100ADD15112.ipynb | VoyagerIII/DigiX-Human-Age-group-Classification | f753d994be30e2174cd152ba08722e5b030f1dcf | [
"MIT"
]
| null | null | null | 19.735294 | 96 | 0.519055 | [
[
[
"import numpy as np\nimport pandas as pd\nfrom scipy import sparse\nfrom sklearn import preprocessing\nimport gc\n\nfrom scipy import sparse\nfrom scipy.sparse import csr_matrix, hstack, vstack",
"_____no_output_____"
],
[
"train15112 = sparse.load_npz(r'../trainTestData/train_15112.npz')\ntrain15112.shape",
"_____no_output_____"
],
[
"test15112 = sparse.load_npz(r'../trainTestData/test_15112.npz')\ntest15112.shape",
"_____no_output_____"
],
[
"scale = preprocessing.MaxAbsScaler()",
"_____no_output_____"
],
[
"data_fit_transform = scale.fit_transform(vstack((train15112, test15112), format='csr'))\ndata_fit_transform.shape",
"_____no_output_____"
],
[
"train15112 = data_fit_transform[:2010000]\ntest15112 = data_fit_transform[2010000:]\ntrain15112.shape, test15112.shape",
"_____no_output_____"
],
[
"train13100 = sparse.load_npz(r'../trainTestData/csr_trainData13100.npz')\ntrain13100.shape",
"_____no_output_____"
],
[
"test13100 = sparse.load_npz(r'../trainTestData/csr_testData13100.npz')\ntest13100.shape",
"_____no_output_____"
],
[
"train28212 = sparse.hstack((train13100,train15112),format='csr',dtype=np.float32)\ntest28212 = sparse.hstack((test13100,test15112),format='csr',dtype=np.float32)\nprint(train28212.shape)\nprint(test28212.shape)",
"(2010000, 28212)\n(502500, 28212)\n"
],
[
"del train13100,train15112,test13100,test15112\ngc.collect()",
"_____no_output_____"
],
[
"# 保存特征文件\nsparse.save_npz(r'../trainTestData/csr_trainData28212M.npz',train28212)\nsparse.save_npz(r'../trainTestData/csr_testData28212M.npz',test28212)",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6968161a14451590278e69d8ead6bae979f587 | 57,652 | ipynb | Jupyter Notebook | debug/kc-siamese.ipynb | sergeivolodin/causality-disentanglement-rl | 5a41b4a2e3d85fa7e9c8450215fdc6cf954df867 | [
"CC0-1.0"
]
| 2 | 2020-12-11T05:26:24.000Z | 2021-04-21T06:12:58.000Z | debug/kc-siamese.ipynb | sergeivolodin/causality-disentanglement-rl | 5a41b4a2e3d85fa7e9c8450215fdc6cf954df867 | [
"CC0-1.0"
]
| 9 | 2020-04-30T16:29:50.000Z | 2021-03-26T07:32:18.000Z | debug/kc-siamese.ipynb | sergeivolodin/causality-disentanglement-rl | 5a41b4a2e3d85fa7e9c8450215fdc6cf954df867 | [
"CC0-1.0"
]
| null | null | null | 106.565619 | 27,548 | 0.816867 | [
[
[
"import os\nos.environ['CUDA_VISIBLE_DEVICES'] = \"0\"\nimport numpy as np\nfrom matplotlib import pyplot as plt\nimport seaborn as sns\nimport pandas as pd\nfrom tqdm.auto import tqdm\nimport torch\nfrom torch import nn\nimport gin\nimport pickle\nimport io\nfrom sparse_causal_model_learner_rl.trainable.gumbel_switch import WithInputSwitch, sample_from_logits_simple\ngin.enter_interactive_mode()\nfrom sparse_causal_model_learner_rl.loss.losses import fit_loss\nfrom sparse_causal_model_learner_rl.metrics.context_rewrite import context_rewriter\nfrom sparse_causal_model_learner_rl.visual.learner_visual import graph_for_matrices",
"_____no_output_____"
],
[
"ckpt = '/home/sergei/ray_results/5x5_1f1c1k_obs_rec_nonlin_gnn_gumbel_siamese_l2_kc_dec_stop_after_completes/main_fcn_d66d7_00000_0_2021-02-01_22-09-57/checkpoint_0/checkpoint'",
"_____no_output_____"
],
[
"class LinearModel(nn.Module):\n def __init__(self, input_shape):\n super(LinearModel, self).__init__()\n self.layer = nn.Linear(in_features=10, out_features=1, bias=True)\n def forward(self, x):\n return self.layer(x)",
"_____no_output_____"
],
[
"import ray\nray.init(address='10.90.38.7:6379', ignore_reinit_error=True)",
"2021-02-02 12:48:56,263\tINFO worker.py:651 -- Connecting to existing Ray cluster at address: 10.90.38.7:6379\n"
],
[
"# https://github.com/pytorch/pytorch/issues/16797\nclass CPU_Unpickler(pickle.Unpickler):\n def find_class(self, module, name):\n if module == 'torch.storage' and name == '_load_from_bytes':\n return lambda b: torch.load(io.BytesIO(b), map_location='cpu')\n else: return super().find_class(module, name)",
"_____no_output_____"
],
[
"with open(ckpt, 'rb') as f:\n learner = pickle.load(f)#CPU_Unpickler(f).load()#pickle.load(f)",
"2021-02-02 12:48:58,766\tWARNING session.py:20 -- Session not detected. You should not be calling this function outside `tune.run` or while using the class API. \n"
],
[
"learner.collect_steps()",
"_____no_output_____"
],
[
"ctx = learner._context",
"_____no_output_____"
],
[
"ox = ctx['obs_x']\noy = ctx['obs_y']\nax = ctx['action_x']\nobs = ctx['obs']",
"_____no_output_____"
],
[
"obs_ns = None\nobs_s = None",
"_____no_output_____"
],
[
"def siamese_feature_discriminator_l2(obs, decoder, margin=1.0, **kwargs):\n def loss(y_true, y_pred):\n \"\"\"L2 norm for the distance, no flat.\"\"\"\n delta = y_true - y_pred\n delta = delta.pow(2)\n delta = delta.flatten(start_dim=1)\n delta = delta.sum(1)\n return delta\n\n # original inputs order\n batch_dim = obs.shape[0]\n\n # random permutation for incorrect inputs\n idxes = torch.randperm(batch_dim).to(obs.device)\n obs_shuffled = obs[idxes]\n\n idxes_orig = torch.arange(start=0, end=batch_dim).to(obs.device)\n target_incorrect = (idxes == idxes_orig).to(obs.device)\n \n delta_obs_obs_shuffled = (obs - obs_shuffled).pow(2).flatten(start_dim=1).max(1).values\n\n # distance_shuffle = loss(obs, obs_shuffled)\n distance_f = loss(decoder(obs), decoder(obs_shuffled))\n \n global obs_ns, obs_s\n obs_ns = obs\n obs_s = obs_shuffled\n\n # print(torch.nn.ReLU()(margin - distance_f), torch.where)\n\n return {'loss': torch.where(~target_incorrect, torch.nn.ReLU()(margin - distance_f), distance_f).mean(),\n 'metrics': {'distance_plus': distance_f[~target_incorrect].mean().item(),\n 'distance_minus': distance_f[target_incorrect].mean().item(),\n 'delta_obs_obs_shuffled': delta_obs_obs_shuffled.detach().cpu().numpy(),\n 'same_input_frac': (1.*target_incorrect).mean().item()}\n }",
"_____no_output_____"
],
[
"siamese_feature_discriminator_l2(**ctx)",
"_____no_output_____"
],
[
"#plt.hist(np.log(siamese_feature_discriminator_l2(**ctx)['metrics']['delta_obs_obs_shuffled']))",
"_____no_output_____"
],
[
"delta = obs_s - obs_ns",
"_____no_output_____"
],
[
"from collections import Counter",
"_____no_output_____"
],
[
"#learner.collect_steps()",
"_____no_output_____"
],
[
"learner.env.engine",
"_____no_output_____"
],
[
"plt.hist(delta.abs().flatten(start_dim=1).max(1).values.cpu().numpy())",
"_____no_output_____"
],
[
"opt = torch.optim.Adam(params=learner.decoder.parameters(), lr=1e-3)",
"_____no_output_____"
],
[
"from causal_util.collect_data import EnvDataCollector",
"_____no_output_____"
],
[
"learner.env = learner.create_env()\nlearner.collector = EnvDataCollector(learner.env)",
"Make environment KeyChest-v0 None {}\n"
],
[
"learner.env.engine",
"_____no_output_____"
],
[
"losses = []\ndplus = []",
"_____no_output_____"
],
[
"for _ in tqdm(range(1000)):\n learner.collect_steps()\n ctx = learner._context\n \n for _ in range(5):\n opt.zero_grad()\n\n l = siamese_feature_discriminator_l2(**ctx, margin=1.0)\n loss = l['loss']\n loss.backward()\n\n losses.append(loss.item())\n dplus.append(l['metrics']['distance_plus'])\n\n opt.step()",
"_____no_output_____"
],
[
"plt.figure(figsize=(15, 5))\nplt.subplot(1, 2, 1)\nplt.plot(losses)\nplt.yscale('log')\nplt.subplot(1, 2, 2)\nplt.yscale('log')\nplt.plot(dplus)",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb699430ac427b2c58bcd361d5b03aa1ba206a1f | 8,334 | ipynb | Jupyter Notebook | AlphaVantage/AlphaVantage_Get_balance_sheet.ipynb | techthiyanes/awesome-notebooks | 10ab4da1b94dfa101e908356a649609b0b17561a | [
"BSD-3-Clause"
]
| null | null | null | AlphaVantage/AlphaVantage_Get_balance_sheet.ipynb | techthiyanes/awesome-notebooks | 10ab4da1b94dfa101e908356a649609b0b17561a | [
"BSD-3-Clause"
]
| null | null | null | AlphaVantage/AlphaVantage_Get_balance_sheet.ipynb | techthiyanes/awesome-notebooks | 10ab4da1b94dfa101e908356a649609b0b17561a | [
"BSD-3-Clause"
]
| null | null | null | 28.155405 | 297 | 0.62887 | [
[
[
"<img width=\"10%\" alt=\"Naas\" src=\"https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160\"/>",
"_____no_output_____"
],
[
"# AlphaVantage - Get balance sheet\n<a href=\"https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/AlphaVantage/AlphaVantage_Get_balance_sheet.ipynb\" target=\"_parent\"><img src=\"https://naasai-public.s3.eu-west-3.amazonaws.com/open_in_naas.svg\"/></a>",
"_____no_output_____"
],
[
"**Tags:** #alphavantage #trading #market_data #investors #snippet #dataframe",
"_____no_output_____"
],
[
"**Author:** [Florent Ravenel](https://www.linkedin.com/in/ACoAABCNSioBW3YZHc2lBHVG0E_TXYWitQkmwog/)",
"_____no_output_____"
],
[
"## Input",
"_____no_output_____"
],
[
"### Import libraries",
"_____no_output_____"
]
],
[
[
"import requests\nimport pandas as pd",
"_____no_output_____"
]
],
[
[
"### Variables",
"_____no_output_____"
]
],
[
[
"API_KEY = \"demo\"\nCOMPANY = \"IBM\"",
"_____no_output_____"
]
],
[
[
"## Model",
"_____no_output_____"
],
[
"### Get company overview",
"_____no_output_____"
]
],
[
[
"response = requests.get(f'https://www.alphavantage.co/query?function=BALANCE_SHEET&symbol={COMPANY}&apikey={API_KEY}')\ndata = response.json()\ndf = pd.DataFrame(data.get(\"annualReports\"))",
"_____no_output_____"
]
],
[
[
"## Output",
"_____no_output_____"
],
[
"### Display result",
"_____no_output_____"
]
],
[
[
"df",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
]
]
|
cb69995a4ce53d01fae08bbd3c1192df127abe6a | 955,578 | ipynb | Jupyter Notebook | Lectures/Lecture16 -- Seasonal cycle and heat capacity.ipynb | EasezzZ/Climate_Modeling_Lect | 98b681933c7340c72a7c1a96caf424f225576cfb | [
"MIT"
]
| null | null | null | Lectures/Lecture16 -- Seasonal cycle and heat capacity.ipynb | EasezzZ/Climate_Modeling_Lect | 98b681933c7340c72a7c1a96caf424f225576cfb | [
"MIT"
]
| null | null | null | Lectures/Lecture16 -- Seasonal cycle and heat capacity.ipynb | EasezzZ/Climate_Modeling_Lect | 98b681933c7340c72a7c1a96caf424f225576cfb | [
"MIT"
]
| 1 | 2021-02-20T03:10:31.000Z | 2021-02-20T03:10:31.000Z | 144.434401 | 175,996 | 0.880271 | [
[
[
"# [ATM 623: Climate Modeling](../index.ipynb)\n\n[Brian E. J. Rose](http://www.atmos.albany.edu/facstaff/brose/index.html), University at Albany\n\n# Lecture 16: Modeling the seasonal cycle of surface temperature",
"_____no_output_____"
],
[
"### About these notes:\n\nThis document uses the interactive [`Jupyter notebook`](https://jupyter.org) format. The notes can be accessed in several different ways:\n\n- The interactive notebooks are hosted on `github` at https://github.com/brian-rose/ClimateModeling_courseware\n- The latest versions can be viewed as static web pages [rendered on nbviewer](http://nbviewer.ipython.org/github/brian-rose/ClimateModeling_courseware/blob/master/index.ipynb)\n- A complete snapshot of the notes as of May 2017 (end of spring semester) are [available on Brian's website](http://www.atmos.albany.edu/facstaff/brose/classes/ATM623_Spring2017/Notes/index.html).\n\n[Also here is a legacy version from 2015](http://www.atmos.albany.edu/facstaff/brose/classes/ATM623_Spring2015/Notes/index.html).\n\nMany of these notes make use of the `climlab` package, available at https://github.com/brian-rose/climlab",
"_____no_output_____"
]
],
[
[
"# Ensure compatibility with Python 2 and 3\nfrom __future__ import print_function, division",
"_____no_output_____"
]
],
[
[
"## Contents\n\n1. [The observed seasonal cycle from NCEP Reanalysis data](#section1)\n2. [Analytical toy model of the seasonal cycle](#section2)\n3. [Exploring the amplitude of the seasonal cycle with an EBM](#section3)\n4. [The seasonal cycle for a planet with 90º obliquity](#section4)",
"_____no_output_____"
],
[
"____________\n<a id='section1'></a>\n\n## 1. The observed seasonal cycle from NCEP Reanalysis data\n____________\n\n",
"_____no_output_____"
],
[
"Look at the observed seasonal cycle in the NCEP reanalysis data.\n\nRead in the necessary data from the online server.\n\nThe catalog is here: <http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis.derived/catalog.html>",
"_____no_output_____"
]
],
[
[
"%matplotlib inline\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport xarray as xr\nimport climlab\nfrom climlab import constants as const\n\n# Disable interactive plotting (use explicit display calls to show figures)\nplt.ioff()\n\ndatapath = \"http://ramadda.atmos.albany.edu:8080/repository/opendap/latest/Top/Users/BrianRose/CESM_runs/\"\nendstr = \"/entry.das\"",
"_____no_output_____"
],
[
"ncep_url = \"http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis.derived/\"\nncep_Ts = xr.open_dataset(ncep_url + \"surface_gauss/skt.sfc.mon.1981-2010.ltm.nc\", decode_times=False)\nlat_ncep = ncep_Ts.lat; lon_ncep = ncep_Ts.lon\nTs_ncep = ncep_Ts.skt\nprint( Ts_ncep.shape)",
"(12, 94, 192)\n"
]
],
[
[
"Load the topography file from CESM, just so we can plot the continents.",
"_____no_output_____"
]
],
[
[
"topo = xr.open_dataset(datapath+'som_input/USGS-gtopo30_1.9x2.5_remap_c050602.nc'+endstr, decode_times=False)\nlat_cesm = topo.lat\nlon_cesm = topo.lon",
"_____no_output_____"
]
],
[
[
"Make two maps: one of annual mean surface temperature, another of the seasonal range (max minus min).",
"_____no_output_____"
]
],
[
[
"maxTs = Ts_ncep.max(dim='time')\nminTs = Ts_ncep.min(dim='time')\nmeanTs = Ts_ncep.mean(dim='time')",
"_____no_output_____"
],
[
"fig = plt.figure( figsize=(16,6) )\n\nax1 = fig.add_subplot(1,2,1)\ncax1 = ax1.pcolormesh( lon_ncep, lat_ncep, meanTs, cmap=plt.cm.seismic )\ncbar1 = plt.colorbar(cax1)\nax1.set_title('Annual mean surface temperature (degC)', fontsize=14 )\n\nax2 = fig.add_subplot(1,2,2)\ncax2 = ax2.pcolormesh( lon_ncep, lat_ncep, maxTs - minTs )\ncbar2 = plt.colorbar(cax2)\nax2.set_title('Seasonal temperature range (degC)', fontsize=14)\n\nfor ax in [ax1,ax2]:\n ax.contour( lon_cesm, lat_cesm, topo.variables['LANDFRAC'][:], [0.5], colors='k');\n ax.axis([0, 360, -90, 90])\n ax.set_xlabel('Longitude', fontsize=14 ); ax.set_ylabel('Latitude', fontsize=14 )",
"_____no_output_____"
],
[
"fig",
"_____no_output_____"
]
],
[
[
"Make a contour plot of the zonal mean temperature as a function of time",
"_____no_output_____"
]
],
[
[
"Tmax = 65; Tmin = -Tmax; delT = 10\nclevels = np.arange(Tmin,Tmax+delT,delT)\nfig_zonobs, ax = plt.subplots( figsize=(10,6) )\ncax = ax.contourf(np.arange(12)+0.5, lat_ncep, \n Ts_ncep.mean(dim='lon').transpose(), levels=clevels, \n cmap=plt.cm.seismic, vmin=Tmin, vmax=Tmax)\nax.set_xlabel('Month', fontsize=16)\nax.set_ylabel('Latitude', fontsize=16 )\ncbar = plt.colorbar(cax)\nax.set_title('Zonal mean surface temperature (degC)', fontsize=20)\nfig_zonobs",
"_____no_output_____"
]
],
[
[
"____________\n<a id='section2'></a>\n\n## 2. Analytical toy model of the seasonal cycle\n____________\n",
"_____no_output_____"
],
[
"What factors determine the above pattern of seasonal temperatures? How large is the winter-to-summer variation in temperature? What is its phasing relative to the seasonal variations in insolation?\n\nWe will start to examine this in a very simple zero-dimensional EBM.",
"_____no_output_____"
],
[
"Suppose the seasonal cycle of insolation at a point is \n\n$$ Q = Q^* \\sin\\omega t + Q_0$$\n\nwhere $\\omega = 2\\pi ~ \\text{year}^{-1}$, $Q_0$ is the annual mean insolation, and $Q^*$ is the amplitude of the seasonal variations.\n\nHere $\\omega ~ t=0$ is spring equinox, $\\omega~t = \\pi/2$ is summer solstice, $\\omega~t = \\pi$ is fall equinox, and $ \\omega ~t = 3 \\pi/2$ is winter solstice.",
"_____no_output_____"
],
[
"Now suppose the temperature is governed by \n\n$$ C \\frac{d T}{d t} = Q - (A + B~T) $$\n\nso that we have a simple model\n\n$$ C \\frac{d T}{d t} = Q^* \\sin\\omega t + Q_0 - (A + B~T) $$",
"_____no_output_____"
],
[
"We want to ask two questions:\n\n1. **What is the amplitude of the seasonal temperature variation?**\n2. **When does the temperature maximum occur?**",
"_____no_output_____"
],
[
"We will look for an oscillating solution\n\n$$ T(t) = T_0 + T^* \\sin(\\omega t - \\Phi) $$\n\nwhere $\\Phi$ is an unknown phase shift and $T^*$ is the unknown amplitude of seasonal temperature variations.",
"_____no_output_____"
],
[
"### The annual mean:\n\nIntegrate over one year to find\n\n$$ \\overline{T} = T_0 $$\n\n$$ Q_0 = A + B ~ \\overline{T} $$\n\nso that\n\n$$T_0 = \\frac{Q_0 - A}{B} $$",
"_____no_output_____"
],
[
"### The seasonal problem\n\nNow we need to solve for $T^*$ and $\\Phi$.\n\nTake the derivative\n\n$$ \\frac{d T}{dt} = T^* \\omega \\cos(\\omega t - \\Phi) $$\n\nand plug into the model equation to get\n\n\\begin{align*}\nC~ T^* \\omega \\cos(\\omega t - \\Phi) &= Q^* \\sin\\omega t + Q_0 \\\\\n & - \\left( A + B~(T_0 + T^* \\sin(\\omega t - \\Phi) )\\right)\n\\end{align*}",
"_____no_output_____"
],
[
"Subtracting out the annual mean leaves us with\n\n$$ C~ T^* \\omega \\cos(\\omega t - \\Phi) = Q^* \\sin\\omega t - B ~ T^* \\sin(\\omega t - \\Phi) $$",
"_____no_output_____"
],
[
"### Zero heat capacity: the radiative equilibrium solution\n\nIt's instructive to first look at the case with $C=0$, which means that the system is not capable of storing heat, and the temperature must always be in radiative equilibrium with the insolation.",
"_____no_output_____"
],
[
"In this case we would have\n\n$$ Q^* \\sin\\omega t = B ~ T^* \\sin(\\omega t - \\Phi) $$\n\nwhich requires that the phase shift is\n\n$$ \\Phi = 0 $$\n\nand the amplitude is\n\n$$ T^* = \\frac{Q^*}{B} $$",
"_____no_output_____"
],
[
"With no heat capacity, there can be no phase shift! The temperature goes up and does in lockstep with the insolation. \nAs we will see, the amplitude of the temperature variations is maximum in this limit.",
"_____no_output_____"
],
[
"As a practical example: at 45ºN the amplitude of the seasonal insolation cycle is about 180 W m$^{-2}$ (see the [Insolation notes](Lecture11 -- Insolation.ipynb) -- the difference between insolation at summer and winter solstice is about 360 W m$^{-2}$ which we divide by two to get the amplitude of seasonal variations).\n\nWe will follow our previous EBM work and take $B = 2$ W m$^{-2}$ K$^{-1}$. This would give a seasonal temperature amplitude of 90ºC!\n\nThis highlights to important role for heat capacity to buffer the seasonal variations in sunlight.",
"_____no_output_____"
],
[
"### Non-dimensional heat capacity parameter\n\nWe can rearrange the seasonal equation to give\n\n$$ \\frac{C~\\omega}{B} \\cos(\\omega t - \\Phi) + \\sin(\\omega t - \\Phi) = \\frac{Q^*}{B~T^*} \\sin\\omega t $$\n\nThe heat capacity appears in our equation through the non-dimensional ratio\n\n$$ \\tilde{C} = \\frac{C~\\omega}{B} $$\n\nThis parameter measures the efficiency of heat storage versus damping of energy anomalies through longwave radiation to space in our system.",
"_____no_output_____"
],
[
"We will now use trigonometric identities\n\n\\begin{align*}\n\\cos(\\omega t - \\Phi) &= \\cos\\omega t \\cos\\Phi + \\sin\\omega t \\sin\\Phi \\\\\n\\sin(\\omega t - \\Phi) &= \\sin\\omega t \\cos\\Phi - \\cos\\omega t \\sin\\Phi\n\\end{align*}\n\nto express our equation as\n\n\\begin{align*}\n\\frac{Q^*}{B~T^*} \\sin\\omega t = &\\tilde{C} \\cos\\omega t \\cos\\Phi \\\\\n + &\\tilde{C} \\sin\\omega t \\sin\\Phi \\\\\n + &\\sin\\omega t \\cos\\Phi \\\\\n - &\\cos\\omega t \\sin\\Phi\n\\end{align*}",
"_____no_output_____"
],
[
"Now gathering together all terms in $\\cos\\omega t$ and $\\sin\\omega t$:\n\n$$ \\cos\\omega t \\left( \\tilde{C} \\cos\\Phi - \\sin\\Phi \\right) = \\sin\\omega t \\left( \\frac{Q^*}{B~T^*} - \\tilde{C} \\sin\\Phi - \\cos\\Phi \\right) $$",
"_____no_output_____"
],
[
"### Solving for the phase shift\n\nThe equation above must be true for all $t$, which means that sum of terms in each set of parentheses must be zero.\n\nWe therefore have an equation for the phase shift\n\n$$ \\tilde{C} \\cos\\Phi - \\sin\\Phi = 0 $$\n\nwhich means that the phase shift is\n\n$$ \\Phi = \\arctan \\tilde{C} $$",
"_____no_output_____"
],
[
"### Solving for the amplitude\n\nThe other equation is \n\n$$ \\frac{Q^*}{B~T^*} - \\tilde{C} \\sin\\Phi - \\cos\\Phi = 0 $$\n\nor\n\n$$ \\frac{Q^*}{B~T^*} - \\cos\\Phi \\left( 1+ \\tilde{C}^2 \\right) = 0 $$\n\nwhich we solve for $T^*$ to get\n\n$$ T^* = \\frac{Q^*}{B} \\frac{1}{\\left( 1+ \\tilde{C}^2 \\right) \\cos\\left(\\arctan \\tilde{C} \\right) } $$",
"_____no_output_____"
],
[
"### Shallow water limit:\n\nIn low heat capacity limit,\n\n$$ \\tilde{C} << 1 $$\n\nthe phase shift is\n\n$$ \\Phi \\approx \\tilde{C} $$\n\nand the amplitude is\n\n$$ T^* = \\frac{Q^*}{B} \\left( 1 - \\tilde{C} \\right) $$",
"_____no_output_____"
],
[
"Notice that for a system with very little heat capacity, the **phase shift approaches zero** and the **amplitude approaches its maximum value** $T^* = \\frac{Q^*}{B}$.\n\nIn the shallow water limit the temperature maximum will occur just slightly after the insolation maximum, and the seasonal temperature variations will be large.",
"_____no_output_____"
],
[
"### Deep water limit:\n\nSuppose instead we have an infinitely large heat reservoir (e.g. very deep ocean mixed layer).\n\nIn the limit $\\tilde{C} \\rightarrow \\infty$, the phase shift tends toward\n\n$$ \\Phi \\rightarrow \\frac{\\pi}{2} $$\n\nso the warming is nearly perfectly out of phase with the insolation -- peak temperature would occur at fall equinox.\n\nBut the amplitude in this limit is very small!\n\n$$ T^* \\rightarrow 0 $$",
"_____no_output_____"
],
[
"### What values of $\\tilde{C}$ are realistic?\n\nWe need to evaluate \n\n$$ \\tilde{C} = \\frac{C~\\omega}{B} $$\n\nfor reasonable values of $C$ and $B$.\n\n$B$ is the longwave radiative feedback in our system: a measure of how efficiently a warm anomaly is radiated away to space. We have previously chosen $B = 2$ W m$^{-2}$ K$^{-1}$.\n\n$C$ is the heat capacity of the whole column, a number in J m$^{-2}$ K$^{-1}$.\n",
"_____no_output_____"
],
[
"#### Heat capacity of the atmosphere\n\nIntegrating from the surface to the top of the atmosphere, we can write\n\n$$ C_a = \\int_0^{p_s} c_p \\frac{dp}{g} $$\n\nwhere $c_p = 10^3$ J kg$^{-1}$ K$^{-1}$ is the specific heat at constant pressure for a unit mass of air, and $dp/g$ is a mass element.\n\nThis gives $C_a \\approx 10^7$ J m$^{-2}$ K$^{-1}$.",
"_____no_output_____"
],
[
"#### Heat capacity of a water surface\n\nAs we wrote [back in Lecture 2](Lecture02 -- Solving the zero-dimensional EBM.ipynb), the heat capacity for a well-mixed column of water is\n\n$$C_w = c_w \\rho_w H_w $$\n\nwhere \n\n$c_w = 4 \\times 10^3$ J kg$^{-1}$ $^\\circ$C$^{-1}$ is the specific heat of water,\n\n$\\rho_w = 10^3$ kg m$^{-3}$ is the density of water, and\n\n$H_w $ is the depth of the water column\n\n**The heat capacity of the entire atmosphere is thus equivalent to 2.5 meters of water.**",
"_____no_output_____"
],
[
"#### $\\tilde{C}$ for a dry land surface\n\nA dry land surface has very little heat capacity and $C$ is actually dominated by the atmosphere. So we can take $C = C_a = 10^7$ J m$^{-2}$ K$^{-1}$ as a reasonable lower bound.\n\nSo our lower bound on $\\tilde{C}$ is thus, taking $B = 2$ W m$^{-2}$ K$^{-1}$ and $\\omega = 2\\pi ~ \\text{year}^{-1} = 2 \\times 10^{-7} \\text{ s}^{-1}$:\n\n$$ \\tilde{C} = 1 $$",
"_____no_output_____"
],
[
"#### $\\tilde{C}$ for a 100 meter ocean mixed layer\n\nSetting $H_w = 100$ m gives $C_w = 4 \\times 10^8$ J m$^{-2}$ K$^{-1}$. Then our non-dimensional parameter is\n\n$$ \\tilde{C} = 40 $$ ",
"_____no_output_____"
],
[
"### The upshot: $\\tilde{C}$ is closer to the deep water limit\n\nEven for a dry land surface, $\\tilde{C}$ is not small. This means that there is always going to be a substantial phase shift in the timing of the peak temperatures, and a reduction in the seasonal amplitude.",
"_____no_output_____"
],
[
"### Plot the full solution for a range of water depths",
"_____no_output_____"
]
],
[
[
"omega = 2*np.pi / const.seconds_per_year\nomega",
"_____no_output_____"
],
[
"B = 2.\nHw = np.linspace(0., 100.)\nCtilde = const.cw * const.rho_w * Hw * omega / B\namp = 1./((Ctilde**2+1)*np.cos(np.arctan(Ctilde)))\nPhi = np.arctan(Ctilde)",
"_____no_output_____"
],
[
"color1 = 'b'\ncolor2 = 'r'\n\nfig = plt.figure(figsize=(8,6))\nax1 = fig.add_subplot(111)\nax1.plot(Hw, amp, color=color1)\nax1.set_xlabel('water depth (m)', fontsize=14)\nax1.set_ylabel('Seasonal amplitude ($Q^* / B$)', fontsize=14, color=color1)\nfor tl in ax1.get_yticklabels():\n tl.set_color(color1)\nax2 = ax1.twinx()\nax2.plot(Hw, np.rad2deg(Phi), color=color2)\nax2.set_ylabel('Seasonal phase shift (degrees)', fontsize=14, color=color2)\nfor tl in ax2.get_yticklabels():\n tl.set_color(color2)\nax1.set_title('Dependence of seasonal cycle phase and amplitude on water depth', fontsize=16)\nax1.grid()\n\nax1.plot([2.5, 2.5], [0, 1], 'k-');",
"_____no_output_____"
],
[
"fig",
"_____no_output_____"
]
],
[
[
"The blue line shows the amplitude of the seasonal cycle of temperature, expressed as a fraction of its maximum value $\\frac{Q^*}{B}$ (the value that would occur if the system had zero heat capacity so that temperatures were always in radiative equilibrium with the instantaneous insolation).\n\nThe red line shows the phase lag (in degrees) of the temperature cycle relative to the insolation cycle.\n\nThe vertical black line indicates 2.5 meters of water, which is the heat capacity of the atmosphere and thus our effective lower bound on total column heat capacity.",
"_____no_output_____"
],
[
"### The seasonal phase shift\n\nEven for the driest surfaces the phase shift is about 45º and the amplitude is half of its theoretical maximum. For most wet surfaces the cycle is damped out and delayed further.\n\nOf course we are already familiar with this phase shift from our day-to-day experience. Our calendar says that summer \"begins\" at the solstice and last until the equinox. ",
"_____no_output_____"
]
],
[
[
"fig, ax = plt.subplots()\nyears = np.linspace(0,2)\nHarray = np.array([0., 2.5, 10., 50.])\nfor Hw in Harray:\n Ctilde = const.cw * const.rho_w * Hw * omega / B\n Phi = np.arctan(Ctilde)\n ax.plot(years, np.sin(2*np.pi*years - Phi)/np.cos(Phi)/(1+Ctilde**2), label=Hw)\nax.set_xlabel('Years', fontsize=14)\nax.set_ylabel('Seasonal amplitude ($Q^* / B$)', fontsize=14)\nax.set_title('Solution of toy seasonal model for several different water depths', fontsize=14)\nax.legend(); ax.grid()\nfig",
"_____no_output_____"
]
],
[
[
"The blue curve in this figure is in phase with the insolation.",
"_____no_output_____"
],
[
"____________\n<a id='section3'></a>\n\n## 3. Exploring the amplitude of the seasonal cycle with an EBM\n____________\n",
"_____no_output_____"
],
[
"Something important is missing from this toy model: heat transport!\n\nThe amplitude of the seasonal cycle of insolation increases toward the poles, but the seasonal temperature variations are partly mitigated by heat transport from lower, warmer latitudes.\n\nOur 1D diffusive EBM is the appropriate tool for exploring this further.",
"_____no_output_____"
],
[
"We are looking at the 1D (zonally averaged) energy balance model with diffusive heat transport. The equation is",
"_____no_output_____"
],
[
"\n$$ C \\frac{\\partial T_s}{\\partial t} = (1-\\alpha) ~ Q - \\left( A + B~T_s \\right) + \\frac{D}{\\cos\\phi } \\frac{\\partial }{\\partial \\phi} \\left( \\cos\\phi ~ \\frac{\\partial T_s}{\\partial \\phi} \\right) $$\n\nwith the albedo given by\n\n$$ \\alpha(\\phi) = \\alpha_0 + \\alpha_2 P_2(\\sin\\phi) $$\n\n",
"_____no_output_____"
],
[
"and we will use\n```\nclimlab.EBM_seasonal\n``` \nto solve this model numerically.",
"_____no_output_____"
],
[
"One handy feature of `climlab` process code: the function `integrate_years()` automatically calculates the time averaged temperature. So if we run it for exactly one year, we get the annual mean temperature (and many other diagnostics) saved in the dictionary `timeave`.",
"_____no_output_____"
],
[
"We will look at the seasonal cycle of temperature in three different models with different heat capacities (which we express through an equivalent depth of water in meters). \n\nAll other parameters will be [as chosen in Lecture 15](Lecture15 -- Diffusive energy balance model.ipynb) (which focussed on tuning the EBM to the annual mean energy budget).",
"_____no_output_____"
]
],
[
[
"# for convenience, set up a dictionary with our reference parameters\nparam = {'A':210, 'B':2, 'a0':0.354, 'a2':0.25, 'D':0.6}\nparam",
"_____no_output_____"
],
[
"# We can pass the entire dictionary as keyword arguments using the ** notation\nmodel1 = climlab.EBM_seasonal(**param)\nprint( model1)",
"climlab Process of type <class 'climlab.model.ebm.EBM_seasonal'>. \nState variables and domain shapes: \n Ts: (90, 1) \nThe subprocess tree: \ntop: <class 'climlab.model.ebm.EBM_seasonal'>\n LW: <class 'climlab.radiation.aplusbt.AplusBT'>\n insolation: <class 'climlab.radiation.insolation.DailyInsolation'>\n albedo: <class 'climlab.surface.albedo.P2Albedo'>\n diffusion: <class 'climlab.dynamics.diffusion.MeridionalDiffusion'>\n\n"
]
],
[
[
"Notice that this model has an insolation subprocess called `DailyInsolation`, rather than `AnnualMeanInsolation`. These should be fairly self-explanatory.",
"_____no_output_____"
]
],
[
[
"# We will try three different water depths\nwater_depths = np.array([2., 10., 50.])\n\nnum_depths = water_depths.size\nTann = np.empty( [model1.lat.size, num_depths] )\nmodels = []\n\nfor n in range(num_depths):\n ebm = climlab.EBM_seasonal(water_depth=water_depths[n], **param)\n models.append(ebm)\n models[n].integrate_years(20., verbose=False )\n models[n].integrate_years(1., verbose=False)\n Tann[:,n] = np.squeeze(models[n].timeave['Ts'])",
"_____no_output_____"
]
],
[
[
"All models should have the same annual mean temperature:",
"_____no_output_____"
]
],
[
[
"lat = model1.lat\nfig, ax = plt.subplots()\nax.plot(lat, Tann)\nax.set_xlim(-90,90)\nax.set_xlabel('Latitude')\nax.set_ylabel('Temperature (degC)')\nax.set_title('Annual mean temperature in the EBM')\nax.legend( water_depths )\nfig",
"_____no_output_____"
]
],
[
[
"There is no automatic function in the `climlab` code to keep track of minimum and maximum temperatures (though we might add that in the future!)\n\nInstead we'll step through one year \"by hand\" and save all the temperatures.",
"_____no_output_____"
]
],
[
[
"num_steps_per_year = int(model1.time['num_steps_per_year'])\nTyear = np.empty((lat.size, num_steps_per_year, num_depths))\nfor n in range(num_depths):\n for m in range(num_steps_per_year):\n models[n].step_forward()\n Tyear[:,m,n] = np.squeeze(models[n].Ts)",
"_____no_output_____"
]
],
[
[
"Make a figure to compare the observed zonal mean seasonal temperature cycle to what we get from the EBM with different heat capacities:",
"_____no_output_____"
]
],
[
[
"fig = plt.figure( figsize=(16,10) )\n\nax = fig.add_subplot(2,num_depths,2)\ncax = ax.contourf(np.arange(12)+0.5, lat_ncep, \n Ts_ncep.mean(dim='lon').transpose(), \n levels=clevels, cmap=plt.cm.seismic, \n vmin=Tmin, vmax=Tmax)\nax.set_xlabel('Month')\nax.set_ylabel('Latitude')\ncbar = plt.colorbar(cax)\nax.set_title('Zonal mean surface temperature - observed (degC)', fontsize=20)\n\nfor n in range(num_depths):\n ax = fig.add_subplot(2,num_depths,num_depths+n+1)\n cax = ax.contourf(4*np.arange(num_steps_per_year),\n lat, Tyear[:,:,n], levels=clevels, \n cmap=plt.cm.seismic, vmin=Tmin, vmax=Tmax)\n cbar1 = plt.colorbar(cax)\n ax.set_title('water depth = %.0f m' %models[n].param['water_depth'], fontsize=20 )\n ax.set_xlabel('Days of year', fontsize=14 )\n ax.set_ylabel('Latitude', fontsize=14 )",
"_____no_output_____"
],
[
"fig",
"_____no_output_____"
]
],
[
[
"Which one looks more realistic? Depends a bit on where you look. But overall, the observed seasonal cycle matches the 10 meter case best. The effective heat capacity governing the seasonal cycle of the zonal mean temperature is closer to 10 meters of water than to either 2 or 50 meters.",
"_____no_output_____"
],
[
"### Making an animation of the EBM solutions\n\nLet's animate the seasonal cycle of insolation and temperature in our models with the three different water depths",
"_____no_output_____"
]
],
[
[
"def initial_figure(models):\n fig, axes = plt.subplots(1,len(models), figsize=(15,4))\n lines = []\n for n in range(len(models)):\n ax = axes[n]\n c1 = 'b'\n Tsline = ax.plot(lat, models[n].Ts, c1)[0]\n ax.set_title('water depth = %.0f m' %models[n].param['water_depth'], fontsize=20 )\n ax.set_xlabel('Latitude', fontsize=14 )\n if n is 0:\n ax.set_ylabel('Temperature', fontsize=14, color=c1 )\n ax.set_xlim([-90,90])\n ax.set_ylim([-60,60])\n for tl in ax.get_yticklabels():\n tl.set_color(c1)\n ax.grid()\n\n c2 = 'r'\n ax2 = ax.twinx()\n Qline = ax2.plot(lat, models[n].insolation, c2)[0]\n if n is 2:\n ax2.set_ylabel('Insolation (W m$^{-2}$)', color=c2, fontsize=14)\n for tl in ax2.get_yticklabels():\n tl.set_color(c2)\n ax2.set_xlim([-90,90])\n ax2.set_ylim([0,600])\n lines.append([Tsline, Qline])\n return fig, axes, lines",
"_____no_output_____"
],
[
"def animate(step, models, lines):\n for n, ebm in enumerate(models):\n ebm.step_forward()\n # The rest of this is just updating the plot\n lines[n][0].set_ydata(ebm.Ts)\n lines[n][1].set_ydata(ebm.insolation)\n return lines",
"_____no_output_____"
],
[
"# Plot initial data\nfig, axes, lines = initial_figure(models)\nfig",
"_____no_output_____"
],
[
"# Some imports needed to make and display animations\nfrom IPython.display import HTML\nfrom matplotlib import animation\n\nnum_steps = int(models[0].time['num_steps_per_year'])\nani = animation.FuncAnimation(fig, animate, \n frames=num_steps,\n interval=80,\n fargs=(models, lines),\n )",
"_____no_output_____"
],
[
"HTML(ani.to_html5_video())",
"_____no_output_____"
]
],
[
[
"____________\n<a id='section4'></a>\n\n## 4. The seasonal cycle for a planet with 90º obliquity\n____________\n",
"_____no_output_____"
],
[
"The EBM code uses our familiar `insolation.py` code to calculate insolation, and therefore it's easy to set up a model with different orbital parameters. Here is an example with **very** different orbital parameters: 90º obliquity. We looked at the distribution of insolation by latitude and season for this type of planet in the last homework.",
"_____no_output_____"
]
],
[
[
"orb_highobl = {'ecc':0., \n 'obliquity':90., \n 'long_peri':0.}\nprint( orb_highobl)\nmodel_highobl = climlab.EBM_seasonal(orb=orb_highobl, **param)\nprint( model_highobl.param['orb'])",
"{'ecc': 0.0, 'obliquity': 90.0, 'long_peri': 0.0}\n{'ecc': 0.0, 'obliquity': 90.0, 'long_peri': 0.0}\n"
]
],
[
[
"Repeat the same procedure to calculate and store temperature throughout one year, after letting the models run out to equilibrium.",
"_____no_output_____"
]
],
[
[
"Tann_highobl = np.empty( [lat.size, num_depths] )\nmodels_highobl = []\n\nfor n in range(num_depths):\n model = climlab.EBM_seasonal(water_depth=water_depths[n], \n orb=orb_highobl, \n **param)\n models_highobl.append(model)\n models_highobl[n].integrate_years(40., verbose=False )\n models_highobl[n].integrate_years(1., verbose=False)\n Tann_highobl[:,n] = np.squeeze(models_highobl[n].timeave['Ts'])\n\nTyear_highobl = np.empty([lat.size, num_steps_per_year, num_depths])\nfor n in range(num_depths):\n for m in range(num_steps_per_year):\n models_highobl[n].step_forward()\n Tyear_highobl[:,m,n] = np.squeeze(models_highobl[n].Ts)",
"_____no_output_____"
]
],
[
[
"And plot the seasonal temperature cycle same as we did above:",
"_____no_output_____"
]
],
[
[
"fig = plt.figure( figsize=(16,5) )\nTmax_highobl = 125; Tmin_highobl = -Tmax_highobl; delT_highobl = 10\nclevels_highobl = np.arange(Tmin_highobl, Tmax_highobl+delT_highobl, delT_highobl)\nfor n in range(num_depths):\n ax = fig.add_subplot(1,num_depths,n+1)\n cax = ax.contourf( 4*np.arange(num_steps_per_year), lat, Tyear_highobl[:,:,n], \n levels=clevels_highobl, cmap=plt.cm.seismic, vmin=Tmin_highobl, vmax=Tmax_highobl )\n cbar1 = plt.colorbar(cax)\n ax.set_title('water depth = %.0f m' %models[n].param['water_depth'], fontsize=20 )\n ax.set_xlabel('Days of year', fontsize=14 )\n ax.set_ylabel('Latitude', fontsize=14 )\nfig",
"_____no_output_____"
]
],
[
[
"Note that the temperature range is much larger than for the Earth-like case above (but same contour interval, 10 degC).",
"_____no_output_____"
],
[
"Why is the temperature so uniform in the north-south direction with 50 meters of water?\n\nTo see the reason, let's plot the annual mean insolation at 90º obliquity, alongside the present-day annual mean insolation:",
"_____no_output_____"
]
],
[
[
"lat2 = np.linspace(-90, 90, 181)\ndays = np.linspace(1.,50.)/50 * const.days_per_year\nQ_present = climlab.solar.insolation.daily_insolation( lat2, days )\nQ_highobl = climlab.solar.insolation.daily_insolation( lat2, days, orb_highobl )\nQ_present_ann = np.mean( Q_present, axis=1 )\nQ_highobl_ann = np.mean( Q_highobl, axis=1 )",
"_____no_output_____"
],
[
"fig, ax = plt.subplots()\nax.plot( lat2, Q_present_ann, label='Earth' )\nax.plot( lat2, Q_highobl_ann, label='90deg obliquity' )\nax.grid()\nax.legend(loc='lower center')\nax.set_xlabel('Latitude', fontsize=14 )\nax.set_ylabel('W m$^{-2}$', fontsize=14 )\nax.set_title('Annual mean insolation for two different obliquities', fontsize=16)\nfig",
"_____no_output_____"
]
],
[
[
"Though this is a bit misleading, because our model prescribes an increase in albedo from the equator to the pole. So the absorbed shortwave gradients look even more different.",
"_____no_output_____"
],
[
"<div class=\"alert alert-success\">\n[Back to ATM 623 notebook home](../index.ipynb)\n</div>",
"_____no_output_____"
],
[
"____________\n## Version information\n____________\n",
"_____no_output_____"
]
],
[
[
"%load_ext version_information\n%version_information numpy, xarray, climlab",
"Loading extensions from ~/.ipython/extensions is deprecated. We recommend managing extensions like any other Python packages, in site-packages.\n"
]
],
[
[
"____________\n\n## Credits\n\nThe author of this notebook is [Brian E. J. Rose](http://www.atmos.albany.edu/facstaff/brose/index.html), University at Albany.\n\nIt was developed in support of [ATM 623: Climate Modeling](http://www.atmos.albany.edu/facstaff/brose/classes/ATM623_Spring2015/), a graduate-level course in the [Department of Atmospheric and Envionmental Sciences](http://www.albany.edu/atmos/index.php)\n\nDevelopment of these notes and the [climlab software](https://github.com/brian-rose/climlab) is partially supported by the National Science Foundation under award AGS-1455071 to Brian Rose. Any opinions, findings, conclusions or recommendations expressed here are mine and do not necessarily reflect the views of the National Science Foundation.\n____________",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
]
]
|
cb699da5ce63ca2040f0c957b4307607220cd2f0 | 195,326 | ipynb | Jupyter Notebook | 2020 Осенний семестр/Практическое задание 5/Грушин ПР5.ipynb | mosalov/Notebook_For_AI_Main | a693d29bf0bdcf824cb4f1eca86ff54b67ba7428 | [
"MIT"
]
| 6 | 2021-09-20T10:28:18.000Z | 2022-03-14T18:39:17.000Z | 2020 Осенний семестр/Практическое задание 5/Грушин ПР5.ipynb | mosalov/Notebook_For_AI_Main | a693d29bf0bdcf824cb4f1eca86ff54b67ba7428 | [
"MIT"
]
| 122 | 2020-09-07T11:57:57.000Z | 2022-03-22T06:47:03.000Z | 2020 Осенний семестр/Практическое задание 5/Грушин ПР5.ipynb | mosalov/Notebook_For_AI_Main | a693d29bf0bdcf824cb4f1eca86ff54b67ba7428 | [
"MIT"
]
| 97 | 2020-09-07T11:32:19.000Z | 2022-03-31T10:27:38.000Z | 169.11342 | 14,820 | 0.904068 | [
[
[
"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport sklearn as sk\n\nfrom sklearn import linear_model\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import mean_squared_error\nfrom sklearn.preprocessing import MinMaxScaler",
"_____no_output_____"
],
[
"# Набор данных взят с https://www.kaggle.com/aungpyaeap/fish-market\n# Параметры нескольких популярных промысловых рыб\n# length 1 = Body height\n# length 2 = Total Length\n# length 3 = Diagonal Length\nfish_data = pd.read_csv(\"datasets/Fish.csv\", delimiter=',')\nprint(fish_data)",
" Species Weight Length1 Length2 Length3 Height Width\n0 Bream 242.0 23.2 25.4 30.0 11.5200 4.0200\n1 Bream 290.0 24.0 26.3 31.2 12.4800 4.3056\n2 Bream 340.0 23.9 26.5 31.1 12.3778 4.6961\n3 Bream 363.0 26.3 29.0 33.5 12.7300 4.4555\n4 Bream 430.0 26.5 29.0 34.0 12.4440 5.1340\n.. ... ... ... ... ... ... ...\n154 Smelt 12.2 11.5 12.2 13.4 2.0904 1.3936\n155 Smelt 13.4 11.7 12.4 13.5 2.4300 1.2690\n156 Smelt 12.2 12.1 13.0 13.8 2.2770 1.2558\n157 Smelt 19.7 13.2 14.3 15.2 2.8728 2.0672\n158 Smelt 19.9 13.8 15.0 16.2 2.9322 1.8792\n\n[159 rows x 7 columns]\n"
],
[
"# Выделим две переменных\nx_label = 'Length1'\ny_label = 'Weight'\ndata = fish_data[[x_label, y_label]]\nprint(data)",
" Length1 Weight\n0 23.2 242.0\n1 24.0 290.0\n2 23.9 340.0\n3 26.3 363.0\n4 26.5 430.0\n.. ... ...\n154 11.5 12.2\n155 11.7 13.4\n156 12.1 12.2\n157 13.2 19.7\n158 13.8 19.9\n\n[159 rows x 2 columns]\n"
],
[
"# Определим размер валидационной и тестовой выборок\nval_test_size = round(0.2*len(data))\nprint(val_test_size)",
"32\n"
],
[
"# Генерируем уникальный seed\nmy_code = \"Грушин\"\nseed_limit = 2 ** 32\nmy_seed = int.from_bytes(my_code.encode(), \"little\") % seed_limit",
"_____no_output_____"
],
[
"# Создадим обучающую, валидационную и тестовую выборки\nrandom_state = my_seed\ntrain_val, test = train_test_split(data, test_size=val_test_size, random_state=random_state)\ntrain, val = train_test_split(train_val, test_size=val_test_size, random_state=random_state)\nprint(len(train), len(val), len(test))",
"95 32 32\n"
],
[
"# Преобразуем данные к ожидаемому библиотекой skleran формату\ntrain_x = np.array(train[x_label]).reshape(-1,1)\ntrain_y = np.array(train[y_label]).reshape(-1,1)\n\nval_x = np.array(val[x_label]).reshape(-1,1)\nval_y = np.array(val[y_label]).reshape(-1,1)\n\ntest_x = np.array(test[x_label]).reshape(-1,1)\ntest_y = np.array(test[y_label]).reshape(-1,1)",
"_____no_output_____"
],
[
"# Нарисуем график\nplt.plot(train_x, train_y, 'o')\nplt.show()",
"_____no_output_____"
],
[
"# Создадим модель линейной регрессии и обучим ее на обучающей выборке.\nmodel1 = linear_model.LinearRegression()\nmodel1.fit(train_x, train_y)",
"_____no_output_____"
],
[
"# Результат обучения: значения a и b: y = ax+b\nprint(model1.coef_, model1.intercept_)\n\na = model1.coef_[0]\nb = model1.intercept_\nprint(a, b)",
"[[32.10949939]] [-456.26208844]\n[32.10949939] [-456.26208844]\n"
],
[
"# Добавим полученную линию на график\nx = np.linspace(min(train_x), max(train_x), 100)\ny = a * x + b\n\nplt.plot(train_x, train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"# Проверим результат на валидационной выборке\nval_predicted = model1.predict(val_x)\nmse1 = mean_squared_error(val_y, val_predicted)\nprint(mse1)",
"23008.886530574833\n"
],
[
"# Результат не очень хорош для интерпретации, попробуем сначала нормировать значения\nscaler_x = MinMaxScaler()\nscaler_x.fit(train_x)\nscaled_train_x = scaler_x.transform(train_x)\n\nscaler_y = MinMaxScaler()\nscaler_y.fit(train_y)\nscaled_train_y = scaler_y.transform(train_y)\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.show()",
"_____no_output_____"
],
[
"# Строим модель и выводим результаты для нормированных данных\nmodel2 = linear_model.LinearRegression()\nmodel2.fit(scaled_train_x, scaled_train_y)\na = model2.coef_[0]\nb = model2.intercept_\n\nx = np.linspace(min(scaled_train_x), max(scaled_train_x), 100)\ny = a * x + b\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"# Проверим результат на валидационной выборке\nscaled_val_x = scaler_x.transform(val_x)\nscaled_val_y = scaler_y.transform(val_y)\n\nval_predicted = model2.predict(scaled_val_x)\n\nmse2 = mean_squared_error(scaled_val_y, val_predicted)\nprint(mse2)",
"0.008512147561336066\n"
],
[
"# Построим модель линейной регресси с L1-регуляризацией и выведем результаты для нормированных данных.\nmodel3 = linear_model.Lasso(alpha=0.01)\nmodel3.fit(scaled_train_x, scaled_train_y)\na = model3.coef_[0]\nb = model3.intercept_\n\nx = np.linspace(min(scaled_train_x), max(scaled_train_x), 100)\ny = a * x + b\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"# Проверим результат на валидационной выборке\nscaled_val_x = scaler_x.transform(val_x)\nscaled_val_y = scaler_y.transform(val_y)\n\nval_predicted = model3.predict(scaled_val_x)\n\nmse3 = mean_squared_error(scaled_val_y, val_predicted)\nprint(mse3)\n# Можете поэкспериментировать со значением параметра alpha, чтобы уменьшить ошибку",
"0.011836656874238584\n"
],
[
"# Построим модель линейной регресси с L2-регуляризацией и выведем результаты для нормированных данных\nmodel4 = linear_model.Ridge(alpha=0.01)\nmodel4.fit(scaled_train_x, scaled_train_y)\na = model4.coef_[0]\nb = model4.intercept_\n\nx = np.linspace(min(scaled_train_x), max(scaled_train_x), 100)\ny = a * x + b\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"# Проверим результат на валидационной выборке\nscaled_val_x = scaler_x.transform(val_x)\nscaled_val_y = scaler_y.transform(val_y)\n\nval_predicted = model4.predict(scaled_val_x)\n\nmse4 = mean_squared_error(scaled_val_y, val_predicted)\nprint(mse4)\n# Можете поэкспериментировать со значением параметра alpha, чтобы уменьшить ошибку",
"0.00851049517272038\n"
],
[
"# Построим модель линейной регресси с ElasticNet-регуляризацией и выведем результаты для нормированных данных\nmodel5 = linear_model.ElasticNet(alpha=0.01, l1_ratio = 0.01)\nmodel5.fit(scaled_train_x, scaled_train_y)\na = model5.coef_[0]\nb = model5.intercept_\n\nx = np.linspace(min(scaled_train_x), max(scaled_train_x), 100)\ny = a * x + b\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"# Проверим результат на валидационной выборке\nscaled_val_x = scaler_x.transform(val_x)\nscaled_val_y = scaler_y.transform(val_y)\n\nval_predicted = model5.predict(scaled_val_x)\n\nmse5 = mean_squared_error(scaled_val_y, val_predicted)\nprint(mse5)\n# Можете поэкспериментировать со значениями параметров alpha и l1_ratio, чтобы уменьшить ошибку",
"0.010480372359942994\n"
],
[
"# Выведем ошибки для моделей на нормированных данных\nprint(mse2, mse3, mse4, mse5)",
"0.008512147561336066 0.011836656874238584 0.00851049517272038 0.010480372359942994\n"
],
[
"# Минимальное значение достигается для второй модели, получим итоговую величину ошибки на тестовой выборке\nscaled_test_x = scaler_x.transform(test_x)\nscaled_test_y = scaler_y.transform(test_y)\n\ntest_predicted = model2.predict(scaled_test_x)\n\nmse_test = mean_squared_error(scaled_test_y, test_predicted)\nprint(mse_test)",
"0.009397408861721138\n"
],
[
"# Повторите выделение данных, нормирование, и анализ 4 моделей\n# (обычная линейная регрессия, L1-регуляризация, L2-регуляризация, ElasticNet-регуляризация)\n# для x = Length2 и y = Width.",
"_____no_output_____"
],
[
"x_label = 'Length2'\ny_label = 'Weight'\ndata = fish_data[[x_label, y_label]]\nprint(data)",
" Length2 Weight\n0 25.4 242.0\n1 26.3 290.0\n2 26.5 340.0\n3 29.0 363.0\n4 29.0 430.0\n.. ... ...\n154 12.2 12.2\n155 12.4 13.4\n156 13.0 12.2\n157 14.3 19.7\n158 15.0 19.9\n\n[159 rows x 2 columns]\n"
],
[
"x_label = 'Length2'\ny_label = 'Weight'\ndata = fish_data[[x_label, y_label]]\nprint(data)",
" Length2 Weight\n0 25.4 242.0\n1 26.3 290.0\n2 26.5 340.0\n3 29.0 363.0\n4 29.0 430.0\n.. ... ...\n154 12.2 12.2\n155 12.4 13.4\n156 13.0 12.2\n157 14.3 19.7\n158 15.0 19.9\n\n[159 rows x 2 columns]\n"
],
[
"val_test_size = round(0.2*len(data))\nprint(val_test_size)",
"32\n"
],
[
"random_state = my_seed\ntrain_val, test = train_test_split(data, test_size=val_test_size, random_state=random_state)\ntrain, val = train_test_split(train_val, test_size=val_test_size, random_state=random_state)\nprint(len(train), len(val), len(test))",
"95 32 32\n"
],
[
"train_x = np.array(train[x_label]).reshape(-1,1)\ntrain_y = np.array(train[y_label]).reshape(-1,1)\n\nval_x = np.array(val[x_label]).reshape(-1,1)\nval_y = np.array(val[y_label]).reshape(-1,1)\n\ntest_x = np.array(test[x_label]).reshape(-1,1)\ntest_y = np.array(test[y_label]).reshape(-1,1)",
"_____no_output_____"
],
[
"plt.plot(train_x, train_y, 'o')\nplt.show()",
"_____no_output_____"
],
[
"model1 = linear_model.LinearRegression().fit(train_x, train_y)",
"_____no_output_____"
],
[
"print(model1.coef_, model1.intercept_)\n\na = model1.coef_[0]\nb = model1.intercept_\nprint(a, b)",
"[[30.04619057]] [-466.93001909]\n[30.04619057] [-466.93001909]\n"
],
[
"x = np.linspace(min(train_x), max(train_x), 100)\ny = a * x + b\n\nplt.plot(train_x, train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"val_predicted = model1.predict(val_x)\nmse1 = mean_squared_error(val_y, val_predicted)\nprint(mse1)",
"22234.180815845015\n"
],
[
"scaler_x = MinMaxScaler().fit(train_x)\nscaled_train_x = scaler_x.transform(train_x)\n\nscaler_y = MinMaxScaler().fit(train_y)\nscaled_train_y = scaler_y.transform(train_y)\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.show()",
"_____no_output_____"
],
[
"model2 = linear_model.LinearRegression().fit(scaled_train_x, scaled_train_y)\na = model2.coef_[0]\nb = model2.intercept_\n\nx = np.linspace(min(scaled_train_x), max(scaled_train_x), 100)\ny = a * x + b\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"scaled_val_x = scaler_x.transform(val_x)\nscaled_val_y = scaler_y.transform(val_y)\n\nval_predicted = model2.predict(scaled_val_x)\n\nmse2 = mean_squared_error(scaled_val_y, val_predicted)\nprint(mse2)",
"0.008225544845831873\n"
],
[
"model3 = linear_model.Lasso(alpha=0.01).fit(scaled_train_x, scaled_train_y)\na = model3.coef_[0]\nb = model3.intercept_\n\nx = np.linspace(min(scaled_train_x), max(scaled_train_x), 100)\ny = a * x + b\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"scaled_val_x = scaler_x.transform(val_x)\nscaled_val_y = scaler_y.transform(val_y)\n\nval_predicted = model3.predict(scaled_val_x)\n\nmse3 = mean_squared_error(scaled_val_y, val_predicted)\nprint(mse3)",
"0.011544333941279808\n"
],
[
"model4 = linear_model.Ridge(alpha=0.01).fit(scaled_train_x, scaled_train_y)\na = model4.coef_[0]\nb = model4.intercept_\n\nx = np.linspace(min(scaled_train_x), max(scaled_train_x), 100)\ny = a * x + b\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"scaled_val_x = scaler_x.transform(val_x)\nscaled_val_y = scaler_y.transform(val_y)\n\nval_predicted = model4.predict(scaled_val_x)\n\nmse4 = mean_squared_error(scaled_val_y, val_predicted)\nprint(mse4)",
"0.008224323261085301\n"
],
[
"model5 = linear_model.ElasticNet(alpha=0.01, l1_ratio = 0.01)\nmodel5.fit(scaled_train_x, scaled_train_y)\na = model5.coef_[0]\nb = model5.intercept_\n\nx = np.linspace(min(scaled_train_x), max(scaled_train_x), 100)\ny = a * x + b\n\nplt.plot(scaled_train_x, scaled_train_y, 'o')\nplt.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"scaled_val_x = scaler_x.transform(val_x)\nscaled_val_y = scaler_y.transform(val_y)\n\nval_predicted = model5.predict(scaled_val_x)\n\nmse5 = mean_squared_error(scaled_val_y, val_predicted)\nprint(mse5)",
"0.010203429713347985\n"
],
[
"print(mse2, mse3, mse4, mse5)",
"0.008225544845831873 0.011544333941279808 0.008224323261085301 0.010203429713347985\n"
],
[
"scaled_test_x = scaler_x.transform(test_x)\nscaled_test_y = scaler_y.transform(test_y)\n\ntest_predicted = model2.predict(scaled_test_x)\n\nmse_test = mean_squared_error(scaled_test_y, test_predicted)\nprint(mse_test)",
"0.009226188986350544\n"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb699f66d9a8400aeaf1bfba29900a9fc5865abc | 160,944 | ipynb | Jupyter Notebook | courses/machine_learning/deepdive/03_tensorflow/b_estimator_le.ipynb | nhanle83/training-data-analyst | 21d61a02b8e760a32c5b7f6164d13be6fb511f40 | [
"Apache-2.0"
]
| null | null | null | courses/machine_learning/deepdive/03_tensorflow/b_estimator_le.ipynb | nhanle83/training-data-analyst | 21d61a02b8e760a32c5b7f6164d13be6fb511f40 | [
"Apache-2.0"
]
| null | null | null | courses/machine_learning/deepdive/03_tensorflow/b_estimator_le.ipynb | nhanle83/training-data-analyst | 21d61a02b8e760a32c5b7f6164d13be6fb511f40 | [
"Apache-2.0"
]
| null | null | null | 64.403361 | 1,522 | 0.561183 | [
[
[
"<h1>2b. Machine Learning using tf.estimator </h1>\n\nIn this notebook, we will create a machine learning model using tf.estimator and evaluate its performance. The dataset is rather small (7700 samples), so we can do it all in-memory. We will also simply pass the raw data in as-is. ",
"_____no_output_____"
]
],
[
[
"import tensorflow as tf\nimport pandas as pd\nimport numpy as np\nimport shutil\n\nprint(tf.__version__)",
"2.2.0\n"
]
],
[
[
"Read data created in the previous chapter.",
"_____no_output_____"
]
],
[
[
"# In CSV, label is the first column, after the features, followed by the key\nCSV_COLUMNS = ['fare_amount', 'pickuplon','pickuplat','dropofflon','dropofflat','passengers', 'key']\nFEATURES = CSV_COLUMNS[1:len(CSV_COLUMNS) - 1]\nLABEL = CSV_COLUMNS[0]\n\ndf_train = pd.read_csv('https://raw.githubusercontent.com/nhanle83/training-data-analyst/master/courses/machine_learning/deepdive/03_tensorflow/taxi-train.csv', header = None, names = CSV_COLUMNS)\ndf_valid = pd.read_csv('https://raw.githubusercontent.com/nhanle83/training-data-analyst/master/courses/machine_learning/deepdive/03_tensorflow/taxi-valid.csv', header = None, names = CSV_COLUMNS)\ndf_test = pd.read_csv('https://raw.githubusercontent.com/nhanle83/training-data-analyst/master/courses/machine_learning/deepdive/03_tensorflow/taxi-test.csv', header = None, names = CSV_COLUMNS)",
"_____no_output_____"
]
],
[
[
"<h2> Train and eval input functions to read from Pandas Dataframe </h2>",
"_____no_output_____"
]
],
[
[
"def make_train_input_fn(df, num_epochs):\n return tf.compat.v1.estimator.inputs.pandas_input_fn(\n x = df,\n y = df[LABEL],\n batch_size = 128,\n num_epochs = num_epochs,\n shuffle = True,\n queue_capacity = 1000\n )",
"_____no_output_____"
],
[
"def make_eval_input_fn(df):\n return tf.compat.v1.estimator.inputs.pandas_input_fn(\n x = df,\n y = df[LABEL],\n batch_size = 128,\n shuffle = False,\n queue_capacity = 1000\n )",
"_____no_output_____"
]
],
[
[
"Our input function for predictions is the same except we don't provide a label",
"_____no_output_____"
]
],
[
[
"def make_prediction_input_fn(df):\n return tf.compat.v1.estimator.inputs.pandas_input_fn(\n x = df,\n y = None,\n batch_size = 128,\n shuffle = False,\n queue_capacity = 1000\n )",
"_____no_output_____"
]
],
[
[
"### Create feature columns for estimator",
"_____no_output_____"
]
],
[
[
"def make_feature_cols():\n input_columns = [tf.feature_column.numeric_column(k) for k in FEATURES]\n return input_columns",
"_____no_output_____"
]
],
[
[
"<h3> Linear Regression with tf.Estimator framework </h3>",
"_____no_output_____"
]
],
[
[
"tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.INFO)\n\nOUTDIR = 'taxi_trained'\nshutil.rmtree(OUTDIR, ignore_errors = True) # start fresh each time\n\nmodel = tf.estimator.LinearRegressor(\n feature_columns = make_feature_cols(), model_dir = OUTDIR)\n\nmodel.train(input_fn = make_train_input_fn(df_train, num_epochs = 10))",
"INFO:tensorflow:Using default config.\nINFO:tensorflow:Using config: {'_model_dir': 'taxi_trained', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true\ngraph_options {\n rewrite_options {\n meta_optimizer_iterations: ONE\n }\n}\n, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_experimental_max_worker_delay_secs': None, '_session_creation_timeout_secs': 7200, '_service': None, '_cluster_spec': ClusterSpec({}), '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}\nWARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/util/lazy_loader.py:63: The name tf.estimator.inputs is deprecated. Please use tf.compat.v1.estimator.inputs instead.\n\nWARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/resource_variable_ops.py:1666: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.\nInstructions for updating:\nIf using Keras pass *_constraint arguments to layers.\nWARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/training_util.py:236: Variable.initialized_value (from tensorflow.python.ops.variables) is deprecated and will be removed in a future version.\nInstructions for updating:\nUse Variable.read_value. Variables in 2.X are initialized automatically both in eager and graph (inside tf.defun) contexts.\nWARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/inputs/queues/feeding_queue_runner.py:65: QueueRunner.__init__ (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.\nInstructions for updating:\nTo construct input pipelines, use the `tf.data` module.\nWARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_estimator/python/estimator/inputs/queues/feeding_functions.py:491: add_queue_runner (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.\nInstructions for updating:\nTo construct input pipelines, use the `tf.data` module.\nINFO:tensorflow:Calling model_fn.\nWARNING:tensorflow:Layer linear/linear_model is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because it's dtype defaults to floatx.\n\nIf you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n\nTo change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n\nWARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/feature_column/feature_column_v2.py:540: Layer.add_variable (from tensorflow.python.keras.engine.base_layer_v1) is deprecated and will be removed in a future version.\nInstructions for updating:\nPlease use `layer.add_weight` method instead.\nWARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/optimizer_v2/ftrl.py:144: calling Constant.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version.\nInstructions for updating:\nCall initializer instance with the dtype argument instead of passing it to the constructor\nINFO:tensorflow:Done calling model_fn.\nINFO:tensorflow:Create CheckpointSaverHook.\nINFO:tensorflow:Graph was finalized.\nINFO:tensorflow:Running local_init_op.\nINFO:tensorflow:Done running local_init_op.\nWARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/monitored_session.py:906: start_queue_runners (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.\nInstructions for updating:\nTo construct input pipelines, use the `tf.data` module.\nINFO:tensorflow:Calling checkpoint listeners before saving checkpoint 0...\nINFO:tensorflow:Saving checkpoints for 0 into taxi_trained/model.ckpt.\nINFO:tensorflow:Calling checkpoint listeners after saving checkpoint 0...\nINFO:tensorflow:loss = 165.2717, step = 0\nINFO:tensorflow:global_step/sec: 307.998\nINFO:tensorflow:loss = 75.20803, step = 100 (0.331 sec)\nWARNING:tensorflow:It seems that global step (tf.train.get_global_step) has not been increased. Current value (could be stable): 187 vs previous value: 187. You could increase the global step by passing tf.train.get_global_step() to Optimizer.apply_gradients or Optimizer.minimize.\nINFO:tensorflow:global_step/sec: 331.088\nINFO:tensorflow:loss = 90.64622, step = 200 (0.302 sec)\nINFO:tensorflow:global_step/sec: 336.98\nINFO:tensorflow:loss = 77.86865, step = 300 (0.295 sec)\nINFO:tensorflow:global_step/sec: 349.353\nINFO:tensorflow:loss = 42.105957, step = 400 (0.283 sec)\nINFO:tensorflow:global_step/sec: 332.046\nINFO:tensorflow:loss = 107.32366, step = 500 (0.301 sec)\nINFO:tensorflow:global_step/sec: 322.907\nINFO:tensorflow:loss = 61.4199, step = 600 (0.313 sec)\nINFO:tensorflow:Calling checkpoint listeners before saving checkpoint 608...\nINFO:tensorflow:Saving checkpoints for 608 into taxi_trained/model.ckpt.\nINFO:tensorflow:Calling checkpoint listeners after saving checkpoint 608...\nINFO:tensorflow:Loss for final step: 10.311098.\n"
]
],
[
[
"Evaluate on the validation data (we should defer using the test data to after we have selected a final model).",
"_____no_output_____"
]
],
[
[
"def print_rmse(model, df):\n metrics = model.evaluate(input_fn = make_eval_input_fn(df))\n print('RMSE on dataset = {}'.format(np.sqrt(metrics['average_loss'])))\nprint_rmse(model, df_valid)",
"INFO:tensorflow:Calling model_fn.\nWARNING:tensorflow:Layer linear/linear_model is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because it's dtype defaults to floatx.\n\nIf you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n\nTo change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n\nINFO:tensorflow:Done calling model_fn.\nINFO:tensorflow:Starting evaluation at 2020-06-02T16:25:03Z\nINFO:tensorflow:Graph was finalized.\nINFO:tensorflow:Restoring parameters from taxi_trained/model.ckpt-608\nINFO:tensorflow:Running local_init_op.\nINFO:tensorflow:Done running local_init_op.\nINFO:tensorflow:Inference Time : 0.29355s\nINFO:tensorflow:Finished evaluation at 2020-06-02-16:25:03\nINFO:tensorflow:Saving dict for global step 608: average_loss = 112.42834, global_step = 608, label/mean = 11.666427, loss = 107.311104, prediction/mean = 9.766562\nINFO:tensorflow:Saving 'checkpoint_path' summary for global step 608: taxi_trained/model.ckpt-608\nRMSE on dataset = 10.603222846984863\n"
]
],
[
[
"This is nowhere near our benchmark (RMSE of $6 or so on this data), but it serves to demonstrate what TensorFlow code looks like. Let's use this model for prediction.",
"_____no_output_____"
]
],
[
[
"predictions = model.predict(input_fn = make_prediction_input_fn(df_test))\nfor items in predictions:\n print(items)",
"INFO:tensorflow:Calling model_fn.\nWARNING:tensorflow:Layer linear/linear_model is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because it's dtype defaults to floatx.\n\nIf you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n\nTo change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n\nINFO:tensorflow:Done calling model_fn.\nINFO:tensorflow:Graph was finalized.\nINFO:tensorflow:Restoring parameters from taxi_trained/model.ckpt-608\nINFO:tensorflow:Running local_init_op.\nINFO:tensorflow:Done running local_init_op.\n{'predictions': array([9.726718], dtype=float32)}\n{'predictions': array([9.724442], dtype=float32)}\n{'predictions': array([9.725209], dtype=float32)}\n{'predictions': array([9.723027], dtype=float32)}\n{'predictions': array([9.726483], dtype=float32)}\n{'predictions': array([9.726289], dtype=float32)}\n{'predictions': array([9.72502], dtype=float32)}\n{'predictions': array([9.725047], dtype=float32)}\n{'predictions': array([9.726619], dtype=float32)}\n{'predictions': array([9.7247095], dtype=float32)}\n{'predictions': array([9.72672], dtype=float32)}\n{'predictions': array([9.726867], dtype=float32)}\n{'predictions': array([9.720862], dtype=float32)}\n{'predictions': array([9.724363], dtype=float32)}\n{'predictions': array([9.783644], dtype=float32)}\n{'predictions': array([9.725088], dtype=float32)}\n{'predictions': array([9.725838], dtype=float32)}\n{'predictions': array([9.784555], dtype=float32)}\n{'predictions': array([9.72613], dtype=float32)}\n{'predictions': array([9.723601], dtype=float32)}\n{'predictions': array([9.72472], dtype=float32)}\n{'predictions': array([9.721061], dtype=float32)}\n{'predictions': array([9.724854], dtype=float32)}\n{'predictions': array([9.78559], dtype=float32)}\n{'predictions': array([9.727254], dtype=float32)}\n{'predictions': array([9.718138], dtype=float32)}\n{'predictions': array([9.839448], dtype=float32)}\n{'predictions': array([10.018414], dtype=float32)}\n{'predictions': array([9.727683], dtype=float32)}\n{'predictions': array([9.728599], dtype=float32)}\n{'predictions': array([9.960585], dtype=float32)}\n{'predictions': array([9.723653], dtype=float32)}\n{'predictions': array([9.724241], dtype=float32)}\n{'predictions': array([9.726697], dtype=float32)}\n{'predictions': array([9.841256], dtype=float32)}\n{'predictions': array([9.725913], dtype=float32)}\n{'predictions': array([9.7243595], dtype=float32)}\n{'predictions': array([9.720987], dtype=float32)}\n{'predictions': array([9.899904], dtype=float32)}\n{'predictions': array([9.721293], dtype=float32)}\n{'predictions': array([9.725505], dtype=float32)}\n{'predictions': array([9.723724], dtype=float32)}\n{'predictions': array([9.723465], dtype=float32)}\n{'predictions': array([9.723829], dtype=float32)}\n{'predictions': array([9.782693], dtype=float32)}\n{'predictions': array([9.725484], dtype=float32)}\n{'predictions': array([9.781227], dtype=float32)}\n{'predictions': array([9.957237], dtype=float32)}\n{'predictions': array([9.725733], dtype=float32)}\n{'predictions': array([9.72417], dtype=float32)}\n{'predictions': array([9.727629], dtype=float32)}\n{'predictions': array([9.958014], dtype=float32)}\n{'predictions': array([9.724597], dtype=float32)}\n{'predictions': array([9.72556], dtype=float32)}\n{'predictions': array([9.724111], dtype=float32)}\n{'predictions': array([9.725178], dtype=float32)}\n{'predictions': array([9.724111], dtype=float32)}\n{'predictions': array([9.960959], dtype=float32)}\n{'predictions': array([9.724666], dtype=float32)}\n{'predictions': array([9.780099], dtype=float32)}\n{'predictions': array([9.726661], dtype=float32)}\n{'predictions': array([9.843256], dtype=float32)}\n{'predictions': array([9.724408], dtype=float32)}\n{'predictions': array([9.725462], dtype=float32)}\n{'predictions': array([9.841197], dtype=float32)}\n{'predictions': array([9.724517], dtype=float32)}\n{'predictions': array([9.7259245], dtype=float32)}\n{'predictions': array([9.727225], dtype=float32)}\n{'predictions': array([9.724561], dtype=float32)}\n{'predictions': array([9.725075], dtype=float32)}\n{'predictions': array([9.7208805], dtype=float32)}\n{'predictions': array([9.725429], dtype=float32)}\n{'predictions': array([9.783292], dtype=float32)}\n{'predictions': array([9.724694], dtype=float32)}\n{'predictions': array([9.72475], dtype=float32)}\n{'predictions': array([9.725245], dtype=float32)}\n{'predictions': array([9.72714], dtype=float32)}\n{'predictions': array([9.72447], dtype=float32)}\n{'predictions': array([9.9610615], dtype=float32)}\n{'predictions': array([9.782664], dtype=float32)}\n{'predictions': array([9.725964], dtype=float32)}\n{'predictions': array([9.724692], dtype=float32)}\n{'predictions': array([9.724697], dtype=float32)}\n{'predictions': array([9.779641], dtype=float32)}\n{'predictions': array([9.72042], dtype=float32)}\n{'predictions': array([9.841562], dtype=float32)}\n{'predictions': array([9.958609], dtype=float32)}\n{'predictions': array([9.959315], dtype=float32)}\n{'predictions': array([9.726678], dtype=float32)}\n{'predictions': array([9.726019], dtype=float32)}\n{'predictions': array([9.722673], dtype=float32)}\n{'predictions': array([9.725657], dtype=float32)}\n{'predictions': array([9.944328], dtype=float32)}\n{'predictions': array([9.781667], dtype=float32)}\n{'predictions': array([9.720032], dtype=float32)}\n{'predictions': array([9.725064], dtype=float32)}\n{'predictions': array([9.725455], dtype=float32)}\n{'predictions': array([9.958272], dtype=float32)}\n{'predictions': array([9.724999], dtype=float32)}\n{'predictions': array([9.731815], dtype=float32)}\n{'predictions': array([9.724036], dtype=float32)}\n{'predictions': array([9.7837105], dtype=float32)}\n{'predictions': array([9.722228], dtype=float32)}\n{'predictions': array([9.722812], dtype=float32)}\n{'predictions': array([9.7214155], dtype=float32)}\n{'predictions': array([9.725484], dtype=float32)}\n{'predictions': array([9.959672], dtype=float32)}\n{'predictions': array([9.722972], dtype=float32)}\n{'predictions': array([9.842628], dtype=float32)}\n{'predictions': array([9.726547], dtype=float32)}\n{'predictions': array([9.725196], dtype=float32)}\n{'predictions': array([9.724801], dtype=float32)}\n{'predictions': array([9.72566], dtype=float32)}\n{'predictions': array([9.726966], dtype=float32)}\n{'predictions': array([9.726391], dtype=float32)}\n{'predictions': array([9.723705], dtype=float32)}\n{'predictions': array([9.724882], dtype=float32)}\n{'predictions': array([9.7263], dtype=float32)}\n{'predictions': array([9.726377], dtype=float32)}\n{'predictions': array([9.723975], dtype=float32)}\n{'predictions': array([9.725617], dtype=float32)}\n{'predictions': array([9.784688], dtype=float32)}\n{'predictions': array([9.841853], dtype=float32)}\n{'predictions': array([9.725582], dtype=float32)}\n{'predictions': array([9.724923], dtype=float32)}\n{'predictions': array([9.724866], dtype=float32)}\n{'predictions': array([9.72375], dtype=float32)}\n{'predictions': array([9.725316], dtype=float32)}\n{'predictions': array([9.726414], dtype=float32)}\n{'predictions': array([9.723294], dtype=float32)}\n{'predictions': array([9.7256365], dtype=float32)}\n{'predictions': array([9.723538], dtype=float32)}\n{'predictions': array([9.723848], dtype=float32)}\n{'predictions': array([9.725479], dtype=float32)}\n{'predictions': array([9.724347], dtype=float32)}\n{'predictions': array([9.785159], dtype=float32)}\n{'predictions': array([9.721809], dtype=float32)}\n{'predictions': array([9.709054], dtype=float32)}\n{'predictions': array([9.726695], dtype=float32)}\n{'predictions': array([9.725551], dtype=float32)}\n{'predictions': array([9.724984], dtype=float32)}\n{'predictions': array([10.018794], dtype=float32)}\n{'predictions': array([9.725047], dtype=float32)}\n{'predictions': array([9.724077], dtype=float32)}\n{'predictions': array([9.84159], dtype=float32)}\n{'predictions': array([9.725584], dtype=float32)}\n{'predictions': array([9.780862], dtype=float32)}\n{'predictions': array([9.725383], dtype=float32)}\n{'predictions': array([9.724476], dtype=float32)}\n{'predictions': array([9.784211], dtype=float32)}\n{'predictions': array([9.727616], dtype=float32)}\n{'predictions': array([9.84221], dtype=float32)}\n{'predictions': array([9.724162], dtype=float32)}\n{'predictions': array([9.725882], dtype=float32)}\n{'predictions': array([9.782578], dtype=float32)}\n{'predictions': array([9.725507], dtype=float32)}\n{'predictions': array([9.7251005], dtype=float32)}\n{'predictions': array([9.726012], dtype=float32)}\n{'predictions': array([9.959081], dtype=float32)}\n{'predictions': array([9.724424], dtype=float32)}\n{'predictions': array([9.724109], dtype=float32)}\n{'predictions': array([9.782938], dtype=float32)}\n{'predictions': array([9.725823], dtype=float32)}\n{'predictions': array([9.725456], dtype=float32)}\n{'predictions': array([9.725066], dtype=float32)}\n{'predictions': array([9.724863], dtype=float32)}\n{'predictions': array([9.724526], dtype=float32)}\n{'predictions': array([9.726809], dtype=float32)}\n{'predictions': array([9.784623], dtype=float32)}\n{'predictions': array([9.723687], dtype=float32)}\n{'predictions': array([9.959953], dtype=float32)}\n{'predictions': array([9.7844], dtype=float32)}\n{'predictions': array([9.727294], dtype=float32)}\n{'predictions': array([9.7243805], dtype=float32)}\n{'predictions': array([9.722365], dtype=float32)}\n{'predictions': array([9.725341], dtype=float32)}\n{'predictions': array([9.783867], dtype=float32)}\n{'predictions': array([9.724878], dtype=float32)}\n{'predictions': array([9.843457], dtype=float32)}\n{'predictions': array([9.725145], dtype=float32)}\n{'predictions': array([9.72722], dtype=float32)}\n{'predictions': array([9.724718], dtype=float32)}\n{'predictions': array([9.726238], dtype=float32)}\n{'predictions': array([9.727197], dtype=float32)}\n{'predictions': array([9.844184], dtype=float32)}\n{'predictions': array([9.725104], dtype=float32)}\n{'predictions': array([9.72525], dtype=float32)}\n{'predictions': array([9.783634], dtype=float32)}\n{'predictions': array([9.833827], dtype=float32)}\n{'predictions': array([9.726846], dtype=float32)}\n{'predictions': array([10.017123], dtype=float32)}\n{'predictions': array([9.7250805], dtype=float32)}\n{'predictions': array([9.725733], dtype=float32)}\n{'predictions': array([9.726596], dtype=float32)}\n{'predictions': array([9.723136], dtype=float32)}\n{'predictions': array([9.720099], dtype=float32)}\n{'predictions': array([10.01964], dtype=float32)}\n{'predictions': array([9.724332], dtype=float32)}\n{'predictions': array([9.7246895], dtype=float32)}\n{'predictions': array([9.726466], dtype=float32)}\n{'predictions': array([9.722371], dtype=float32)}\n{'predictions': array([9.719531], dtype=float32)}\n{'predictions': array([9.7232065], dtype=float32)}\n{'predictions': array([9.725944], dtype=float32)}\n{'predictions': array([9.725064], dtype=float32)}\n{'predictions': array([9.784287], dtype=float32)}\n{'predictions': array([9.727815], dtype=float32)}\n{'predictions': array([9.724498], dtype=float32)}\n{'predictions': array([9.727143], dtype=float32)}\n{'predictions': array([9.724949], dtype=float32)}\n{'predictions': array([9.95938], dtype=float32)}\n{'predictions': array([9.725091], dtype=float32)}\n{'predictions': array([9.725089], dtype=float32)}\n{'predictions': array([9.7251215], dtype=float32)}\n{'predictions': array([9.721162], dtype=float32)}\n{'predictions': array([9.726045], dtype=float32)}\n{'predictions': array([9.725489], dtype=float32)}\n{'predictions': array([9.725555], dtype=float32)}\n{'predictions': array([9.724574], dtype=float32)}\n{'predictions': array([9.723772], dtype=float32)}\n{'predictions': array([9.724112], dtype=float32)}\n{'predictions': array([9.725653], dtype=float32)}\n{'predictions': array([9.7258835], dtype=float32)}\n{'predictions': array([9.726539], dtype=float32)}\n{'predictions': array([9.72441], dtype=float32)}\n{'predictions': array([9.725342], dtype=float32)}\n{'predictions': array([9.727819], dtype=float32)}\n{'predictions': array([9.737146], dtype=float32)}\n{'predictions': array([9.782958], dtype=float32)}\n{'predictions': array([9.957443], dtype=float32)}\n{'predictions': array([9.723662], dtype=float32)}\n{'predictions': array([9.725569], dtype=float32)}\n{'predictions': array([9.96027], dtype=float32)}\n{'predictions': array([9.724036], dtype=float32)}\n{'predictions': array([9.726001], dtype=float32)}\n{'predictions': array([9.783478], dtype=float32)}\n{'predictions': array([9.784147], dtype=float32)}\n{'predictions': array([9.84098], dtype=float32)}\n{'predictions': array([9.725062], dtype=float32)}\n{'predictions': array([9.959764], dtype=float32)}\n{'predictions': array([9.724196], dtype=float32)}\n{'predictions': array([9.84156], dtype=float32)}\n{'predictions': array([9.720343], dtype=float32)}\n{'predictions': array([9.718031], dtype=float32)}\n{'predictions': array([9.722922], dtype=float32)}\n{'predictions': array([9.724393], dtype=float32)}\n{'predictions': array([9.708912], dtype=float32)}\n{'predictions': array([9.72463], dtype=float32)}\n{'predictions': array([9.711859], dtype=float32)}\n{'predictions': array([9.782971], dtype=float32)}\n{'predictions': array([9.726588], dtype=float32)}\n{'predictions': array([9.726127], dtype=float32)}\n{'predictions': array([9.784314], dtype=float32)}\n{'predictions': array([9.779059], dtype=float32)}\n{'predictions': array([9.785183], dtype=float32)}\n{'predictions': array([9.723587], dtype=float32)}\n{'predictions': array([9.721013], dtype=float32)}\n{'predictions': array([9.842243], dtype=float32)}\n{'predictions': array([9.723325], dtype=float32)}\n{'predictions': array([9.726414], dtype=float32)}\n{'predictions': array([9.725702], dtype=float32)}\n{'predictions': array([9.784448], dtype=float32)}\n{'predictions': array([9.84204], dtype=float32)}\n{'predictions': array([9.725202], dtype=float32)}\n{'predictions': array([9.901807], dtype=float32)}\n{'predictions': array([9.78222], dtype=float32)}\n{'predictions': array([9.7254095], dtype=float32)}\n{'predictions': array([9.722644], dtype=float32)}\n{'predictions': array([9.712816], dtype=float32)}\n{'predictions': array([9.72422], dtype=float32)}\n{'predictions': array([9.784614], dtype=float32)}\n{'predictions': array([9.725436], dtype=float32)}\n{'predictions': array([9.95776], dtype=float32)}\n{'predictions': array([9.725647], dtype=float32)}\n{'predictions': array([9.726389], dtype=float32)}\n{'predictions': array([9.726981], dtype=float32)}\n{'predictions': array([9.724832], dtype=float32)}\n{'predictions': array([9.721966], dtype=float32)}\n{'predictions': array([9.724926], dtype=float32)}\n{'predictions': array([9.724988], dtype=float32)}\n{'predictions': array([9.844723], dtype=float32)}\n{'predictions': array([9.720786], dtype=float32)}\n{'predictions': array([9.901685], dtype=float32)}\n{'predictions': array([9.7243395], dtype=float32)}\n{'predictions': array([9.726422], dtype=float32)}\n{'predictions': array([9.723157], dtype=float32)}\n{'predictions': array([9.783338], dtype=float32)}\n{'predictions': array([9.725082], dtype=float32)}\n{'predictions': array([10.016497], dtype=float32)}\n{'predictions': array([9.724619], dtype=float32)}\n{'predictions': array([9.725265], dtype=float32)}\n{'predictions': array([9.724267], dtype=float32)}\n{'predictions': array([9.784078], dtype=float32)}\n{'predictions': array([9.728163], dtype=float32)}\n{'predictions': array([9.786093], dtype=float32)}\n{'predictions': array([9.783533], dtype=float32)}\n{'predictions': array([9.957854], dtype=float32)}\n{'predictions': array([9.829047], dtype=float32)}\n{'predictions': array([9.725893], dtype=float32)}\n{'predictions': array([9.900955], dtype=float32)}\n{'predictions': array([9.7839155], dtype=float32)}\n{'predictions': array([9.783788], dtype=float32)}\n{'predictions': array([9.723327], dtype=float32)}\n{'predictions': array([9.726438], dtype=float32)}\n{'predictions': array([9.725391], dtype=float32)}\n{'predictions': array([9.842688], dtype=float32)}\n{'predictions': array([9.784757], dtype=float32)}\n{'predictions': array([9.712795], dtype=float32)}\n{'predictions': array([9.727633], dtype=float32)}\n{'predictions': array([9.7250185], dtype=float32)}\n{'predictions': array([9.724111], dtype=float32)}\n{'predictions': array([9.726572], dtype=float32)}\n{'predictions': array([9.725914], dtype=float32)}\n{'predictions': array([9.783327], dtype=float32)}\n{'predictions': array([9.841643], dtype=float32)}\n{'predictions': array([9.724807], dtype=float32)}\n{'predictions': array([9.724883], dtype=float32)}\n{'predictions': array([9.725762], dtype=float32)}\n{'predictions': array([9.72572], dtype=float32)}\n{'predictions': array([9.84255], dtype=float32)}\n{'predictions': array([9.722452], dtype=float32)}\n{'predictions': array([9.725704], dtype=float32)}\n{'predictions': array([9.842524], dtype=float32)}\n{'predictions': array([9.724559], dtype=float32)}\n{'predictions': array([9.725569], dtype=float32)}\n{'predictions': array([9.830285], dtype=float32)}\n{'predictions': array([9.955196], dtype=float32)}\n{'predictions': array([9.674155], dtype=float32)}\n{'predictions': array([9.712735], dtype=float32)}\n{'predictions': array([9.720849], dtype=float32)}\n{'predictions': array([9.724487], dtype=float32)}\n{'predictions': array([9.723826], dtype=float32)}\n{'predictions': array([9.725539], dtype=float32)}\n{'predictions': array([9.784197], dtype=float32)}\n{'predictions': array([9.721361], dtype=float32)}\n{'predictions': array([9.725081], dtype=float32)}\n{'predictions': array([9.785752], dtype=float32)}\n{'predictions': array([9.954724], dtype=float32)}\n{'predictions': array([9.957596], dtype=float32)}\n{'predictions': array([9.725353], dtype=float32)}\n{'predictions': array([9.725696], dtype=float32)}\n{'predictions': array([9.722679], dtype=float32)}\n{'predictions': array([9.727958], dtype=float32)}\n{'predictions': array([9.721428], dtype=float32)}\n{'predictions': array([9.7250395], dtype=float32)}\n{'predictions': array([9.726981], dtype=float32)}\n{'predictions': array([9.724625], dtype=float32)}\n{'predictions': array([9.728142], dtype=float32)}\n{'predictions': array([9.725176], dtype=float32)}\n{'predictions': array([9.7255335], dtype=float32)}\n{'predictions': array([9.785445], dtype=float32)}\n{'predictions': array([9.724636], dtype=float32)}\n{'predictions': array([9.841739], dtype=float32)}\n{'predictions': array([9.89712], dtype=float32)}\n{'predictions': array([9.783185], dtype=float32)}\n{'predictions': array([9.726086], dtype=float32)}\n{'predictions': array([9.725429], dtype=float32)}\n{'predictions': array([9.721398], dtype=float32)}\n{'predictions': array([9.724075], dtype=float32)}\n{'predictions': array([9.726568], dtype=float32)}\n{'predictions': array([9.724485], dtype=float32)}\n{'predictions': array([9.719112], dtype=float32)}\n{'predictions': array([9.725079], dtype=float32)}\n{'predictions': array([9.723508], dtype=float32)}\n{'predictions': array([9.7246895], dtype=float32)}\n{'predictions': array([9.726766], dtype=float32)}\n{'predictions': array([9.724579], dtype=float32)}\n{'predictions': array([10.015519], dtype=float32)}\n{'predictions': array([9.724505], dtype=float32)}\n{'predictions': array([9.7246275], dtype=float32)}\n{'predictions': array([9.958806], dtype=float32)}\n{'predictions': array([9.783944], dtype=float32)}\n{'predictions': array([9.725086], dtype=float32)}\n{'predictions': array([9.778887], dtype=float32)}\n{'predictions': array([9.725333], dtype=float32)}\n{'predictions': array([9.724004], dtype=float32)}\n{'predictions': array([9.7259], dtype=float32)}\n{'predictions': array([9.783613], dtype=float32)}\n{'predictions': array([9.72657], dtype=float32)}\n{'predictions': array([9.842469], dtype=float32)}\n{'predictions': array([9.727273], dtype=float32)}\n{'predictions': array([9.78227], dtype=float32)}\n{'predictions': array([9.725059], dtype=float32)}\n{'predictions': array([9.725999], dtype=float32)}\n{'predictions': array([9.78455], dtype=float32)}\n{'predictions': array([9.726149], dtype=float32)}\n{'predictions': array([9.723402], dtype=float32)}\n{'predictions': array([9.725814], dtype=float32)}\n{'predictions': array([9.722051], dtype=float32)}\n{'predictions': array([9.785986], dtype=float32)}\n{'predictions': array([9.726263], dtype=float32)}\n{'predictions': array([9.712573], dtype=float32)}\n{'predictions': array([9.723683], dtype=float32)}\n{'predictions': array([9.783054], dtype=float32)}\n{'predictions': array([10.018], dtype=float32)}\n{'predictions': array([9.724948], dtype=float32)}\n{'predictions': array([9.786532], dtype=float32)}\n{'predictions': array([9.727529], dtype=float32)}\n{'predictions': array([9.726622], dtype=float32)}\n{'predictions': array([9.783982], dtype=float32)}\n{'predictions': array([9.725244], dtype=float32)}\n{'predictions': array([9.724842], dtype=float32)}\n{'predictions': array([9.78447], dtype=float32)}\n{'predictions': array([9.724386], dtype=float32)}\n{'predictions': array([9.78479], dtype=float32)}\n{'predictions': array([9.842224], dtype=float32)}\n{'predictions': array([9.724519], dtype=float32)}\n{'predictions': array([9.724194], dtype=float32)}\n{'predictions': array([9.725108], dtype=float32)}\n{'predictions': array([9.727181], dtype=float32)}\n{'predictions': array([9.72268], dtype=float32)}\n{'predictions': array([9.782938], dtype=float32)}\n{'predictions': array([9.724412], dtype=float32)}\n{'predictions': array([9.959206], dtype=float32)}\n{'predictions': array([9.775265], dtype=float32)}\n{'predictions': array([9.725266], dtype=float32)}\n{'predictions': array([9.726459], dtype=float32)}\n{'predictions': array([9.770663], dtype=float32)}\n{'predictions': array([9.725056], dtype=float32)}\n{'predictions': array([9.784239], dtype=float32)}\n{'predictions': array([9.725973], dtype=float32)}\n{'predictions': array([9.7832365], dtype=float32)}\n{'predictions': array([9.841886], dtype=float32)}\n{'predictions': array([9.725704], dtype=float32)}\n{'predictions': array([9.720955], dtype=float32)}\n{'predictions': array([9.723829], dtype=float32)}\n{'predictions': array([9.841203], dtype=float32)}\n{'predictions': array([9.840651], dtype=float32)}\n{'predictions': array([9.727334], dtype=float32)}\n{'predictions': array([9.78393], dtype=float32)}\n{'predictions': array([9.7844305], dtype=float32)}\n{'predictions': array([9.902632], dtype=float32)}\n{'predictions': array([9.7832575], dtype=float32)}\n{'predictions': array([9.72125], dtype=float32)}\n{'predictions': array([9.72507], dtype=float32)}\n{'predictions': array([9.725269], dtype=float32)}\n{'predictions': array([9.725756], dtype=float32)}\n{'predictions': array([9.725142], dtype=float32)}\n{'predictions': array([9.724879], dtype=float32)}\n{'predictions': array([9.725404], dtype=float32)}\n{'predictions': array([9.725075], dtype=float32)}\n{'predictions': array([9.725114], dtype=float32)}\n{'predictions': array([9.95701], dtype=float32)}\n{'predictions': array([9.707335], dtype=float32)}\n{'predictions': array([9.727887], dtype=float32)}\n{'predictions': array([9.724144], dtype=float32)}\n{'predictions': array([9.783254], dtype=float32)}\n{'predictions': array([9.783428], dtype=float32)}\n{'predictions': array([9.725708], dtype=float32)}\n{'predictions': array([9.724307], dtype=float32)}\n{'predictions': array([9.724376], dtype=float32)}\n{'predictions': array([9.725589], dtype=float32)}\n{'predictions': array([9.711457], dtype=float32)}\n{'predictions': array([9.723048], dtype=float32)}\n{'predictions': array([9.8411665], dtype=float32)}\n{'predictions': array([9.725912], dtype=float32)}\n{'predictions': array([9.782196], dtype=float32)}\n{'predictions': array([9.724613], dtype=float32)}\n{'predictions': array([9.784762], dtype=float32)}\n{'predictions': array([9.778656], dtype=float32)}\n{'predictions': array([9.724094], dtype=float32)}\n{'predictions': array([9.72492], dtype=float32)}\n{'predictions': array([9.78305], dtype=float32)}\n{'predictions': array([9.726465], dtype=float32)}\n{'predictions': array([9.784896], dtype=float32)}\n{'predictions': array([9.787296], dtype=float32)}\n{'predictions': array([9.959256], dtype=float32)}\n{'predictions': array([9.724863], dtype=float32)}\n{'predictions': array([9.725588], dtype=float32)}\n{'predictions': array([9.724698], dtype=float32)}\n{'predictions': array([9.899659], dtype=float32)}\n{'predictions': array([9.723827], dtype=float32)}\n{'predictions': array([9.725349], dtype=float32)}\n{'predictions': array([9.779878], dtype=float32)}\n{'predictions': array([9.722785], dtype=float32)}\n{'predictions': array([9.726966], dtype=float32)}\n{'predictions': array([9.785781], dtype=float32)}\n{'predictions': array([9.722819], dtype=float32)}\n{'predictions': array([10.016818], dtype=float32)}\n{'predictions': array([9.7272], dtype=float32)}\n{'predictions': array([9.724567], dtype=float32)}\n{'predictions': array([9.722655], dtype=float32)}\n{'predictions': array([9.722567], dtype=float32)}\n{'predictions': array([9.784514], dtype=float32)}\n{'predictions': array([9.724898], dtype=float32)}\n{'predictions': array([9.725431], dtype=float32)}\n{'predictions': array([9.724151], dtype=float32)}\n{'predictions': array([9.843027], dtype=float32)}\n{'predictions': array([9.724303], dtype=float32)}\n{'predictions': array([9.727754], dtype=float32)}\n{'predictions': array([9.724579], dtype=float32)}\n{'predictions': array([9.726916], dtype=float32)}\n{'predictions': array([9.7257805], dtype=float32)}\n{'predictions': array([9.726085], dtype=float32)}\n{'predictions': array([9.724609], dtype=float32)}\n{'predictions': array([9.9589615], dtype=float32)}\n{'predictions': array([9.725202], dtype=float32)}\n{'predictions': array([9.72487], dtype=float32)}\n{'predictions': array([9.725892], dtype=float32)}\n{'predictions': array([9.724692], dtype=float32)}\n{'predictions': array([9.724759], dtype=float32)}\n{'predictions': array([9.95828], dtype=float32)}\n{'predictions': array([10.017508], dtype=float32)}\n{'predictions': array([9.724589], dtype=float32)}\n{'predictions': array([9.78531], dtype=float32)}\n{'predictions': array([9.725047], dtype=float32)}\n{'predictions': array([9.779912], dtype=float32)}\n{'predictions': array([9.724816], dtype=float32)}\n{'predictions': array([9.725553], dtype=float32)}\n{'predictions': array([9.725504], dtype=float32)}\n{'predictions': array([9.783621], dtype=float32)}\n{'predictions': array([9.961331], dtype=float32)}\n{'predictions': array([9.725116], dtype=float32)}\n{'predictions': array([9.724242], dtype=float32)}\n{'predictions': array([9.841918], dtype=float32)}\n{'predictions': array([9.725333], dtype=float32)}\n{'predictions': array([9.725089], dtype=float32)}\n{'predictions': array([9.959572], dtype=float32)}\n{'predictions': array([9.724026], dtype=float32)}\n{'predictions': array([9.7833185], dtype=float32)}\n{'predictions': array([9.783208], dtype=float32)}\n{'predictions': array([9.726382], dtype=float32)}\n{'predictions': array([9.727249], dtype=float32)}\n{'predictions': array([9.959635], dtype=float32)}\n{'predictions': array([9.724585], dtype=float32)}\n{'predictions': array([9.7215], dtype=float32)}\n{'predictions': array([9.95819], dtype=float32)}\n{'predictions': array([9.959082], dtype=float32)}\n{'predictions': array([9.724633], dtype=float32)}\n{'predictions': array([9.782926], dtype=float32)}\n{'predictions': array([9.722344], dtype=float32)}\n{'predictions': array([9.7250395], dtype=float32)}\n{'predictions': array([9.724369], dtype=float32)}\n{'predictions': array([9.725661], dtype=float32)}\n{'predictions': array([9.725033], dtype=float32)}\n{'predictions': array([9.724873], dtype=float32)}\n{'predictions': array([9.7279215], dtype=float32)}\n{'predictions': array([9.724909], dtype=float32)}\n{'predictions': array([9.725093], dtype=float32)}\n{'predictions': array([9.724446], dtype=float32)}\n{'predictions': array([9.724229], dtype=float32)}\n{'predictions': array([9.90059], dtype=float32)}\n{'predictions': array([9.783402], dtype=float32)}\n{'predictions': array([9.958786], dtype=float32)}\n{'predictions': array([9.724929], dtype=float32)}\n{'predictions': array([9.784179], dtype=float32)}\n{'predictions': array([9.723657], dtype=float32)}\n{'predictions': array([9.724969], dtype=float32)}\n{'predictions': array([9.7161665], dtype=float32)}\n{'predictions': array([9.723513], dtype=float32)}\n{'predictions': array([9.783176], dtype=float32)}\n{'predictions': array([9.725328], dtype=float32)}\n{'predictions': array([9.724528], dtype=float32)}\n{'predictions': array([9.726698], dtype=float32)}\n{'predictions': array([9.784262], dtype=float32)}\n{'predictions': array([9.726216], dtype=float32)}\n{'predictions': array([9.726558], dtype=float32)}\n{'predictions': array([9.955983], dtype=float32)}\n{'predictions': array([9.783565], dtype=float32)}\n{'predictions': array([9.959886], dtype=float32)}\n{'predictions': array([9.724668], dtype=float32)}\n{'predictions': array([9.844198], dtype=float32)}\n{'predictions': array([9.725176], dtype=float32)}\n{'predictions': array([9.957759], dtype=float32)}\n{'predictions': array([9.725566], dtype=float32)}\n{'predictions': array([9.728336], dtype=float32)}\n{'predictions': array([9.72542], dtype=float32)}\n{'predictions': array([9.7234745], dtype=float32)}\n{'predictions': array([9.722587], dtype=float32)}\n{'predictions': array([9.724406], dtype=float32)}\n{'predictions': array([9.7250185], dtype=float32)}\n{'predictions': array([9.725951], dtype=float32)}\n{'predictions': array([9.885497], dtype=float32)}\n{'predictions': array([9.720593], dtype=float32)}\n{'predictions': array([9.726935], dtype=float32)}\n{'predictions': array([9.7249155], dtype=float32)}\n{'predictions': array([9.783925], dtype=float32)}\n{'predictions': array([9.7249365], dtype=float32)}\n{'predictions': array([9.72544], dtype=float32)}\n{'predictions': array([9.724723], dtype=float32)}\n{'predictions': array([9.724491], dtype=float32)}\n{'predictions': array([9.725828], dtype=float32)}\n{'predictions': array([9.784949], dtype=float32)}\n{'predictions': array([9.720545], dtype=float32)}\n{'predictions': array([9.724256], dtype=float32)}\n{'predictions': array([9.723816], dtype=float32)}\n{'predictions': array([9.727371], dtype=float32)}\n{'predictions': array([9.721263], dtype=float32)}\n{'predictions': array([9.841878], dtype=float32)}\n{'predictions': array([9.725113], dtype=float32)}\n{'predictions': array([9.725844], dtype=float32)}\n{'predictions': array([9.725407], dtype=float32)}\n{'predictions': array([9.726111], dtype=float32)}\n{'predictions': array([9.784483], dtype=float32)}\n{'predictions': array([9.724012], dtype=float32)}\n{'predictions': array([9.726432], dtype=float32)}\n{'predictions': array([9.725403], dtype=float32)}\n{'predictions': array([9.726136], dtype=float32)}\n{'predictions': array([9.723983], dtype=float32)}\n{'predictions': array([9.726221], dtype=float32)}\n{'predictions': array([9.841071], dtype=float32)}\n{'predictions': array([9.725069], dtype=float32)}\n{'predictions': array([9.725588], dtype=float32)}\n{'predictions': array([9.726717], dtype=float32)}\n{'predictions': array([9.725992], dtype=float32)}\n{'predictions': array([9.724151], dtype=float32)}\n{'predictions': array([9.722916], dtype=float32)}\n{'predictions': array([9.726283], dtype=float32)}\n{'predictions': array([9.726531], dtype=float32)}\n{'predictions': array([9.725405], dtype=float32)}\n{'predictions': array([9.7270355], dtype=float32)}\n{'predictions': array([9.7215605], dtype=float32)}\n{'predictions': array([9.784773], dtype=float32)}\n{'predictions': array([9.724906], dtype=float32)}\n{'predictions': array([9.726397], dtype=float32)}\n{'predictions': array([9.78432], dtype=float32)}\n{'predictions': array([9.783008], dtype=float32)}\n{'predictions': array([9.725805], dtype=float32)}\n{'predictions': array([9.722255], dtype=float32)}\n{'predictions': array([9.782031], dtype=float32)}\n{'predictions': array([9.724341], dtype=float32)}\n{'predictions': array([9.724065], dtype=float32)}\n{'predictions': array([9.838157], dtype=float32)}\n{'predictions': array([9.784382], dtype=float32)}\n{'predictions': array([9.724598], dtype=float32)}\n{'predictions': array([9.724926], dtype=float32)}\n{'predictions': array([9.783505], dtype=float32)}\n{'predictions': array([9.783288], dtype=float32)}\n{'predictions': array([9.725], dtype=float32)}\n{'predictions': array([9.9590435], dtype=float32)}\n{'predictions': array([9.727529], dtype=float32)}\n{'predictions': array([9.72536], dtype=float32)}\n{'predictions': array([9.725845], dtype=float32)}\n{'predictions': array([9.725846], dtype=float32)}\n{'predictions': array([9.724996], dtype=float32)}\n{'predictions': array([9.725695], dtype=float32)}\n{'predictions': array([9.72491], dtype=float32)}\n{'predictions': array([9.725034], dtype=float32)}\n{'predictions': array([9.72521], dtype=float32)}\n{'predictions': array([9.725932], dtype=float32)}\n{'predictions': array([9.783415], dtype=float32)}\n{'predictions': array([9.724355], dtype=float32)}\n{'predictions': array([9.7247305], dtype=float32)}\n{'predictions': array([9.72394], dtype=float32)}\n{'predictions': array([9.724015], dtype=float32)}\n{'predictions': array([9.7843685], dtype=float32)}\n{'predictions': array([9.725308], dtype=float32)}\n{'predictions': array([9.72517], dtype=float32)}\n{'predictions': array([9.726069], dtype=float32)}\n{'predictions': array([9.724296], dtype=float32)}\n{'predictions': array([9.783085], dtype=float32)}\n{'predictions': array([9.95934], dtype=float32)}\n{'predictions': array([9.725967], dtype=float32)}\n{'predictions': array([9.721446], dtype=float32)}\n{'predictions': array([9.898849], dtype=float32)}\n{'predictions': array([9.726208], dtype=float32)}\n{'predictions': array([9.721641], dtype=float32)}\n{'predictions': array([9.958252], dtype=float32)}\n{'predictions': array([10.016414], dtype=float32)}\n{'predictions': array([9.711808], dtype=float32)}\n{'predictions': array([9.724862], dtype=float32)}\n{'predictions': array([9.842209], dtype=float32)}\n{'predictions': array([9.724671], dtype=float32)}\n{'predictions': array([9.724427], dtype=float32)}\n{'predictions': array([9.71813], dtype=float32)}\n{'predictions': array([9.725244], dtype=float32)}\n{'predictions': array([9.779836], dtype=float32)}\n{'predictions': array([9.723482], dtype=float32)}\n{'predictions': array([9.72446], dtype=float32)}\n{'predictions': array([9.724297], dtype=float32)}\n{'predictions': array([9.721187], dtype=float32)}\n{'predictions': array([9.7247505], dtype=float32)}\n{'predictions': array([9.725745], dtype=float32)}\n{'predictions': array([9.725228], dtype=float32)}\n{'predictions': array([9.783475], dtype=float32)}\n{'predictions': array([9.960133], dtype=float32)}\n{'predictions': array([9.724726], dtype=float32)}\n{'predictions': array([9.724935], dtype=float32)}\n{'predictions': array([9.961351], dtype=float32)}\n{'predictions': array([9.724751], dtype=float32)}\n{'predictions': array([9.960006], dtype=float32)}\n{'predictions': array([9.725311], dtype=float32)}\n{'predictions': array([9.724337], dtype=float32)}\n{'predictions': array([9.957626], dtype=float32)}\n{'predictions': array([10.016944], dtype=float32)}\n{'predictions': array([9.78258], dtype=float32)}\n{'predictions': array([10.017983], dtype=float32)}\n{'predictions': array([9.779226], dtype=float32)}\n{'predictions': array([9.724559], dtype=float32)}\n{'predictions': array([9.7259445], dtype=float32)}\n{'predictions': array([9.7272005], dtype=float32)}\n{'predictions': array([9.899404], dtype=float32)}\n{'predictions': array([10.019624], dtype=float32)}\n{'predictions': array([9.955129], dtype=float32)}\n{'predictions': array([9.72556], dtype=float32)}\n{'predictions': array([9.712131], dtype=float32)}\n{'predictions': array([9.72664], dtype=float32)}\n{'predictions': array([9.959616], dtype=float32)}\n{'predictions': array([9.722654], dtype=float32)}\n{'predictions': array([10.017203], dtype=float32)}\n{'predictions': array([9.780593], dtype=float32)}\n{'predictions': array([9.72535], dtype=float32)}\n{'predictions': array([9.8417015], dtype=float32)}\n{'predictions': array([9.958171], dtype=float32)}\n{'predictions': array([9.725373], dtype=float32)}\n{'predictions': array([9.724851], dtype=float32)}\n{'predictions': array([9.844794], dtype=float32)}\n{'predictions': array([9.72478], dtype=float32)}\n{'predictions': array([9.723795], dtype=float32)}\n{'predictions': array([9.725717], dtype=float32)}\n{'predictions': array([9.7252445], dtype=float32)}\n{'predictions': array([9.7247305], dtype=float32)}\n{'predictions': array([9.724255], dtype=float32)}\n{'predictions': array([9.725434], dtype=float32)}\n{'predictions': array([9.725058], dtype=float32)}\n{'predictions': array([9.72563], dtype=float32)}\n{'predictions': array([9.725181], dtype=float32)}\n{'predictions': array([9.724985], dtype=float32)}\n{'predictions': array([9.724969], dtype=float32)}\n{'predictions': array([9.840945], dtype=float32)}\n{'predictions': array([9.72739], dtype=float32)}\n{'predictions': array([9.724394], dtype=float32)}\n{'predictions': array([9.783497], dtype=float32)}\n{'predictions': array([9.898542], dtype=float32)}\n{'predictions': array([9.719407], dtype=float32)}\n{'predictions': array([9.727226], dtype=float32)}\n{'predictions': array([9.726546], dtype=float32)}\n{'predictions': array([9.958302], dtype=float32)}\n{'predictions': array([9.726068], dtype=float32)}\n{'predictions': array([9.783889], dtype=float32)}\n{'predictions': array([9.726529], dtype=float32)}\n{'predictions': array([9.784334], dtype=float32)}\n{'predictions': array([9.726436], dtype=float32)}\n{'predictions': array([9.958837], dtype=float32)}\n{'predictions': array([9.726283], dtype=float32)}\n{'predictions': array([9.782063], dtype=float32)}\n{'predictions': array([9.958242], dtype=float32)}\n{'predictions': array([9.840862], dtype=float32)}\n{'predictions': array([9.725282], dtype=float32)}\n{'predictions': array([9.725762], dtype=float32)}\n{'predictions': array([9.722089], dtype=float32)}\n{'predictions': array([9.724096], dtype=float32)}\n{'predictions': array([9.781899], dtype=float32)}\n{'predictions': array([9.779054], dtype=float32)}\n{'predictions': array([9.724979], dtype=float32)}\n{'predictions': array([10.018235], dtype=float32)}\n{'predictions': array([9.72475], dtype=float32)}\n{'predictions': array([10.019625], dtype=float32)}\n{'predictions': array([9.781854], dtype=float32)}\n{'predictions': array([9.724269], dtype=float32)}\n{'predictions': array([9.724452], dtype=float32)}\n{'predictions': array([9.782178], dtype=float32)}\n{'predictions': array([9.712611], dtype=float32)}\n{'predictions': array([9.723694], dtype=float32)}\n{'predictions': array([9.782252], dtype=float32)}\n{'predictions': array([9.726049], dtype=float32)}\n{'predictions': array([9.727049], dtype=float32)}\n{'predictions': array([9.723955], dtype=float32)}\n{'predictions': array([9.724446], dtype=float32)}\n{'predictions': array([9.724403], dtype=float32)}\n{'predictions': array([9.723489], dtype=float32)}\n{'predictions': array([9.958058], dtype=float32)}\n{'predictions': array([9.783883], dtype=float32)}\n{'predictions': array([9.72564], dtype=float32)}\n{'predictions': array([9.725163], dtype=float32)}\n{'predictions': array([9.725034], dtype=float32)}\n{'predictions': array([9.724516], dtype=float32)}\n{'predictions': array([9.724682], dtype=float32)}\n{'predictions': array([9.95795], dtype=float32)}\n{'predictions': array([9.724029], dtype=float32)}\n{'predictions': array([9.726441], dtype=float32)}\n{'predictions': array([9.784016], dtype=float32)}\n{'predictions': array([9.724808], dtype=float32)}\n{'predictions': array([9.725097], dtype=float32)}\n{'predictions': array([9.724231], dtype=float32)}\n{'predictions': array([9.724931], dtype=float32)}\n{'predictions': array([9.724706], dtype=float32)}\n{'predictions': array([9.726477], dtype=float32)}\n{'predictions': array([9.722807], dtype=float32)}\n{'predictions': array([9.72478], dtype=float32)}\n{'predictions': array([9.960879], dtype=float32)}\n{'predictions': array([9.724937], dtype=float32)}\n{'predictions': array([9.724847], dtype=float32)}\n{'predictions': array([9.725728], dtype=float32)}\n{'predictions': array([9.839125], dtype=float32)}\n{'predictions': array([9.71294], dtype=float32)}\n{'predictions': array([10.018196], dtype=float32)}\n{'predictions': array([9.7245], dtype=float32)}\n{'predictions': array([9.72633], dtype=float32)}\n{'predictions': array([9.723297], dtype=float32)}\n{'predictions': array([9.720908], dtype=float32)}\n{'predictions': array([9.724586], dtype=float32)}\n{'predictions': array([9.786235], dtype=float32)}\n{'predictions': array([9.783206], dtype=float32)}\n{'predictions': array([9.718689], dtype=float32)}\n{'predictions': array([9.7248], dtype=float32)}\n{'predictions': array([9.725545], dtype=float32)}\n{'predictions': array([9.72507], dtype=float32)}\n{'predictions': array([9.782601], dtype=float32)}\n{'predictions': array([9.72072], dtype=float32)}\n{'predictions': array([10.017024], dtype=float32)}\n{'predictions': array([9.824075], dtype=float32)}\n{'predictions': array([9.728103], dtype=float32)}\n{'predictions': array([9.723823], dtype=float32)}\n{'predictions': array([10.018275], dtype=float32)}\n{'predictions': array([9.784377], dtype=float32)}\n{'predictions': array([9.725275], dtype=float32)}\n{'predictions': array([9.841183], dtype=float32)}\n{'predictions': array([9.727237], dtype=float32)}\n{'predictions': array([9.725133], dtype=float32)}\n{'predictions': array([9.7835455], dtype=float32)}\n{'predictions': array([9.7837], dtype=float32)}\n{'predictions': array([9.784317], dtype=float32)}\n{'predictions': array([9.724843], dtype=float32)}\n{'predictions': array([9.783423], dtype=float32)}\n{'predictions': array([9.779116], dtype=float32)}\n{'predictions': array([9.725547], dtype=float32)}\n{'predictions': array([9.727273], dtype=float32)}\n{'predictions': array([9.726093], dtype=float32)}\n{'predictions': array([9.72338], dtype=float32)}\n{'predictions': array([9.72636], dtype=float32)}\n{'predictions': array([9.7270565], dtype=float32)}\n{'predictions': array([9.724333], dtype=float32)}\n{'predictions': array([9.957112], dtype=float32)}\n{'predictions': array([9.725786], dtype=float32)}\n{'predictions': array([9.725545], dtype=float32)}\n{'predictions': array([9.725607], dtype=float32)}\n{'predictions': array([9.726416], dtype=float32)}\n{'predictions': array([9.7220335], dtype=float32)}\n{'predictions': array([9.842097], dtype=float32)}\n{'predictions': array([9.725773], dtype=float32)}\n{'predictions': array([9.784895], dtype=float32)}\n{'predictions': array([9.721187], dtype=float32)}\n{'predictions': array([9.783771], dtype=float32)}\n{'predictions': array([9.724171], dtype=float32)}\n{'predictions': array([9.945067], dtype=float32)}\n{'predictions': array([9.726181], dtype=float32)}\n{'predictions': array([9.718703], dtype=float32)}\n{'predictions': array([9.725213], dtype=float32)}\n{'predictions': array([9.724393], dtype=float32)}\n{'predictions': array([9.784163], dtype=float32)}\n{'predictions': array([9.725402], dtype=float32)}\n{'predictions': array([9.725342], dtype=float32)}\n{'predictions': array([9.720309], dtype=float32)}\n{'predictions': array([9.901903], dtype=float32)}\n{'predictions': array([9.726563], dtype=float32)}\n{'predictions': array([9.725434], dtype=float32)}\n{'predictions': array([9.725402], dtype=float32)}\n{'predictions': array([9.784677], dtype=float32)}\n{'predictions': array([9.724624], dtype=float32)}\n{'predictions': array([9.958915], dtype=float32)}\n{'predictions': array([9.725196], dtype=float32)}\n{'predictions': array([9.724015], dtype=float32)}\n{'predictions': array([9.724372], dtype=float32)}\n{'predictions': array([9.723754], dtype=float32)}\n{'predictions': array([9.723976], dtype=float32)}\n{'predictions': array([9.724194], dtype=float32)}\n{'predictions': array([9.842538], dtype=float32)}\n{'predictions': array([9.725055], dtype=float32)}\n{'predictions': array([9.724608], dtype=float32)}\n{'predictions': array([9.725247], dtype=float32)}\n{'predictions': array([9.723267], dtype=float32)}\n{'predictions': array([9.9017515], dtype=float32)}\n{'predictions': array([9.785144], dtype=float32)}\n{'predictions': array([9.726752], dtype=float32)}\n{'predictions': array([9.725726], dtype=float32)}\n{'predictions': array([9.899829], dtype=float32)}\n{'predictions': array([9.723489], dtype=float32)}\n{'predictions': array([9.725038], dtype=float32)}\n{'predictions': array([9.724943], dtype=float32)}\n{'predictions': array([9.727803], dtype=float32)}\n{'predictions': array([9.783996], dtype=float32)}\n{'predictions': array([9.782627], dtype=float32)}\n{'predictions': array([9.724951], dtype=float32)}\n{'predictions': array([9.726106], dtype=float32)}\n{'predictions': array([9.723973], dtype=float32)}\n{'predictions': array([9.721413], dtype=float32)}\n{'predictions': array([9.722839], dtype=float32)}\n{'predictions': array([9.725695], dtype=float32)}\n{'predictions': array([9.841199], dtype=float32)}\n{'predictions': array([10.017571], dtype=float32)}\n{'predictions': array([9.724375], dtype=float32)}\n{'predictions': array([9.958335], dtype=float32)}\n{'predictions': array([9.723311], dtype=float32)}\n{'predictions': array([9.78232], dtype=float32)}\n{'predictions': array([9.725733], dtype=float32)}\n{'predictions': array([9.785036], dtype=float32)}\n{'predictions': array([9.783195], dtype=float32)}\n{'predictions': array([9.841836], dtype=float32)}\n{'predictions': array([9.726451], dtype=float32)}\n{'predictions': array([9.72724], dtype=float32)}\n{'predictions': array([9.72594], dtype=float32)}\n{'predictions': array([9.785191], dtype=float32)}\n{'predictions': array([9.72465], dtype=float32)}\n{'predictions': array([9.901871], dtype=float32)}\n{'predictions': array([9.725957], dtype=float32)}\n{'predictions': array([9.726157], dtype=float32)}\n{'predictions': array([9.725458], dtype=float32)}\n{'predictions': array([9.78409], dtype=float32)}\n{'predictions': array([9.841808], dtype=float32)}\n{'predictions': array([9.725157], dtype=float32)}\n{'predictions': array([9.724792], dtype=float32)}\n{'predictions': array([9.725484], dtype=float32)}\n{'predictions': array([9.72672], dtype=float32)}\n{'predictions': array([9.714057], dtype=float32)}\n{'predictions': array([9.713162], dtype=float32)}\n{'predictions': array([9.726064], dtype=float32)}\n{'predictions': array([9.782503], dtype=float32)}\n{'predictions': array([9.72575], dtype=float32)}\n{'predictions': array([9.784167], dtype=float32)}\n{'predictions': array([9.841783], dtype=float32)}\n{'predictions': array([9.783826], dtype=float32)}\n{'predictions': array([9.726377], dtype=float32)}\n{'predictions': array([9.724564], dtype=float32)}\n{'predictions': array([9.784315], dtype=float32)}\n{'predictions': array([9.784561], dtype=float32)}\n{'predictions': array([9.723853], dtype=float32)}\n{'predictions': array([9.728227], dtype=float32)}\n{'predictions': array([9.724273], dtype=float32)}\n{'predictions': array([9.720663], dtype=float32)}\n{'predictions': array([9.725949], dtype=float32)}\n{'predictions': array([9.7242], dtype=float32)}\n{'predictions': array([9.727818], dtype=float32)}\n{'predictions': array([9.728475], dtype=float32)}\n{'predictions': array([9.720584], dtype=float32)}\n{'predictions': array([9.724603], dtype=float32)}\n{'predictions': array([9.721201], dtype=float32)}\n{'predictions': array([9.779373], dtype=float32)}\n{'predictions': array([9.726742], dtype=float32)}\n{'predictions': array([9.723938], dtype=float32)}\n{'predictions': array([9.724888], dtype=float32)}\n{'predictions': array([9.784791], dtype=float32)}\n{'predictions': array([9.772805], dtype=float32)}\n{'predictions': array([9.777847], dtype=float32)}\n{'predictions': array([9.725498], dtype=float32)}\n{'predictions': array([9.784204], dtype=float32)}\n{'predictions': array([9.725846], dtype=float32)}\n{'predictions': array([9.725408], dtype=float32)}\n{'predictions': array([9.782795], dtype=float32)}\n{'predictions': array([9.726752], dtype=float32)}\n{'predictions': array([9.724667], dtype=float32)}\n{'predictions': array([9.725406], dtype=float32)}\n{'predictions': array([9.72458], dtype=float32)}\n{'predictions': array([9.719446], dtype=float32)}\n{'predictions': array([9.783139], dtype=float32)}\n{'predictions': array([9.841521], dtype=float32)}\n{'predictions': array([9.726274], dtype=float32)}\n{'predictions': array([9.725105], dtype=float32)}\n{'predictions': array([9.726958], dtype=float32)}\n{'predictions': array([9.725006], dtype=float32)}\n{'predictions': array([9.786187], dtype=float32)}\n{'predictions': array([9.72544], dtype=float32)}\n{'predictions': array([9.784265], dtype=float32)}\n{'predictions': array([9.725335], dtype=float32)}\n{'predictions': array([9.726672], dtype=float32)}\n{'predictions': array([9.784152], dtype=float32)}\n{'predictions': array([9.726485], dtype=float32)}\n{'predictions': array([9.724515], dtype=float32)}\n{'predictions': array([9.723807], dtype=float32)}\n{'predictions': array([9.72557], dtype=float32)}\n{'predictions': array([9.725553], dtype=float32)}\n{'predictions': array([9.725085], dtype=float32)}\n{'predictions': array([9.778065], dtype=float32)}\n{'predictions': array([9.72297], dtype=float32)}\n{'predictions': array([9.7238865], dtype=float32)}\n{'predictions': array([9.725766], dtype=float32)}\n{'predictions': array([9.727876], dtype=float32)}\n{'predictions': array([9.725133], dtype=float32)}\n{'predictions': array([9.958248], dtype=float32)}\n{'predictions': array([9.725985], dtype=float32)}\n{'predictions': array([9.782787], dtype=float32)}\n{'predictions': array([9.725509], dtype=float32)}\n{'predictions': array([9.72532], dtype=float32)}\n{'predictions': array([9.726424], dtype=float32)}\n{'predictions': array([9.957877], dtype=float32)}\n{'predictions': array([9.727297], dtype=float32)}\n{'predictions': array([9.78309], dtype=float32)}\n{'predictions': array([9.726236], dtype=float32)}\n{'predictions': array([9.723659], dtype=float32)}\n{'predictions': array([9.782699], dtype=float32)}\n{'predictions': array([9.724183], dtype=float32)}\n{'predictions': array([9.781891], dtype=float32)}\n{'predictions': array([9.724857], dtype=float32)}\n{'predictions': array([9.725165], dtype=float32)}\n{'predictions': array([9.902274], dtype=float32)}\n{'predictions': array([9.726449], dtype=float32)}\n{'predictions': array([9.958979], dtype=float32)}\n{'predictions': array([9.840868], dtype=float32)}\n{'predictions': array([9.783992], dtype=float32)}\n{'predictions': array([9.725713], dtype=float32)}\n{'predictions': array([9.721502], dtype=float32)}\n{'predictions': array([9.724217], dtype=float32)}\n{'predictions': array([9.724463], dtype=float32)}\n{'predictions': array([9.782712], dtype=float32)}\n{'predictions': array([9.784952], dtype=float32)}\n{'predictions': array([9.725903], dtype=float32)}\n{'predictions': array([9.842757], dtype=float32)}\n{'predictions': array([9.725709], dtype=float32)}\n{'predictions': array([9.725581], dtype=float32)}\n{'predictions': array([9.957903], dtype=float32)}\n{'predictions': array([9.778633], dtype=float32)}\n{'predictions': array([9.724977], dtype=float32)}\n{'predictions': array([9.724638], dtype=float32)}\n{'predictions': array([9.72783], dtype=float32)}\n{'predictions': array([10.019583], dtype=float32)}\n{'predictions': array([9.842214], dtype=float32)}\n{'predictions': array([9.721152], dtype=float32)}\n{'predictions': array([9.725034], dtype=float32)}\n{'predictions': array([9.725895], dtype=float32)}\n{'predictions': array([9.724302], dtype=float32)}\n{'predictions': array([9.724214], dtype=float32)}\n{'predictions': array([9.781732], dtype=float32)}\n{'predictions': array([9.724244], dtype=float32)}\n{'predictions': array([10.0178795], dtype=float32)}\n{'predictions': array([9.724872], dtype=float32)}\n{'predictions': array([9.725276], dtype=float32)}\n{'predictions': array([9.726518], dtype=float32)}\n{'predictions': array([9.958034], dtype=float32)}\n{'predictions': array([9.958135], dtype=float32)}\n{'predictions': array([9.947253], dtype=float32)}\n{'predictions': array([9.843129], dtype=float32)}\n{'predictions': array([9.841016], dtype=float32)}\n{'predictions': array([9.721711], dtype=float32)}\n{'predictions': array([9.959885], dtype=float32)}\n{'predictions': array([9.783866], dtype=float32)}\n{'predictions': array([9.782983], dtype=float32)}\n{'predictions': array([9.725547], dtype=float32)}\n{'predictions': array([9.842473], dtype=float32)}\n{'predictions': array([9.956682], dtype=float32)}\n{'predictions': array([9.725649], dtype=float32)}\n{'predictions': array([9.724367], dtype=float32)}\n{'predictions': array([9.720598], dtype=float32)}\n{'predictions': array([9.725897], dtype=float32)}\n{'predictions': array([9.784928], dtype=float32)}\n{'predictions': array([9.724984], dtype=float32)}\n{'predictions': array([9.724952], dtype=float32)}\n{'predictions': array([9.731543], dtype=float32)}\n{'predictions': array([9.958386], dtype=float32)}\n{'predictions': array([9.783295], dtype=float32)}\n{'predictions': array([10.016261], dtype=float32)}\n{'predictions': array([9.7172985], dtype=float32)}\n{'predictions': array([9.725473], dtype=float32)}\n{'predictions': array([9.725751], dtype=float32)}\n{'predictions': array([9.725182], dtype=float32)}\n{'predictions': array([9.7245], dtype=float32)}\n{'predictions': array([9.784463], dtype=float32)}\n{'predictions': array([9.783065], dtype=float32)}\n{'predictions': array([9.72508], dtype=float32)}\n{'predictions': array([9.724933], dtype=float32)}\n{'predictions': array([9.783481], dtype=float32)}\n{'predictions': array([9.725266], dtype=float32)}\n{'predictions': array([9.786822], dtype=float32)}\n{'predictions': array([9.783441], dtype=float32)}\n{'predictions': array([9.784783], dtype=float32)}\n{'predictions': array([9.7246], dtype=float32)}\n{'predictions': array([9.725368], dtype=float32)}\n{'predictions': array([9.724621], dtype=float32)}\n{'predictions': array([9.9516325], dtype=float32)}\n{'predictions': array([9.959693], dtype=float32)}\n{'predictions': array([9.782874], dtype=float32)}\n{'predictions': array([9.721456], dtype=float32)}\n{'predictions': array([9.725028], dtype=float32)}\n{'predictions': array([9.725678], dtype=float32)}\n{'predictions': array([9.780118], dtype=float32)}\n{'predictions': array([9.78222], dtype=float32)}\n{'predictions': array([9.956954], dtype=float32)}\n{'predictions': array([9.725233], dtype=float32)}\n{'predictions': array([9.842002], dtype=float32)}\n{'predictions': array([9.724676], dtype=float32)}\n{'predictions': array([9.728353], dtype=float32)}\n{'predictions': array([9.784149], dtype=float32)}\n{'predictions': array([9.785097], dtype=float32)}\n{'predictions': array([9.723691], dtype=float32)}\n{'predictions': array([9.725333], dtype=float32)}\n{'predictions': array([9.72594], dtype=float32)}\n{'predictions': array([9.770317], dtype=float32)}\n{'predictions': array([9.784537], dtype=float32)}\n{'predictions': array([9.783697], dtype=float32)}\n{'predictions': array([9.783866], dtype=float32)}\n{'predictions': array([9.726014], dtype=float32)}\n{'predictions': array([9.725438], dtype=float32)}\n{'predictions': array([9.842962], dtype=float32)}\n{'predictions': array([9.783056], dtype=float32)}\n{'predictions': array([9.947157], dtype=float32)}\n{'predictions': array([9.78424], dtype=float32)}\n{'predictions': array([9.722498], dtype=float32)}\n{'predictions': array([9.957511], dtype=float32)}\n{'predictions': array([9.726533], dtype=float32)}\n{'predictions': array([9.784412], dtype=float32)}\n{'predictions': array([9.725463], dtype=float32)}\n{'predictions': array([9.725683], dtype=float32)}\n{'predictions': array([9.72174], dtype=float32)}\n{'predictions': array([9.724178], dtype=float32)}\n{'predictions': array([9.959664], dtype=float32)}\n{'predictions': array([9.709419], dtype=float32)}\n{'predictions': array([9.72534], dtype=float32)}\n{'predictions': array([9.724121], dtype=float32)}\n{'predictions': array([9.958095], dtype=float32)}\n{'predictions': array([9.725345], dtype=float32)}\n{'predictions': array([9.725239], dtype=float32)}\n{'predictions': array([9.72545], dtype=float32)}\n{'predictions': array([9.782381], dtype=float32)}\n{'predictions': array([9.725539], dtype=float32)}\n{'predictions': array([9.724702], dtype=float32)}\n{'predictions': array([9.957488], dtype=float32)}\n{'predictions': array([9.960878], dtype=float32)}\n{'predictions': array([9.72505], dtype=float32)}\n{'predictions': array([9.723334], dtype=float32)}\n{'predictions': array([9.903514], dtype=float32)}\n{'predictions': array([9.72661], dtype=float32)}\n{'predictions': array([9.725726], dtype=float32)}\n{'predictions': array([9.7264805], dtype=float32)}\n{'predictions': array([9.727216], dtype=float32)}\n{'predictions': array([9.955121], dtype=float32)}\n{'predictions': array([9.724472], dtype=float32)}\n{'predictions': array([9.724882], dtype=float32)}\n{'predictions': array([9.724369], dtype=float32)}\n{'predictions': array([9.73105], dtype=float32)}\n{'predictions': array([9.725312], dtype=float32)}\n{'predictions': array([9.772304], dtype=float32)}\n{'predictions': array([9.900551], dtype=float32)}\n{'predictions': array([9.721524], dtype=float32)}\n{'predictions': array([9.783719], dtype=float32)}\n{'predictions': array([9.726438], dtype=float32)}\n{'predictions': array([9.842475], dtype=float32)}\n{'predictions': array([9.725957], dtype=float32)}\n{'predictions': array([9.783624], dtype=float32)}\n{'predictions': array([9.725947], dtype=float32)}\n{'predictions': array([9.725815], dtype=float32)}\n{'predictions': array([9.723876], dtype=float32)}\n{'predictions': array([9.727113], dtype=float32)}\n{'predictions': array([9.721183], dtype=float32)}\n{'predictions': array([9.795187], dtype=float32)}\n{'predictions': array([9.7848835], dtype=float32)}\n{'predictions': array([9.724773], dtype=float32)}\n{'predictions': array([9.723068], dtype=float32)}\n{'predictions': array([9.725213], dtype=float32)}\n{'predictions': array([9.724324], dtype=float32)}\n{'predictions': array([9.7262125], dtype=float32)}\n{'predictions': array([9.725079], dtype=float32)}\n{'predictions': array([9.842208], dtype=float32)}\n{'predictions': array([9.708744], dtype=float32)}\n{'predictions': array([9.72518], dtype=float32)}\n{'predictions': array([9.723489], dtype=float32)}\n{'predictions': array([9.71609], dtype=float32)}\n{'predictions': array([9.726581], dtype=float32)}\n{'predictions': array([9.726433], dtype=float32)}\n{'predictions': array([9.724807], dtype=float32)}\n{'predictions': array([9.725259], dtype=float32)}\n{'predictions': array([9.725708], dtype=float32)}\n{'predictions': array([9.726167], dtype=float32)}\n{'predictions': array([9.725682], dtype=float32)}\n{'predictions': array([9.724952], dtype=float32)}\n{'predictions': array([9.721033], dtype=float32)}\n{'predictions': array([9.723882], dtype=float32)}\n{'predictions': array([9.784167], dtype=float32)}\n{'predictions': array([9.782558], dtype=float32)}\n{'predictions': array([9.957774], dtype=float32)}\n{'predictions': array([9.724589], dtype=float32)}\n{'predictions': array([9.724895], dtype=float32)}\n{'predictions': array([9.725505], dtype=float32)}\n{'predictions': array([9.899664], dtype=float32)}\n{'predictions': array([9.783194], dtype=float32)}\n{'predictions': array([9.727244], dtype=float32)}\n{'predictions': array([9.779762], dtype=float32)}\n{'predictions': array([9.725028], dtype=float32)}\n{'predictions': array([9.7254], dtype=float32)}\n{'predictions': array([9.955821], dtype=float32)}\n{'predictions': array([9.958465], dtype=float32)}\n{'predictions': array([9.725094], dtype=float32)}\n{'predictions': array([9.724643], dtype=float32)}\n{'predictions': array([10.018004], dtype=float32)}\n{'predictions': array([9.958159], dtype=float32)}\n{'predictions': array([9.72663], dtype=float32)}\n{'predictions': array([9.724931], dtype=float32)}\n{'predictions': array([9.784325], dtype=float32)}\n{'predictions': array([9.960751], dtype=float32)}\n{'predictions': array([9.723535], dtype=float32)}\n{'predictions': array([9.78609], dtype=float32)}\n{'predictions': array([9.727198], dtype=float32)}\n{'predictions': array([9.782514], dtype=float32)}\n{'predictions': array([9.725747], dtype=float32)}\n{'predictions': array([9.720424], dtype=float32)}\n{'predictions': array([9.780112], dtype=float32)}\n{'predictions': array([9.724609], dtype=float32)}\n{'predictions': array([9.840859], dtype=float32)}\n{'predictions': array([9.727262], dtype=float32)}\n{'predictions': array([9.725558], dtype=float32)}\n{'predictions': array([9.724278], dtype=float32)}\n{'predictions': array([9.961224], dtype=float32)}\n{'predictions': array([9.725842], dtype=float32)}\n{'predictions': array([9.725785], dtype=float32)}\n{'predictions': array([9.726368], dtype=float32)}\n{'predictions': array([9.726113], dtype=float32)}\n{'predictions': array([9.724857], dtype=float32)}\n{'predictions': array([9.783981], dtype=float32)}\n{'predictions': array([9.726894], dtype=float32)}\n{'predictions': array([9.721513], dtype=float32)}\n{'predictions': array([9.901746], dtype=float32)}\n{'predictions': array([9.7123575], dtype=float32)}\n{'predictions': array([9.724387], dtype=float32)}\n{'predictions': array([9.725653], dtype=float32)}\n{'predictions': array([9.725968], dtype=float32)}\n{'predictions': array([9.725831], dtype=float32)}\n{'predictions': array([9.725352], dtype=float32)}\n{'predictions': array([9.725002], dtype=float32)}\n{'predictions': array([9.765379], dtype=float32)}\n{'predictions': array([9.781878], dtype=float32)}\n{'predictions': array([9.782067], dtype=float32)}\n{'predictions': array([9.716545], dtype=float32)}\n{'predictions': array([9.72878], dtype=float32)}\n{'predictions': array([9.958795], dtype=float32)}\n{'predictions': array([9.782837], dtype=float32)}\n{'predictions': array([9.719949], dtype=float32)}\n{'predictions': array([9.961231], dtype=float32)}\n{'predictions': array([9.786435], dtype=float32)}\n{'predictions': array([9.724866], dtype=float32)}\n{'predictions': array([9.72442], dtype=float32)}\n{'predictions': array([9.958687], dtype=float32)}\n{'predictions': array([9.726593], dtype=float32)}\n{'predictions': array([9.782996], dtype=float32)}\n{'predictions': array([9.725311], dtype=float32)}\n{'predictions': array([9.724063], dtype=float32)}\n{'predictions': array([9.725746], dtype=float32)}\n{'predictions': array([9.724689], dtype=float32)}\n{'predictions': array([9.957105], dtype=float32)}\n{'predictions': array([9.725772], dtype=float32)}\n{'predictions': array([9.95769], dtype=float32)}\n{'predictions': array([9.723337], dtype=float32)}\n{'predictions': array([9.782812], dtype=float32)}\n{'predictions': array([9.725141], dtype=float32)}\n{'predictions': array([10.016999], dtype=float32)}\n{'predictions': array([9.725138], dtype=float32)}\n{'predictions': array([9.723899], dtype=float32)}\n{'predictions': array([9.724302], dtype=float32)}\n{'predictions': array([9.724729], dtype=float32)}\n{'predictions': array([9.725478], dtype=float32)}\n{'predictions': array([9.785095], dtype=float32)}\n{'predictions': array([9.781706], dtype=float32)}\n{'predictions': array([9.724003], dtype=float32)}\n{'predictions': array([9.724257], dtype=float32)}\n{'predictions': array([9.727382], dtype=float32)}\n{'predictions': array([9.783897], dtype=float32)}\n{'predictions': array([9.726018], dtype=float32)}\n{'predictions': array([9.726993], dtype=float32)}\n{'predictions': array([9.784451], dtype=float32)}\n{'predictions': array([9.786384], dtype=float32)}\n{'predictions': array([9.725697], dtype=float32)}\n{'predictions': array([9.842828], dtype=float32)}\n{'predictions': array([9.7252245], dtype=float32)}\n{'predictions': array([9.8391075], dtype=float32)}\n{'predictions': array([9.896306], dtype=float32)}\n{'predictions': array([9.726912], dtype=float32)}\n{'predictions': array([9.727015], dtype=float32)}\n{'predictions': array([9.783718], dtype=float32)}\n{'predictions': array([9.783265], dtype=float32)}\n{'predictions': array([9.726307], dtype=float32)}\n{'predictions': array([9.725348], dtype=float32)}\n{'predictions': array([9.724965], dtype=float32)}\n{'predictions': array([9.95881], dtype=float32)}\n{'predictions': array([9.722008], dtype=float32)}\n{'predictions': array([9.726075], dtype=float32)}\n{'predictions': array([9.724793], dtype=float32)}\n{'predictions': array([9.723957], dtype=float32)}\n{'predictions': array([9.9586935], dtype=float32)}\n{'predictions': array([9.724676], dtype=float32)}\n{'predictions': array([9.783434], dtype=float32)}\n{'predictions': array([9.724668], dtype=float32)}\n{'predictions': array([9.720418], dtype=float32)}\n{'predictions': array([9.782827], dtype=float32)}\n{'predictions': array([9.785554], dtype=float32)}\n{'predictions': array([9.724636], dtype=float32)}\n{'predictions': array([9.841748], dtype=float32)}\n{'predictions': array([9.783604], dtype=float32)}\n{'predictions': array([9.842626], dtype=float32)}\n{'predictions': array([9.784231], dtype=float32)}\n{'predictions': array([9.782503], dtype=float32)}\n{'predictions': array([9.724992], dtype=float32)}\n{'predictions': array([9.724619], dtype=float32)}\n{'predictions': array([9.724999], dtype=float32)}\n{'predictions': array([9.782372], dtype=float32)}\n{'predictions': array([9.724698], dtype=float32)}\n{'predictions': array([9.7252865], dtype=float32)}\n{'predictions': array([9.725092], dtype=float32)}\n{'predictions': array([9.784069], dtype=float32)}\n{'predictions': array([9.78351], dtype=float32)}\n{'predictions': array([9.724861], dtype=float32)}\n{'predictions': array([9.843198], dtype=float32)}\n{'predictions': array([9.841819], dtype=float32)}\n{'predictions': array([9.722794], dtype=float32)}\n{'predictions': array([9.726522], dtype=float32)}\n{'predictions': array([9.724381], dtype=float32)}\n{'predictions': array([9.7818575], dtype=float32)}\n{'predictions': array([9.726051], dtype=float32)}\n{'predictions': array([9.724322], dtype=float32)}\n{'predictions': array([9.786404], dtype=float32)}\n{'predictions': array([9.783343], dtype=float32)}\n{'predictions': array([9.959422], dtype=float32)}\n{'predictions': array([9.725122], dtype=float32)}\n{'predictions': array([9.724948], dtype=float32)}\n{'predictions': array([9.726108], dtype=float32)}\n{'predictions': array([9.782933], dtype=float32)}\n{'predictions': array([9.724221], dtype=float32)}\n{'predictions': array([9.724389], dtype=float32)}\n{'predictions': array([9.784368], dtype=float32)}\n{'predictions': array([9.725163], dtype=float32)}\n{'predictions': array([9.723954], dtype=float32)}\n{'predictions': array([9.783662], dtype=float32)}\n{'predictions': array([9.725324], dtype=float32)}\n{'predictions': array([10.019084], dtype=float32)}\n{'predictions': array([9.722642], dtype=float32)}\n{'predictions': array([9.960137], dtype=float32)}\n{'predictions': array([9.724437], dtype=float32)}\n{'predictions': array([9.899266], dtype=float32)}\n{'predictions': array([9.721374], dtype=float32)}\n{'predictions': array([9.72566], dtype=float32)}\n{'predictions': array([9.7826605], dtype=float32)}\n{'predictions': array([9.725802], dtype=float32)}\n{'predictions': array([10.016288], dtype=float32)}\n{'predictions': array([9.724623], dtype=float32)}\n{'predictions': array([9.724942], dtype=float32)}\n{'predictions': array([9.874304], dtype=float32)}\n{'predictions': array([9.727148], dtype=float32)}\n{'predictions': array([9.72458], dtype=float32)}\n{'predictions': array([9.72542], dtype=float32)}\n{'predictions': array([9.725633], dtype=float32)}\n{'predictions': array([9.780675], dtype=float32)}\n{'predictions': array([9.777343], dtype=float32)}\n{'predictions': array([9.726499], dtype=float32)}\n{'predictions': array([9.725511], dtype=float32)}\n{'predictions': array([9.722147], dtype=float32)}\n{'predictions': array([9.784869], dtype=float32)}\n{'predictions': array([9.726821], dtype=float32)}\n{'predictions': array([9.724381], dtype=float32)}\n{'predictions': array([9.829008], dtype=float32)}\n{'predictions': array([9.724673], dtype=float32)}\n{'predictions': array([9.712186], dtype=float32)}\n{'predictions': array([9.725486], dtype=float32)}\n{'predictions': array([9.724872], dtype=float32)}\n{'predictions': array([9.782703], dtype=float32)}\n{'predictions': array([9.727025], dtype=float32)}\n{'predictions': array([9.958672], dtype=float32)}\n{'predictions': array([9.724601], dtype=float32)}\n{'predictions': array([9.723925], dtype=float32)}\n{'predictions': array([9.840911], dtype=float32)}\n{'predictions': array([9.725132], dtype=float32)}\n{'predictions': array([9.784111], dtype=float32)}\n{'predictions': array([9.725952], dtype=float32)}\n{'predictions': array([9.721047], dtype=float32)}\n{'predictions': array([9.725267], dtype=float32)}\n{'predictions': array([9.726137], dtype=float32)}\n{'predictions': array([9.724463], dtype=float32)}\n{'predictions': array([9.956469], dtype=float32)}\n{'predictions': array([9.783375], dtype=float32)}\n{'predictions': array([9.782093], dtype=float32)}\n{'predictions': array([9.725347], dtype=float32)}\n{'predictions': array([9.727496], dtype=float32)}\n{'predictions': array([9.724656], dtype=float32)}\n{'predictions': array([9.725274], dtype=float32)}\n{'predictions': array([9.72548], dtype=float32)}\n{'predictions': array([9.725931], dtype=float32)}\n{'predictions': array([9.8443575], dtype=float32)}\n{'predictions': array([9.724492], dtype=float32)}\n{'predictions': array([9.7247], dtype=float32)}\n{'predictions': array([9.724886], dtype=float32)}\n{'predictions': array([9.844117], dtype=float32)}\n{'predictions': array([9.840953], dtype=float32)}\n{'predictions': array([9.726712], dtype=float32)}\n{'predictions': array([9.725434], dtype=float32)}\n{'predictions': array([9.727292], dtype=float32)}\n{'predictions': array([9.724621], dtype=float32)}\n{'predictions': array([9.721435], dtype=float32)}\n{'predictions': array([9.783623], dtype=float32)}\n{'predictions': array([9.724871], dtype=float32)}\n{'predictions': array([9.783871], dtype=float32)}\n{'predictions': array([9.7785635], dtype=float32)}\n{'predictions': array([9.899014], dtype=float32)}\n{'predictions': array([9.715947], dtype=float32)}\n{'predictions': array([9.780145], dtype=float32)}\n{'predictions': array([9.896877], dtype=float32)}\n{'predictions': array([9.724759], dtype=float32)}\n{'predictions': array([9.842757], dtype=float32)}\n{'predictions': array([9.724966], dtype=float32)}\n{'predictions': array([9.784118], dtype=float32)}\n{'predictions': array([9.723359], dtype=float32)}\n{'predictions': array([9.725298], dtype=float32)}\n{'predictions': array([9.782534], dtype=float32)}\n{'predictions': array([9.7257185], dtype=float32)}\n{'predictions': array([9.7742815], dtype=float32)}\n{'predictions': array([9.783661], dtype=float32)}\n{'predictions': array([9.724706], dtype=float32)}\n{'predictions': array([9.783578], dtype=float32)}\n{'predictions': array([9.726376], dtype=float32)}\n{'predictions': array([9.784295], dtype=float32)}\n{'predictions': array([9.724902], dtype=float32)}\n{'predictions': array([9.725957], dtype=float32)}\n{'predictions': array([9.784417], dtype=float32)}\n{'predictions': array([9.723394], dtype=float32)}\n{'predictions': array([9.843122], dtype=float32)}\n{'predictions': array([9.724841], dtype=float32)}\n{'predictions': array([9.77937], dtype=float32)}\n{'predictions': array([10.017061], dtype=float32)}\n{'predictions': array([9.842268], dtype=float32)}\n{'predictions': array([9.8424635], dtype=float32)}\n{'predictions': array([9.727684], dtype=float32)}\n{'predictions': array([9.779578], dtype=float32)}\n{'predictions': array([9.724455], dtype=float32)}\n{'predictions': array([9.783158], dtype=float32)}\n{'predictions': array([9.726582], dtype=float32)}\n{'predictions': array([9.8380785], dtype=float32)}\n{'predictions': array([9.724826], dtype=float32)}\n{'predictions': array([9.724299], dtype=float32)}\n{'predictions': array([9.725726], dtype=float32)}\n{'predictions': array([10.016524], dtype=float32)}\n{'predictions': array([9.842719], dtype=float32)}\n{'predictions': array([9.782716], dtype=float32)}\n{'predictions': array([9.727265], dtype=float32)}\n{'predictions': array([9.724883], dtype=float32)}\n{'predictions': array([9.726202], dtype=float32)}\n{'predictions': array([9.724636], dtype=float32)}\n{'predictions': array([9.957141], dtype=float32)}\n{'predictions': array([9.716297], dtype=float32)}\n{'predictions': array([9.724535], dtype=float32)}\n{'predictions': array([9.725097], dtype=float32)}\n{'predictions': array([9.725158], dtype=float32)}\n{'predictions': array([9.9587345], dtype=float32)}\n{'predictions': array([9.840578], dtype=float32)}\n{'predictions': array([9.725322], dtype=float32)}\n{'predictions': array([10.017211], dtype=float32)}\n{'predictions': array([9.726943], dtype=float32)}\n{'predictions': array([9.724248], dtype=float32)}\n{'predictions': array([9.72603], dtype=float32)}\n{'predictions': array([9.725302], dtype=float32)}\n{'predictions': array([9.724956], dtype=float32)}\n{'predictions': array([9.725577], dtype=float32)}\n{'predictions': array([9.72391], dtype=float32)}\n{'predictions': array([9.727264], dtype=float32)}\n{'predictions': array([9.724614], dtype=float32)}\n{'predictions': array([9.724269], dtype=float32)}\n{'predictions': array([9.724562], dtype=float32)}\n{'predictions': array([9.725239], dtype=float32)}\n{'predictions': array([9.725043], dtype=float32)}\n{'predictions': array([9.722404], dtype=float32)}\n{'predictions': array([9.782482], dtype=float32)}\n{'predictions': array([9.721275], dtype=float32)}\n{'predictions': array([9.726001], dtype=float32)}\n{'predictions': array([9.724877], dtype=float32)}\n{'predictions': array([9.725059], dtype=float32)}\n{'predictions': array([9.721376], dtype=float32)}\n{'predictions': array([9.726029], dtype=float32)}\n{'predictions': array([9.727242], dtype=float32)}\n{'predictions': array([9.7275305], dtype=float32)}\n{'predictions': array([9.844459], dtype=float32)}\n{'predictions': array([9.724711], dtype=float32)}\n{'predictions': array([9.725035], dtype=float32)}\n{'predictions': array([9.842234], dtype=float32)}\n{'predictions': array([9.724123], dtype=float32)}\n{'predictions': array([9.726789], dtype=float32)}\n{'predictions': array([10.017657], dtype=float32)}\n{'predictions': array([9.960266], dtype=float32)}\n{'predictions': array([9.725111], dtype=float32)}\n{'predictions': array([9.77116], dtype=float32)}\n{'predictions': array([9.726689], dtype=float32)}\n{'predictions': array([9.95848], dtype=float32)}\n{'predictions': array([9.726249], dtype=float32)}\n{'predictions': array([9.726533], dtype=float32)}\n{'predictions': array([9.958493], dtype=float32)}\n{'predictions': array([9.783295], dtype=float32)}\n{'predictions': array([9.725035], dtype=float32)}\n{'predictions': array([9.726158], dtype=float32)}\n{'predictions': array([9.897372], dtype=float32)}\n{'predictions': array([9.78309], dtype=float32)}\n{'predictions': array([9.957198], dtype=float32)}\n{'predictions': array([9.784652], dtype=float32)}\n{'predictions': array([9.899393], dtype=float32)}\n{'predictions': array([9.78325], dtype=float32)}\n{'predictions': array([9.726258], dtype=float32)}\n{'predictions': array([9.713905], dtype=float32)}\n{'predictions': array([9.7251425], dtype=float32)}\n{'predictions': array([9.724692], dtype=float32)}\n{'predictions': array([9.724367], dtype=float32)}\n{'predictions': array([9.724691], dtype=float32)}\n{'predictions': array([9.785993], dtype=float32)}\n{'predictions': array([9.725045], dtype=float32)}\n{'predictions': array([9.726465], dtype=float32)}\n{'predictions': array([9.960545], dtype=float32)}\n{'predictions': array([9.842835], dtype=float32)}\n{'predictions': array([9.725543], dtype=float32)}\n{'predictions': array([9.725805], dtype=float32)}\n{'predictions': array([9.720132], dtype=float32)}\n{'predictions': array([9.723589], dtype=float32)}\n{'predictions': array([9.72745], dtype=float32)}\n{'predictions': array([9.720912], dtype=float32)}\n{'predictions': array([10.017399], dtype=float32)}\n{'predictions': array([9.725267], dtype=float32)}\n{'predictions': array([9.7224], dtype=float32)}\n{'predictions': array([9.725421], dtype=float32)}\n{'predictions': array([9.960183], dtype=float32)}\n{'predictions': array([9.784665], dtype=float32)}\n{'predictions': array([9.725308], dtype=float32)}\n{'predictions': array([9.726034], dtype=float32)}\n{'predictions': array([9.7826185], dtype=float32)}\n{'predictions': array([9.723023], dtype=float32)}\n{'predictions': array([9.724644], dtype=float32)}\n{'predictions': array([9.960258], dtype=float32)}\n{'predictions': array([9.841882], dtype=float32)}\n{'predictions': array([9.72505], dtype=float32)}\n{'predictions': array([9.725613], dtype=float32)}\n{'predictions': array([9.725296], dtype=float32)}\n{'predictions': array([9.724313], dtype=float32)}\n{'predictions': array([9.724345], dtype=float32)}\n{'predictions': array([9.783481], dtype=float32)}\n{'predictions': array([9.723846], dtype=float32)}\n{'predictions': array([9.957542], dtype=float32)}\n{'predictions': array([9.725061], dtype=float32)}\n{'predictions': array([9.725235], dtype=float32)}\n{'predictions': array([9.725642], dtype=float32)}\n{'predictions': array([9.724767], dtype=float32)}\n{'predictions': array([9.842376], dtype=float32)}\n{'predictions': array([9.72607], dtype=float32)}\n{'predictions': array([9.724481], dtype=float32)}\n{'predictions': array([9.727006], dtype=float32)}\n{'predictions': array([9.783129], dtype=float32)}\n{'predictions': array([9.726199], dtype=float32)}\n{'predictions': array([9.779798], dtype=float32)}\n{'predictions': array([9.726504], dtype=float32)}\n{'predictions': array([9.726254], dtype=float32)}\n{'predictions': array([9.770561], dtype=float32)}\n{'predictions': array([9.705739], dtype=float32)}\n{'predictions': array([9.725591], dtype=float32)}\n{'predictions': array([9.727586], dtype=float32)}\n{'predictions': array([9.723321], dtype=float32)}\n{'predictions': array([9.783486], dtype=float32)}\n{'predictions': array([9.72498], dtype=float32)}\n{'predictions': array([9.721289], dtype=float32)}\n{'predictions': array([9.724406], dtype=float32)}\n{'predictions': array([9.952964], dtype=float32)}\n{'predictions': array([9.842191], dtype=float32)}\n{'predictions': array([9.7245455], dtype=float32)}\n{'predictions': array([9.725813], dtype=float32)}\n{'predictions': array([9.840759], dtype=float32)}\n{'predictions': array([9.725041], dtype=float32)}\n{'predictions': array([9.95891], dtype=float32)}\n{'predictions': array([9.724993], dtype=float32)}\n{'predictions': array([9.7247], dtype=float32)}\n{'predictions': array([9.784086], dtype=float32)}\n{'predictions': array([10.016918], dtype=float32)}\n{'predictions': array([9.72346], dtype=float32)}\n{'predictions': array([9.722715], dtype=float32)}\n{'predictions': array([9.7779255], dtype=float32)}\n{'predictions': array([9.723487], dtype=float32)}\n{'predictions': array([9.724617], dtype=float32)}\n{'predictions': array([9.783481], dtype=float32)}\n{'predictions': array([9.958119], dtype=float32)}\n{'predictions': array([9.83793], dtype=float32)}\n{'predictions': array([9.724694], dtype=float32)}\n{'predictions': array([9.724417], dtype=float32)}\n{'predictions': array([9.783441], dtype=float32)}\n{'predictions': array([9.721094], dtype=float32)}\n{'predictions': array([9.726743], dtype=float32)}\n{'predictions': array([9.959603], dtype=float32)}\n{'predictions': array([9.724626], dtype=float32)}\n{'predictions': array([9.957655], dtype=float32)}\n{'predictions': array([9.727219], dtype=float32)}\n{'predictions': array([9.957913], dtype=float32)}\n{'predictions': array([9.725137], dtype=float32)}\n{'predictions': array([9.725447], dtype=float32)}\n{'predictions': array([9.785905], dtype=float32)}\n{'predictions': array([9.699819], dtype=float32)}\n{'predictions': array([9.724912], dtype=float32)}\n{'predictions': array([9.722926], dtype=float32)}\n{'predictions': array([9.727771], dtype=float32)}\n{'predictions': array([9.724721], dtype=float32)}\n{'predictions': array([9.7260475], dtype=float32)}\n{'predictions': array([9.726301], dtype=float32)}\n{'predictions': array([9.724392], dtype=float32)}\n{'predictions': array([9.958598], dtype=float32)}\n{'predictions': array([9.72387], dtype=float32)}\n{'predictions': array([9.897774], dtype=float32)}\n{'predictions': array([9.727302], dtype=float32)}\n{'predictions': array([9.725368], dtype=float32)}\n{'predictions': array([9.7243395], dtype=float32)}\n{'predictions': array([9.724176], dtype=float32)}\n{'predictions': array([10.017334], dtype=float32)}\n{'predictions': array([9.707982], dtype=float32)}\n{'predictions': array([9.726611], dtype=float32)}\n{'predictions': array([9.959146], dtype=float32)}\n{'predictions': array([9.725247], dtype=float32)}\n{'predictions': array([9.72557], dtype=float32)}\n{'predictions': array([9.712249], dtype=float32)}\n{'predictions': array([9.725261], dtype=float32)}\n{'predictions': array([9.725073], dtype=float32)}\n{'predictions': array([9.783842], dtype=float32)}\n{'predictions': array([9.724892], dtype=float32)}\n{'predictions': array([9.724619], dtype=float32)}\n{'predictions': array([9.725381], dtype=float32)}\n{'predictions': array([9.726256], dtype=float32)}\n{'predictions': array([9.782353], dtype=float32)}\n{'predictions': array([9.842463], dtype=float32)}\n{'predictions': array([9.724716], dtype=float32)}\n{'predictions': array([9.724908], dtype=float32)}\n{'predictions': array([9.706413], dtype=float32)}\n{'predictions': array([9.722877], dtype=float32)}\n{'predictions': array([9.72541], dtype=float32)}\n{'predictions': array([9.723989], dtype=float32)}\n{'predictions': array([9.724655], dtype=float32)}\n{'predictions': array([9.782948], dtype=float32)}\n{'predictions': array([9.783223], dtype=float32)}\n{'predictions': array([9.724475], dtype=float32)}\n{'predictions': array([9.959262], dtype=float32)}\n{'predictions': array([9.960138], dtype=float32)}\n{'predictions': array([9.842756], dtype=float32)}\n{'predictions': array([9.719766], dtype=float32)}\n{'predictions': array([9.725851], dtype=float32)}\n{'predictions': array([9.960104], dtype=float32)}\n{'predictions': array([9.783786], dtype=float32)}\n{'predictions': array([9.726041], dtype=float32)}\n{'predictions': array([9.725674], dtype=float32)}\n{'predictions': array([9.843949], dtype=float32)}\n{'predictions': array([9.725961], dtype=float32)}\n{'predictions': array([9.72526], dtype=float32)}\n{'predictions': array([9.731314], dtype=float32)}\n{'predictions': array([9.7248335], dtype=float32)}\n{'predictions': array([9.724617], dtype=float32)}\n{'predictions': array([9.954844], dtype=float32)}\n{'predictions': array([9.718325], dtype=float32)}\n{'predictions': array([9.72519], dtype=float32)}\n{'predictions': array([9.958587], dtype=float32)}\n{'predictions': array([9.724893], dtype=float32)}\n{'predictions': array([9.725568], dtype=float32)}\n{'predictions': array([9.780485], dtype=float32)}\n{'predictions': array([9.719585], dtype=float32)}\n{'predictions': array([9.72538], dtype=float32)}\n{'predictions': array([9.782694], dtype=float32)}\n{'predictions': array([9.725588], dtype=float32)}\n{'predictions': array([9.9555], dtype=float32)}\n{'predictions': array([9.726231], dtype=float32)}\n{'predictions': array([9.840615], dtype=float32)}\n{'predictions': array([9.959036], dtype=float32)}\n{'predictions': array([9.9607315], dtype=float32)}\n{'predictions': array([9.7126255], dtype=float32)}\n{'predictions': array([9.723138], dtype=float32)}\n{'predictions': array([9.725596], dtype=float32)}\n{'predictions': array([9.726601], dtype=float32)}\n{'predictions': array([9.958133], dtype=float32)}\n{'predictions': array([9.725787], dtype=float32)}\n{'predictions': array([9.722257], dtype=float32)}\n{'predictions': array([9.725814], dtype=float32)}\n{'predictions': array([9.725989], dtype=float32)}\n{'predictions': array([9.901217], dtype=float32)}\n{'predictions': array([9.725709], dtype=float32)}\n{'predictions': array([9.784845], dtype=float32)}\n{'predictions': array([9.780834], dtype=float32)}\n{'predictions': array([9.724954], dtype=float32)}\n{'predictions': array([9.726087], dtype=float32)}\n{'predictions': array([9.725517], dtype=float32)}\n{'predictions': array([9.783617], dtype=float32)}\n{'predictions': array([9.7238455], dtype=float32)}\n{'predictions': array([9.726214], dtype=float32)}\n{'predictions': array([10.016923], dtype=float32)}\n{'predictions': array([9.725147], dtype=float32)}\n{'predictions': array([9.724187], dtype=float32)}\n{'predictions': array([9.724105], dtype=float32)}\n{'predictions': array([10.017246], dtype=float32)}\n{'predictions': array([9.725192], dtype=float32)}\n{'predictions': array([9.776067], dtype=float32)}\n"
]
],
[
[
"This explains why the RMSE was so high -- the model essentially predicts the same amount for every trip. Would a more complex model help? Let's try using a deep neural network. The code to do this is quite straightforward as well.",
"_____no_output_____"
],
[
"<h3> Deep Neural Network regression </h3>",
"_____no_output_____"
]
],
[
[
"#tf.compat.v1.logging.set_verbosity(tf.logging.INFO)\nshutil.rmtree(OUTDIR, ignore_errors = True) # start fresh each time\nmodel = tf.estimator.DNNRegressor(hidden_units = [32, 8, 2],\n feature_columns = make_feature_cols(), model_dir = OUTDIR)\nmodel.train(input_fn = make_train_input_fn(df_train, num_epochs = 100));\nprint_rmse(model, df_valid)",
"INFO:tensorflow:Using default config.\nINFO:tensorflow:Using config: {'_model_dir': 'taxi_trained', '_tf_random_seed': None, '_save_summary_steps': 100, '_save_checkpoints_steps': None, '_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true\ngraph_options {\n rewrite_options {\n meta_optimizer_iterations: ONE\n }\n}\n, '_keep_checkpoint_max': 5, '_keep_checkpoint_every_n_hours': 10000, '_log_step_count_steps': 100, '_train_distribute': None, '_device_fn': None, '_protocol': None, '_eval_distribute': None, '_experimental_distribute': None, '_experimental_max_worker_delay_secs': None, '_session_creation_timeout_secs': 7200, '_service': None, '_cluster_spec': ClusterSpec({}), '_task_type': 'worker', '_task_id': 0, '_global_id_in_cluster': 0, '_master': '', '_evaluation_master': '', '_is_chief': True, '_num_ps_replicas': 0, '_num_worker_replicas': 1}\nINFO:tensorflow:Calling model_fn.\nWARNING:tensorflow:Layer dnn is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because it's dtype defaults to floatx.\n\nIf you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n\nTo change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n\nINFO:tensorflow:Done calling model_fn.\nINFO:tensorflow:Create CheckpointSaverHook.\nINFO:tensorflow:Graph was finalized.\nINFO:tensorflow:Running local_init_op.\nINFO:tensorflow:Done running local_init_op.\nINFO:tensorflow:Calling checkpoint listeners before saving checkpoint 0...\nINFO:tensorflow:Saving checkpoints for 0 into taxi_trained/model.ckpt.\nINFO:tensorflow:Calling checkpoint listeners after saving checkpoint 0...\nINFO:tensorflow:loss = 215.41937, step = 0\nINFO:tensorflow:global_step/sec: 309.496\nINFO:tensorflow:loss = 171.20761, step = 100 (0.325 sec)\nWARNING:tensorflow:It seems that global step (tf.train.get_global_step) has not been increased. Current value (could be stable): 150 vs previous value: 150. You could increase the global step by passing tf.train.get_global_step() to Optimizer.apply_gradients or Optimizer.minimize.\nWARNING:tensorflow:It seems that global step (tf.train.get_global_step) has not been increased. Current value (could be stable): 188 vs previous value: 188. You could increase the global step by passing tf.train.get_global_step() to Optimizer.apply_gradients or Optimizer.minimize.\nINFO:tensorflow:global_step/sec: 324.956\nINFO:tensorflow:loss = 229.05475, step = 200 (0.306 sec)\nINFO:tensorflow:global_step/sec: 346.702\nINFO:tensorflow:loss = 150.03104, step = 300 (0.289 sec)\nINFO:tensorflow:global_step/sec: 340.696\nINFO:tensorflow:loss = 175.90842, step = 400 (0.298 sec)\nINFO:tensorflow:global_step/sec: 321.122\nINFO:tensorflow:loss = 192.61421, step = 500 (0.314 sec)\nINFO:tensorflow:global_step/sec: 343.902\nINFO:tensorflow:loss = 198.90562, step = 600 (0.284 sec)\nINFO:tensorflow:global_step/sec: 350.791\nINFO:tensorflow:loss = 158.50755, step = 700 (0.286 sec)\nINFO:tensorflow:global_step/sec: 340.604\nINFO:tensorflow:loss = 237.85802, step = 800 (0.294 sec)\nINFO:tensorflow:global_step/sec: 333.713\nINFO:tensorflow:loss = 137.14474, step = 900 (0.299 sec)\nINFO:tensorflow:global_step/sec: 334.055\nINFO:tensorflow:loss = 170.93192, step = 1000 (0.301 sec)\nINFO:tensorflow:global_step/sec: 336.959\nINFO:tensorflow:loss = 267.50305, step = 1100 (0.296 sec)\nINFO:tensorflow:global_step/sec: 312.317\nINFO:tensorflow:loss = 258.12503, step = 1200 (0.321 sec)\nINFO:tensorflow:global_step/sec: 325.495\nINFO:tensorflow:loss = 203.92064, step = 1300 (0.315 sec)\nINFO:tensorflow:global_step/sec: 318.114\nINFO:tensorflow:loss = 225.84894, step = 1400 (0.310 sec)\nINFO:tensorflow:global_step/sec: 319.121\nINFO:tensorflow:loss = 180.59286, step = 1500 (0.312 sec)\nINFO:tensorflow:global_step/sec: 346.366\nINFO:tensorflow:loss = 197.91556, step = 1600 (0.288 sec)\nINFO:tensorflow:global_step/sec: 341.72\nINFO:tensorflow:loss = 141.0896, step = 1700 (0.290 sec)\nINFO:tensorflow:global_step/sec: 330.44\nINFO:tensorflow:loss = 180.14142, step = 1800 (0.302 sec)\nINFO:tensorflow:global_step/sec: 310.562\nINFO:tensorflow:loss = 221.46503, step = 1900 (0.330 sec)\nINFO:tensorflow:global_step/sec: 307.817\nINFO:tensorflow:loss = 163.64323, step = 2000 (0.322 sec)\nINFO:tensorflow:global_step/sec: 324.268\nINFO:tensorflow:loss = 184.34209, step = 2100 (0.304 sec)\nINFO:tensorflow:global_step/sec: 330.654\nINFO:tensorflow:loss = 176.24173, step = 2200 (0.301 sec)\nINFO:tensorflow:global_step/sec: 338.769\nINFO:tensorflow:loss = 213.4664, step = 2300 (0.295 sec)\nWARNING:tensorflow:It seems that global step (tf.train.get_global_step) has not been increased. Current value (could be stable): 2313 vs previous value: 2313. You could increase the global step by passing tf.train.get_global_step() to Optimizer.apply_gradients or Optimizer.minimize.\nINFO:tensorflow:global_step/sec: 331.866\nINFO:tensorflow:loss = 218.05621, step = 2400 (0.300 sec)\nINFO:tensorflow:global_step/sec: 342.808\nINFO:tensorflow:loss = 200.99681, step = 2500 (0.299 sec)\nINFO:tensorflow:global_step/sec: 341.058\nINFO:tensorflow:loss = 198.24068, step = 2600 (0.292 sec)\nINFO:tensorflow:global_step/sec: 335.49\nINFO:tensorflow:loss = 174.86713, step = 2700 (0.298 sec)\nWARNING:tensorflow:It seems that global step (tf.train.get_global_step) has not been increased. Current value (could be stable): 2766 vs previous value: 2766. You could increase the global step by passing tf.train.get_global_step() to Optimizer.apply_gradients or Optimizer.minimize.\nINFO:tensorflow:global_step/sec: 321.401\nINFO:tensorflow:loss = 201.94894, step = 2800 (0.310 sec)\nINFO:tensorflow:global_step/sec: 334.828\nINFO:tensorflow:loss = 223.21855, step = 2900 (0.294 sec)\nINFO:tensorflow:global_step/sec: 308.949\nINFO:tensorflow:loss = 187.58313, step = 3000 (0.332 sec)\nINFO:tensorflow:global_step/sec: 328.25\nINFO:tensorflow:loss = 258.24863, step = 3100 (0.296 sec)\nINFO:tensorflow:global_step/sec: 354.493\nINFO:tensorflow:loss = 155.35954, step = 3200 (0.282 sec)\nINFO:tensorflow:global_step/sec: 332.224\nINFO:tensorflow:loss = 182.15256, step = 3300 (0.302 sec)\nINFO:tensorflow:global_step/sec: 352.836\nINFO:tensorflow:loss = 187.07733, step = 3400 (0.285 sec)\nINFO:tensorflow:global_step/sec: 329.85\nINFO:tensorflow:loss = 196.104, step = 3500 (0.300 sec)\nINFO:tensorflow:global_step/sec: 326.411\nINFO:tensorflow:loss = 154.3697, step = 3600 (0.308 sec)\nINFO:tensorflow:global_step/sec: 343.811\nINFO:tensorflow:loss = 145.7904, step = 3700 (0.292 sec)\nINFO:tensorflow:global_step/sec: 332.498\nINFO:tensorflow:loss = 220.82303, step = 3800 (0.303 sec)\nINFO:tensorflow:global_step/sec: 337.338\nINFO:tensorflow:loss = 191.61127, step = 3900 (0.292 sec)\nINFO:tensorflow:global_step/sec: 327.316\nINFO:tensorflow:loss = 161.62473, step = 4000 (0.307 sec)\nINFO:tensorflow:global_step/sec: 345.695\nINFO:tensorflow:loss = 215.06691, step = 4100 (0.289 sec)\nINFO:tensorflow:global_step/sec: 327.087\nINFO:tensorflow:loss = 312.07742, step = 4200 (0.306 sec)\nINFO:tensorflow:global_step/sec: 339.685\nINFO:tensorflow:loss = 167.9133, step = 4300 (0.294 sec)\nINFO:tensorflow:global_step/sec: 348.733\nINFO:tensorflow:loss = 220.12291, step = 4400 (0.285 sec)\nINFO:tensorflow:global_step/sec: 340.365\nINFO:tensorflow:loss = 225.25928, step = 4500 (0.295 sec)\nINFO:tensorflow:global_step/sec: 326.47\nINFO:tensorflow:loss = 132.75055, step = 4600 (0.306 sec)\nINFO:tensorflow:global_step/sec: 333.887\nINFO:tensorflow:loss = 298.2876, step = 4700 (0.300 sec)\nINFO:tensorflow:global_step/sec: 339.964\nINFO:tensorflow:loss = 226.4703, step = 4800 (0.295 sec)\nINFO:tensorflow:global_step/sec: 336.618\nINFO:tensorflow:loss = 163.0517, step = 4900 (0.295 sec)\nINFO:tensorflow:global_step/sec: 348.916\nINFO:tensorflow:loss = 244.76672, step = 5000 (0.292 sec)\nINFO:tensorflow:global_step/sec: 348.477\nINFO:tensorflow:loss = 170.8958, step = 5100 (0.282 sec)\nINFO:tensorflow:global_step/sec: 333.009\nINFO:tensorflow:loss = 184.03586, step = 5200 (0.306 sec)\nINFO:tensorflow:global_step/sec: 336.539\nINFO:tensorflow:loss = 221.23529, step = 5300 (0.291 sec)\nINFO:tensorflow:global_step/sec: 343.523\nINFO:tensorflow:loss = 167.82779, step = 5400 (0.291 sec)\nINFO:tensorflow:global_step/sec: 348.902\nINFO:tensorflow:loss = 175.96718, step = 5500 (0.288 sec)\nINFO:tensorflow:global_step/sec: 338.072\nINFO:tensorflow:loss = 222.92639, step = 5600 (0.301 sec)\nINFO:tensorflow:global_step/sec: 331.632\nINFO:tensorflow:loss = 150.6329, step = 5700 (0.297 sec)\nINFO:tensorflow:global_step/sec: 335.4\nINFO:tensorflow:loss = 170.21207, step = 5800 (0.300 sec)\nINFO:tensorflow:global_step/sec: 352.21\nINFO:tensorflow:loss = 275.15045, step = 5900 (0.284 sec)\nINFO:tensorflow:global_step/sec: 341.027\nINFO:tensorflow:loss = 181.51933, step = 6000 (0.292 sec)\nINFO:tensorflow:Calling checkpoint listeners before saving checkpoint 6071...\nINFO:tensorflow:Saving checkpoints for 6071 into taxi_trained/model.ckpt.\nINFO:tensorflow:Calling checkpoint listeners after saving checkpoint 6071...\nINFO:tensorflow:Loss for final step: 192.64664.\nINFO:tensorflow:Calling model_fn.\nWARNING:tensorflow:Layer dnn is casting an input tensor from dtype float64 to the layer's dtype of float32, which is new behavior in TensorFlow 2. The layer has dtype float32 because it's dtype defaults to floatx.\n\nIf you intended to run this layer in float32, you can safely ignore this warning. If in doubt, this warning is likely only an issue if you are porting a TensorFlow 1.X model to TensorFlow 2.\n\nTo change all layers to have dtype float64 by default, call `tf.keras.backend.set_floatx('float64')`. To change just this layer, pass dtype='float64' to the layer constructor. If you are the author of this layer, you can disable autocasting by passing autocast=False to the base Layer constructor.\n\nINFO:tensorflow:Done calling model_fn.\nINFO:tensorflow:Starting evaluation at 2020-06-02T16:26:34Z\nINFO:tensorflow:Graph was finalized.\nINFO:tensorflow:Restoring parameters from taxi_trained/model.ckpt-6071\nINFO:tensorflow:Running local_init_op.\nINFO:tensorflow:Done running local_init_op.\nINFO:tensorflow:Inference Time : 0.30997s\nINFO:tensorflow:Finished evaluation at 2020-06-02-16:26:34\nINFO:tensorflow:Saving dict for global step 6071: average_loss = 241.328, global_step = 6071, label/mean = 11.666427, loss = 225.01866, prediction/mean = 0.15346375\nINFO:tensorflow:Saving 'checkpoint_path' summary for global step 6071: taxi_trained/model.ckpt-6071\nRMSE on dataset = 15.534735679626465\n"
]
],
[
[
"We are not beating our benchmark with either model ... what's up? Well, we may be using TensorFlow for Machine Learning, but we are not yet using it well. That's what the rest of this course is about!\n\nBut, for the record, let's say we had to choose between the two models. We'd choose the one with the lower validation error. Finally, we'd measure the RMSE on the test data with this chosen model.",
"_____no_output_____"
],
[
"<h2> Benchmark dataset </h2>\n\nLet's do this on the benchmark dataset.",
"_____no_output_____"
]
],
[
[
"from google.cloud import bigquery\nimport numpy as np\nimport pandas as pd\n\ndef create_query(phase, EVERY_N):\n \"\"\"\n phase: 1 = train 2 = valid\n \"\"\"\n base_query = \"\"\"\nSELECT\n (tolls_amount + fare_amount) AS fare_amount,\n EXTRACT(DAYOFWEEK FROM pickup_datetime) * 1.0 AS dayofweek,\n EXTRACT(HOUR FROM pickup_datetime) * 1.0 AS hourofday,\n pickup_longitude AS pickuplon,\n pickup_latitude AS pickuplat,\n dropoff_longitude AS dropofflon,\n dropoff_latitude AS dropofflat,\n passenger_count*1.0 AS passengers,\n CONCAT(CAST(pickup_datetime AS STRING), CAST(pickup_longitude AS STRING), CAST(pickup_latitude AS STRING), CAST(dropoff_latitude AS STRING), CAST(dropoff_longitude AS STRING)) AS key\nFROM\n `nyc-tlc.yellow.trips`\nWHERE\n trip_distance > 0\n AND fare_amount >= 2.5\n AND pickup_longitude > -78\n AND pickup_longitude < -70\n AND dropoff_longitude > -78\n AND dropoff_longitude < -70\n AND pickup_latitude > 37\n AND pickup_latitude < 45\n AND dropoff_latitude > 37\n AND dropoff_latitude < 45\n AND passenger_count > 0\n \"\"\"\n\n if EVERY_N == None:\n if phase < 2:\n # Training\n query = \"{0} AND ABS(MOD(FARM_FINGERPRINT(CAST(pickup_datetime AS STRING)), 4)) < 2\".format(base_query)\n else:\n # Validation\n query = \"{0} AND ABS(MOD(FARM_FINGERPRINT(CAST(pickup_datetime AS STRING)), 4)) = {1}\".format(base_query, phase)\n else:\n query = \"{0} AND ABS(MOD(FARM_FINGERPRINT(CAST(pickup_datetime AS STRING)), {1})) = {2}\".format(base_query, EVERY_N, phase)\n \n return query\n\nquery = create_query(2, 100000)\ndf = bigquery.Client().query(query).to_dataframe()",
"_____no_output_____"
],
[
"print_rmse(model, df)",
"INFO:tensorflow:Calling model_fn.\nINFO:tensorflow:Done calling model_fn.\nINFO:tensorflow:Starting evaluation at 2019-07-01T20:24:30Z\nINFO:tensorflow:Graph was finalized.\nINFO:tensorflow:Restoring parameters from taxi_trained/model.ckpt-6071\nINFO:tensorflow:Running local_init_op.\nINFO:tensorflow:Done running local_init_op.\nINFO:tensorflow:Finished evaluation at 2019-07-01-20:24:31\nINFO:tensorflow:Saving dict for global step 6071: average_loss = 114.547554, global_step = 6071, label/mean = 11.232336, loss = 14554.199, prediction/mean = 6.168037\nINFO:tensorflow:Saving 'checkpoint_path' summary for global step 6071: taxi_trained/model.ckpt-6071\nRMSE on dataset = 10.702689170837402\n"
]
],
[
[
"RMSE on benchmark dataset is <b>9.41</b> (your results will vary because of random seeds).\n\nThis is not only way more than our original benchmark of 6.00, but it doesn't even beat our distance-based rule's RMSE of 8.02.\n\nFear not -- you have learned how to write a TensorFlow model, but not to do all the things that you will have to do to your ML model performant. We will do this in the next chapters. In this chapter though, we will get our TensorFlow model ready for these improvements.\n\nIn a software sense, the rest of the labs in this chapter will be about refactoring the code so that we can improve it.",
"_____no_output_____"
],
[
"## Challenge Exercise\n\nCreate a neural network that is capable of finding the volume of a cylinder given the radius of its base (r) and its height (h). Assume that the radius and height of the cylinder are both in the range 0.5 to 2.0. Simulate the necessary training dataset.\n<p>\nHint (highlight to see):\n<p style='color:white'>\nThe input features will be r and h and the label will be $\\pi r^2 h$\nCreate random values for r and h and compute V.\nYour dataset will consist of r, h and V.\nThen, use a DNN regressor.\nMake sure to generate enough data.\n</p>",
"_____no_output_____"
],
[
"Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
]
]
|
cb69a968b820cb95700c2e81c7627e73b22a57c6 | 290,774 | ipynb | Jupyter Notebook | ML/Practice_support_vector_machine.ipynb | hee22/TIL | 4ad0a1a52d22858a7ea67c826c5baa54990636de | [
"MIT"
]
| 1 | 2019-12-28T10:32:53.000Z | 2019-12-28T10:32:53.000Z | ML/Practice_support_vector_machine.ipynb | hee22/TIL | 4ad0a1a52d22858a7ea67c826c5baa54990636de | [
"MIT"
]
| null | null | null | ML/Practice_support_vector_machine.ipynb | hee22/TIL | 4ad0a1a52d22858a7ea67c826c5baa54990636de | [
"MIT"
]
| null | null | null | 468.235105 | 85,740 | 0.936593 | [
[
[
"from sklearn.datasets import make_blobs\nX, y = make_blobs(n_samples=50, centers=2, cluster_std=0.5, random_state=4)\ny = 2 * y - 1\n\nplt.scatter(X[y == -1, 0], X[y == -1, 1], marker='o', label=\"-1 class\")\nplt.scatter(X[y == +1, 0], X[y == +1, 1], marker='x', label=\"+1 class\")\nplt.xlabel(\"x1\")\nplt.ylabel(\"x2\")\nplt.legend()\nplt.title(\"train data\")\nplt.show()",
"_____no_output_____"
],
[
"from sklearn.svm import SVC\nmodel = SVC(kernel='linear', C=1e10).fit(X, y)",
"_____no_output_____"
],
[
"model.n_support_",
"_____no_output_____"
],
[
"model.support_",
"_____no_output_____"
],
[
"model.support_vectors_",
"_____no_output_____"
],
[
"y[model.support_]",
"_____no_output_____"
],
[
"xmin = X[:, 0].min()\nxmax = X[:, 0].max()\nymin = X[:, 1].min()\nymax = X[:, 1].max()\nxx = np.linspace(xmin, xmax, 10)\nyy = np.linspace(ymin, ymax, 10)\nX1, X2 = np.meshgrid(xx, yy)\n\nZ = np.empty(X1.shape)\nfor (i, j), val in np.ndenumerate(X1):\n x1 = val\n x2 = X2[i, j]\n p = model.decision_function([[x1, x2]])\n Z[i, j] = p[0]\nlevels = [-1, 0, 1]\nlinestyles = ['dashed', 'solid', 'dashed']\nplt.scatter(X[y == -1, 0], X[y == -1, 1], marker='o', label=\"-1 class\")\nplt.scatter(X[y == +1, 0], X[y == +1, 1], marker='x', label=\"+1 class\")\nplt.contour(X1, X2, Z, levels, colors='k', linestyles=linestyles)\nplt.scatter(model.support_vectors_[:, 0], model.support_vectors_[:, 1], s=300, alpha=0.3)\n\nx_new = [10, 2]\nplt.scatter(x_new[0], x_new[1], marker='^', s=100)\nplt.text(x_new[0] + 0.03, x_new[1] + 0.08, \"test data\")\n\nplt.xlabel(\"x1\")\nplt.ylabel(\"x2\")\nplt.legend()\nplt.title(\"SVM\")\n\nplt.show()",
"_____no_output_____"
],
[
"x_new = [10, 2]\nmodel.decision_function([x_new])",
"_____no_output_____"
],
[
"model.coef_.dot(x_new) + model.intercept_",
"_____no_output_____"
],
[
"# dual_coef_ = a_i * y_i\nmodel.dual_coef_",
"_____no_output_____"
],
[
"model.dual_coef_[0][0] * model.support_vectors_[0].dot(x_new) + \\\n model.dual_coef_[0][1] * model.support_vectors_[1].dot(x_new) + \\\n model.intercept_",
"_____no_output_____"
],
[
"# iris example\nfrom sklearn.datasets import load_iris\niris = load_iris()\n\nidx = np.in1d(iris.target, [0, 1])\nX = iris.data[idx, :2]\ny = (2 * iris.target[idx] - 1).astype(np.int)",
"_____no_output_____"
],
[
"model = SVC(kernel='linear', C=1e10).fit(X, y)",
"_____no_output_____"
],
[
"xmin = X[:, 0].min()\nxmax = X[:, 0].max()\nymin = X[:, 1].min()\nymax = X[:, 1].max()\nxx = np.linspace(xmin, xmax, 10)\nyy = np.linspace(ymin, ymax, 10)\nX1, X2 = np.meshgrid(xx, yy)\n\nZ = np.empty(X1.shape)\nfor (i, j), val in np.ndenumerate(X1):\n x1 = val\n x2 = X2[i, j]\n p = model.decision_function([[x1, x2]])\n Z[i, j] = p[0]\nlevels = [-1, 0, 1]\nlinestyles = ['dashed', 'solid', 'dashed']\nplt.scatter(X[y == -1, 0], X[y == -1, 1], marker='o', label=\"-1 class\")\nplt.scatter(X[y == +1, 0], X[y == +1, 1], marker='x', label=\"+1 class\")\nplt.contour(X1, X2, Z, levels, colors='k', linestyles=linestyles)\nplt.scatter(model.support_vectors_[:, 0], model.support_vectors_[:, 1], s=300, alpha=0.3)\n\nplt.xlabel(\"x1\")\nplt.ylabel(\"x2\")\nplt.legend()\nplt.title(\"SVM\")\n\nplt.show()",
"_____no_output_____"
],
[
"from sklearn.datasets import load_iris\niris = load_iris()\n\nidx = np.in1d(iris.target, [1, 2])\nX = iris.data[idx, 2:]\ny = (2 * iris.target[idx] - 3).astype(np.int)",
"_____no_output_____"
],
[
"model = SVC(kernel='linear', C=10).fit(X, y)",
"_____no_output_____"
],
[
"xmin = X[:, 0].min()\nxmax = X[:, 0].max()\nymin = X[:, 1].min()\nymax = X[:, 1].max()\nxx = np.linspace(xmin, xmax, 10)\nyy = np.linspace(ymin, ymax, 10)\nX1, X2 = np.meshgrid(xx, yy)\n\nZ = np.empty(X1.shape)\nfor (i, j), val in np.ndenumerate(X1):\n x1 = val\n x2 = X2[i, j]\n p = model.decision_function([[x1, x2]])\n Z[i, j] = p[0]\nlevels = [-1, 0, 1]\nlinestyles = ['dashed', 'solid', 'dashed']\nplt.scatter(X[y == -1, 0], X[y == -1, 1], marker='o', label=\"-1 class\")\nplt.scatter(X[y == +1, 0], X[y == +1, 1], marker='x', label=\"+1 class\")\nplt.contour(X1, X2, Z, levels, colors='k', linestyles=linestyles)\nplt.scatter(model.support_vectors_[:, 0], model.support_vectors_[:, 1], s=200, alpha=0.3)\n\nplt.xlabel(\"x1\")\nplt.ylabel(\"x2\")\nplt.legend()\nplt.title(\"C=10\")\n\nplt.show()",
"_____no_output_____"
],
[
"from sklearn.datasets import load_digits\ndigits = load_digits()\n\nN = 2\nM = 5\nnp.random.seed(0)\nfig = plt.figure(figsize=(9, 5))\nplt.subplots_adjust(top=1, bottom=0, hspace=0, wspace=0.05)\nklist = np.random.choice(range(len(digits.data)), N * M)\nfor i in range(N):\n for j in range(M):\n k = klist[i * M + j]\n ax = fig.add_subplot(N, M, i * M + j + 1)\n ax.imshow(digits.images[k], cmap=plt.cm.bone)\n ax.grid(False)\n ax.xaxis.set_ticks([])\n ax.yaxis.set_ticks([])\n plt.title(digits.target[k])\nplt.tight_layout()\nplt.show()",
"_____no_output_____"
],
[
"from sklearn.model_selection import train_test_split\nX_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target, test_size=0.4, random_state=0)\n\nfrom sklearn.svm import SVC\nsvc = SVC(kernel='linear').fit(X_train, y_train)\n\nN = 2\nM = 5\nnp.random.seed(4)\nfig = plt.figure(figsize=(9, 5))\nplt.subplots_adjust(top=1, bottom=0, hspace=0, wspace=0.05)\nklist = np.random.choice(range(len(y_test)), N * M)\nfor i in range(N):\n for j in range(M):\n k = klist[i * M + j]\n ax = fig.add_subplot(N, M, i * M + j + 1)\n ax.imshow(X_test[k:(k + 1), :].reshape(8,8), cmap=plt.cm.bone)\n ax.grid(False)\n ax.xaxis.set_ticks([])\n ax.yaxis.set_ticks([])\n plt.title(\"%d => %d\" %\n (y_test[k], svc.predict(X_test[k:(k + 1), :])[0]))\nplt.tight_layout()\nplt.show()",
"_____no_output_____"
],
[
"from sklearn.metrics import classification_report, accuracy_score\n\ny_pred_train = svc.predict(X_train)\ny_pred_test = svc.predict(X_test)",
"_____no_output_____"
],
[
"print(classification_report(y_train, y_pred_train))",
" precision recall f1-score support\n\n 0 1.00 1.00 1.00 118\n 1 1.00 1.00 1.00 109\n 2 1.00 1.00 1.00 106\n 3 1.00 1.00 1.00 113\n 4 1.00 1.00 1.00 118\n 5 1.00 1.00 1.00 93\n 6 1.00 1.00 1.00 105\n 7 1.00 1.00 1.00 114\n 8 1.00 1.00 1.00 96\n 9 1.00 1.00 1.00 106\n\n accuracy 1.00 1078\n macro avg 1.00 1.00 1.00 1078\nweighted avg 1.00 1.00 1.00 1078\n\n"
],
[
"print(classification_report(y_test, y_pred_test))",
" precision recall f1-score support\n\n 0 1.00 1.00 1.00 60\n 1 0.95 0.97 0.96 73\n 2 1.00 0.99 0.99 71\n 3 0.95 0.99 0.97 70\n 4 0.98 1.00 0.99 63\n 5 0.97 0.97 0.97 89\n 6 0.99 0.99 0.99 76\n 7 1.00 0.98 0.99 65\n 8 0.96 0.92 0.94 78\n 9 0.97 0.96 0.97 74\n\n accuracy 0.97 719\n macro avg 0.98 0.98 0.98 719\nweighted avg 0.98 0.97 0.97 719\n\n"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb69ac6486c039d2974613f950a4687fc45307e1 | 66,967 | ipynb | Jupyter Notebook | Faster_RCNN.ipynb | abbasturkoglu/faster_rcnn_colab_pytorch | 0cfb6321e97adfe5d050ed1b4e85a85a0d4fc6cf | [
"MIT"
]
| null | null | null | Faster_RCNN.ipynb | abbasturkoglu/faster_rcnn_colab_pytorch | 0cfb6321e97adfe5d050ed1b4e85a85a0d4fc6cf | [
"MIT"
]
| null | null | null | Faster_RCNN.ipynb | abbasturkoglu/faster_rcnn_colab_pytorch | 0cfb6321e97adfe5d050ed1b4e85a85a0d4fc6cf | [
"MIT"
]
| null | null | null | 37.898698 | 152 | 0.488524 | [
[
[
"### Set up google colab and unzip train data",
"_____no_output_____"
]
],
[
[
"# Set up google drive in google colab\n#save this change to master\nfrom google.colab import drive\ndrive.mount('/content/drive')\n",
"\nEnter your authorization code:\n··········\nMounted at /content/drive\n"
],
[
"# Unzip training data from drive\n\n!unzip -q 'drive/My Drive/VOCdevkit.zip' ",
"_____no_output_____"
]
],
[
[
"### Import Libraries",
"_____no_output_____"
]
],
[
[
"import random\nimport os\nimport math\nimport xml.etree.ElementTree as ET\nimport torch\nimport torch.nn as nn\nimport torch.nn.functional as F\nimport torchvision.models as models\nfrom torchvision import transforms\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom torch.utils.data import Dataset, DataLoader, random_split\nfrom PIL import Image,ImageFilter, ImageEnhance\nimport cv2\nimport torch.optim as optim\nfrom torchvision.ops import nms\nfrom tqdm import tqdm\nimport time",
"_____no_output_____"
]
],
[
[
"### Define Model Hyper Parameters",
"_____no_output_____"
]
],
[
[
"select_classes = {'aeroplane', 'bicycle','boat','bus', 'dog','train','motorbike'} # Only training for these classes\n\n\n\nanchor_scale = torch.FloatTensor([8,16,32]) \nanchor_ratio = torch.FloatTensor([0.5,1,2]) \nconversion_scale = 16\ninput_image_height = 800\ninput_image_width = 800\nnum_anchors_sample = 256\n\n# Non Maximum Suppression hyper parameters\nnms_threshold = 0.7 # only consider anchors with IOU < nms_threshold\nnms_num_train_pre = 12000 # Select top nms_num_train_pre anchors to apply nms on \nnms_num_train_post = 2000 # number of proposal regions after NMS\nnms_num_test_pre = 6000 # For test \nnms_num_test_post = 300 # For test\nnms_min_size = 16 # only consider anchors as valid while applying nms if ht and wt < nms_min_size\n\n\n#proposal target (pt) hyper parameters\npt_n_sample = 128 #Number of samples to sample from roi\npt_pos_ratio = 0.25 #the number of positive examples out of the n_samples\npt_pos_iou_threshold = 0.5 #Min overlap required between roi and gt for considering positive label (object)\npt_neg_iou_threshold = 0.5 # below this value marks as negative\n\n\n#ROI pooling\nroi_size = (7,7)\n\n# RPN loss \nrpn_loss_lambda = 1 # same is used in the decider loss\n\n\n# Number of validation images\nnum_valid_img = 150\n\ndevice = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\nprint(device)",
"cpu\n"
]
],
[
[
"### Handle Training Data",
"_____no_output_____"
],
[
"##### Get all classes and create label encoding",
"_____no_output_____"
]
],
[
[
"# Getting all the classes and creating label encoding\n\nall_labels = []\n\n\nfor out in sorted(os.listdir('VOCdevkit/VOC2007/Annotations/')):\n tree = ET.parse('VOCdevkit/VOC2007/Annotations/' + out)\n for obj in tree.findall('object'):\n lab = (obj.find('name').text)\n # all_labels.append(lab)\n if (lab in (select_classes)):\n all_labels.append(lab)\n \ndistict_labels = list(set(all_labels))\ndistict_labels = sorted(distict_labels)\n\n#label 0 is set for background\nlab_to_val = {j:i+1 for i,j in enumerate(distict_labels)}\nval_to_lab = {i+1:j for i,j in enumerate(distict_labels)}\n\nnum_classes = len(distict_labels) + 1\n\n\nprint(np.unique(np.array(all_labels), return_counts=True)[0])\nprint(np.unique(np.array(all_labels), return_counts=True)[1])\nprint(num_classes)",
"['aeroplane' 'bicycle' 'boat' 'bus' 'dog' 'motorbike' 'train']\n[331 418 398 272 538 390 328]\n8\n"
]
],
[
[
"##### Data augmentation",
"_____no_output_____"
]
],
[
[
"# Random blur on training image\ndef random_blur(img):\n if random.random() < 0.5:\n return img\n \n rad = random.choice([1,2])\n img = img.filter(ImageFilter.BoxBlur(radius=rad))\n return img\n\n\n# Random brightness, contrast, satutration and hue\ndef random_color(img):\n if random.random() < 0.1:\n return img\n\n img = transforms.ColorJitter(brightness=(0.5,2.0), contrast=(0.5,2.0), saturation=(0.5,2.0), hue=(-0.25,0.25))(img)\n return img\n\n# Random horizontal flip\ndef random_flip(img, gt_box):\n if random.random() < 0.5:\n return img,gt_box\n\n img = transforms.RandomHorizontalFlip(p=1)(img)\n temp = (gt_box[:,1]).copy()\n gt_box[:,1] = img.size[0] - gt_box[:,0] #x1\n gt_box[:,0] = img.size[0] - temp #x2\n\n return img, gt_box\n\n\n# Random crop on image\ndef random_crop(img, gt_box, labels):\n if random.random() < 0.5:\n return img,gt_box,labels\n width, height = img.size\n select_w = random.uniform(0.6*width, width)\n select_h = random.uniform(0.6*height, height)\n\n start_x = random.uniform(0,width - select_w)\n start_y = random.uniform(0,height - select_h)\n\n left = start_x\n upper = start_y\n right = start_x + select_w\n bottom = start_y + select_h\n\n gt_box_copy = gt_box.copy()\n\n gt_box_copy[gt_box_copy[:,0] < left, 0] = left\n gt_box_copy[gt_box_copy[:,1] > right, 1] = right\n gt_box_copy[gt_box_copy[:,2] < upper, 2] = upper\n gt_box_copy[gt_box_copy[:,3] > bottom, 3] = bottom\n\n final_gt_box = []\n final_labels = []\n\n for i in range((gt_box_copy.shape[0])):\n if (((gt_box_copy[i,1] - gt_box_copy[i,0])/(gt_box[i,1]-gt_box[i,0])) < 0.5):\n continue\n if (((gt_box_copy[i,3] - gt_box_copy[i,2])/(gt_box[i,3] - gt_box[i,2])) < 0.5):\n continue\n final_gt_box.append(gt_box_copy[i])\n final_labels.append(labels[i])\n\n if len(final_gt_box) == 0:\n return img,gt_box,labels\n\n final_gt_box = np.array(final_gt_box)\n final_gt_box[:,0] = final_gt_box[:,0] - left\n final_gt_box[:,1] = final_gt_box[:,1] - left\n final_gt_box[:,2] = final_gt_box[:,2] - upper\n final_gt_box[:,3] = final_gt_box[:,3] - upper\n\n return img.crop((left, upper, right, bottom)), final_gt_box, final_labels",
"_____no_output_____"
]
],
[
[
"##### Create Pytorch Dataset and Dataloader\n",
"_____no_output_____"
]
],
[
[
"\nclass pascal_voc_data(Dataset):\n def __init__(self, img_dir,desc_dir,type_list, isTrain, transform = None):\n super().__init__()\n self.img_dir = img_dir\n self.desc_dir = desc_dir\n self.type_list = type_list\n self.isTrain = isTrain\n self.transform = transform\n\n\n self.img_names = []\n self.img_descs = []\n for img in sorted(os.listdir(img_dir)):\n if img[:-4] in self.type_list:\n self.img_names.append(img)\n \n for desc in sorted(os.listdir(desc_dir)):\n if desc[:-4] in self.type_list:\n self.img_descs.append(desc)\n \n self.img_names = [os.path.join(img_dir, img_name) for img_name in self.img_names]\n self.img_descs = [os.path.join(desc_dir, img_desc) for img_desc in self.img_descs]\n\n \n # self.img_names = sorted(os.listdir(img_dir))\n # self.img_descs = sorted(os.listdir(desc_dir))\n \n # self.img_names = [os.path.join(img_dir, img_name) for img_name in self.img_names]\n # self.img_descs = [os.path.join(desc_dir, img_desc) for img_desc in self.img_descs]\n \n \n self.loc_gts = []\n self.loc_labels = []\n self.final_img_names = []\n for img_idx,img_desc in enumerate(self.img_descs):\n tree = ET.parse(img_desc)\n gt = []\n loc_lab = []\n for obj in tree.findall('object'):\n if ((obj.find('name').text) not in (select_classes)):\n continue\n lab = lab_to_val[(obj.find('name').text)]\n \n loc1 = int(obj.find('bndbox').find('xmin').text)\n loc2 = int(obj.find('bndbox').find('xmax').text)\n loc3 = int(obj.find('bndbox').find('ymin').text)\n loc4 = int(obj.find('bndbox').find('ymax').text)\n\n # if ht or width is less than 10, ignore the gt box\n if ((loc2 - loc1) < 10 ) or ((loc4 - loc3) < 10):\n continue\n\n gt.append([int(loc1),int(loc2),int(loc3),int(loc4)])\n loc_lab.append(lab)\n if (len(gt) == 0):\n continue\n self.loc_gts.append(gt)\n self.loc_labels.append(loc_lab)\n self.final_img_names.append(self.img_names[img_idx])\n\n self.img_names = self.final_img_names\n \n def __len__(self):\n return len(self.img_names)\n \n def __getitem__(self,idx):\n img_name = self.img_names[idx]\n img = Image.open(img_name)\n\n arr_loc_gts = np.array(self.loc_gts[idx])\n label = self.loc_labels[idx]\n\n if self.isTrain:\n img = random_blur(img)\n img = random_color(img)\n img,arr_loc_gts = random_flip(img,arr_loc_gts)\n img,arr_loc_gts,label = random_crop(img,arr_loc_gts,label)\n \n img_h_pre = img.size[1]\n img_w_pre = img.size[0]\n \n if self.transform:\n img = self.transform(img)\n \n img_h_post = img.shape[1]\n img_w_post = img.shape[2]\n \n height_ratio = img_h_post/img_h_pre\n width_ratio = img_w_post/img_w_pre\n \n \n \n arr_loc_gts[:,0] = arr_loc_gts[:,0]*width_ratio\n arr_loc_gts[:,1] = arr_loc_gts[:,1]*width_ratio\n arr_loc_gts[:,2] = arr_loc_gts[:,2]*height_ratio\n arr_loc_gts[:,3] = arr_loc_gts[:,3]*height_ratio\n \n gts = (arr_loc_gts).tolist()\n \n \n return img, gts,label",
"_____no_output_____"
],
[
"'''\nWhile using pretrained models - \nPytorch torchvision documentation - https://pytorch.org/docs/master/torchvision/models.html\nThe images have to be loaded in to a range of [0, 1] and then \nnormalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225]\n'''\n\ntransform = transforms.Compose(\n [transforms.Resize((input_image_height,input_image_width)),\n transforms.ToTensor(),\n transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))])\n\n\ninv_normalize = transforms.Normalize(\n mean=[-0.485/0.229, -0.456/0.224, -0.406/0.225],\n std=[1/0.229, 1/0.224, 1/0.225]\n)",
"_____no_output_____"
]
],
[
[
"##### Split into train and validations ",
"_____no_output_____"
]
],
[
[
"file = open('drive/My Drive/val.txt', \"r\")\nvalid_images = file.read().split('\\n')\nvalid_images = valid_images[:-1]\n\n\ntrain_images = []\nfor img in os.listdir('VOCdevkit/VOC2007/JPEGImages/'):\n if img[:-4] in valid_images:\n continue\n train_images.append(img[:-4])",
"_____no_output_____"
],
[
"train_dataset = pascal_voc_data('VOCdevkit/VOC2007/JPEGImages/', 'VOCdevkit/VOC2007/Annotations/',train_images , True,transform)\nvalid_dataset = pascal_voc_data('VOCdevkit/VOC2007/JPEGImages/', 'VOCdevkit/VOC2007/Annotations/',valid_images ,False,transform)",
"_____no_output_____"
],
[
"print(len(train_dataset))\nprint(len(valid_dataset))",
"1668\n109\n"
]
],
[
[
"##### Validation class images",
"_____no_output_____"
]
],
[
[
"test_loader = DataLoader(valid_dataset, batch_size = len(valid_dataset))\na,b,c = iter(test_loader).next()\nprint(torch.unique(c[0], return_counts=True))\n",
"(tensor([1, 2, 3, 4, 5, 6, 7]), tensor([17, 13, 13, 4, 33, 14, 15]))\n"
],
[
"train_loader = DataLoader(train_dataset, batch_size=1)\nvalid_loader = DataLoader(valid_dataset, batch_size=1,shuffle=True)",
"_____no_output_____"
]
],
[
[
"### Visualise input image with box co-ordinates provided in format - x0,x1,y0,y1",
"_____no_output_____"
]
],
[
[
"# Given input image, draw rectangles as specified by gt_box and pred_box and display\ndef visualize_tensor(img, gt_box, pred_box,save_image='',tb_writer=None):\n plt.figure(figsize=(5,5))\n transform_img = inv_normalize(img[0]).permute(1,2,0).to('cpu').numpy()\n transform_img = transform_img.copy()\n for box in gt_box:\n x0, x1, y0, y1 = box\n cv2.rectangle(transform_img, (int(x0),int(y0)), (int(x1),int(y1)), color=(0, 255, 255), thickness=2)\n for box in pred_box:\n x0, x1, y0, y1 = box\n cv2.rectangle(transform_img, (int(x0), int(y0)), (int(x1), int(y1)), color=(255, 0, 0), thickness=2)\n \n if tb_writer:\n # grid = torchvision.utils.make_grid(transform_img)\n tb_writer.add_image(save_image, transform_img, dataformats='HWC')\n elif save_image == '':\n plt.imshow(transform_img)\n plt.show() \n else:\n plt.imshow(transform_img)\n plt.savefig(save_image + '.png')\n\n ",
"_____no_output_____"
]
],
[
[
"### Faster RCNN backbone used - VGG16 model\n\n* Top 10 layers (top 4 conv layers) are not trained\n\n",
"_____no_output_____"
]
],
[
[
"# Base VGG16 model\n\ndef Faster_RCNN_vgg16(num_freeze_top): \n vgg16 = models.vgg16(pretrained=True)\n vgg_feature_extracter = vgg16.features[:-1]\n vgg_classifier = vgg16.classifier[:-1]\n \n # Freeze learning of top few conv layers\n for layer in vgg_feature_extracter[:num_freeze_top]:\n for param in layer.parameters():\n param.requires_grad = False\n \n return vgg_feature_extracter.to(device), vgg_classifier.to(device)\n",
"_____no_output_____"
]
],
[
[
"### Code for anchor generation on an image\n\n* For train and test, only anchors lying inside the image boundary are considered\n\n",
"_____no_output_____"
]
],
[
[
"'''\n RCNN Paper\n For anchors, we use 3 scales with box areas of (128*128) || (256*256) , and (512*512) pixels, \n and 3 aspect ratios of 1:1, 1:2, and 2:1.\n\n'''\n\n# At point x,y from feature map, return 9 anchors on the input image scale\ndef generate_anchor_at_point(x,y):\n anchor_positions = torch.zeros((len(anchor_scale) * len(anchor_ratio),4))\n ctr_x = (x*2+1)*(conversion_scale/2) # for x = 0, centre is 8 || for x = 1, centre is 24\n ctr_y = (y*2+1)*(conversion_scale/2)\n for ratio_idx in range(len(anchor_ratio)):\n for scale_idx in range(len(anchor_scale)):\n\n current = len(anchor_scale)*ratio_idx + scale_idx\n ratio = anchor_ratio[ratio_idx]\n scale = anchor_scale[scale_idx]\n\n h = conversion_scale*scale*torch.sqrt(ratio)\n w = conversion_scale*scale*torch.sqrt(1.0/ratio)\n \n anchor_positions[current,0] = ctr_x - w/2\n anchor_positions[current,1] = ctr_x + w/2\n anchor_positions[current,2] = ctr_y - h/2\n anchor_positions[current,3] = ctr_y + h/2\n \n return anchor_positions\n\n\n# For features of scale (x,y) , generate all the anchor boxes\n# input is height,width\n# returns output on x*y*9,4\ndef generate_anchors(x,y):\n anchor_positions = torch.zeros((x*y,len(anchor_scale) * len(anchor_ratio),4))\n for ctr_x in range(x):\n for ctr_y in range(y):\n current = ctr_x*y + ctr_y\n anchors = generate_anchor_at_point(ctr_x, ctr_y)\n anchor_positions[current] = anchors\n return anchor_positions.reshape(-1,4)",
"_____no_output_____"
],
[
"'''\nRCNN paper\n - During training, we ignore all cross-boundary anchors so they do not contribute to the loss\n - During testing, however, we still apply the fully convolutional RPN to the entire image. This may \n generate crossboundary proposal boxes, which we clip to the image boundary\n'''\n\n'''\n For this code, cross boundary anchors are ignored at this step both in train and test\n'''\n\ndef get_valid_anchors(anchor_positions):\n valid_anchors_idx = torch.where((anchor_positions[:,0] >= 0) & \n (anchor_positions[:,1] <= input_image_width) &\n (anchor_positions[:,2] >= 0) &\n (anchor_positions[:,3] <= input_image_height) )[0]\n\n anchor_positions = anchor_positions[valid_anchors_idx]\n return anchor_positions, valid_anchors_idx\n \n# valid_anchors,valid_anchors_idx = get_valid_anchors(anchor_positions)\n# print(valid_anchors)\n ",
"_____no_output_____"
]
],
[
[
"### Getting intersection over union between 2 sets of boxes",
"_____no_output_____"
]
],
[
[
"# Get Intersection over Union between all the boxes in anchor_positions and gt_boxes\n\ndef get_iou_matrix(anchor_positions, gt_boxes):\n iou_matrix = torch.zeros((len(anchor_positions), len(gt_boxes)))\n for idx,box in enumerate(gt_boxes):\n if isinstance(box,torch.Tensor):\n gt = torch.cat([box]*len(anchor_positions)).view(1,-1,4)[0]\n else:\n gt = torch.FloatTensor([box]*len(anchor_positions))\n max_x = torch.max(gt[:,0],anchor_positions[:,0])\n min_x = torch.min(gt[:,1],anchor_positions[:,1])\n max_y = torch.max(gt[:,2],anchor_positions[:,2])\n min_y = torch.min(gt[:,3],anchor_positions[:,3])\n \n invalid_roi_idx = (min_x < max_x) | (min_y < max_y)\n roi_area = (min_x - max_x)*(min_y - max_y)\n roi_area[invalid_roi_idx] = 0\n \n total_area = (gt[:,1] - gt[:,0])*(gt[:,3] - gt[:,2]) + \\\n (anchor_positions[:,1] - anchor_positions[:,0])*(anchor_positions[:,3]-anchor_positions[:,2]) - \\\n roi_area\n \n iou = roi_area/(total_area + 1e-6)\n \n iou_matrix[:,idx] = iou\n return iou_matrix\n \n ",
"_____no_output_____"
]
],
[
[
"### After IOU calculation between anchors and gt boxes \n\n* Assign +1/-1/0 labels to anchors based on IOU\n* Sample 128 positive and 128 negative anchors for training\n* If less than 128 positive anchors, pad with negative\n\n",
"_____no_output_____"
]
],
[
[
"\n'''\n RCNN paper: \n assign a positive label to two kinds of anchors: \n (i) the anchor/anchors with the highest Intersection-overUnion (IoU) overlap with a ground-truth box, \n (ii) an anchor that has an IoU overlap higher than 0.7 with\n \n assign a negative label to a non-positive anchor if its IoU ratio is lower than 0.3 \n Anchors that are neither positive nor negative do not contribute to the training objective.\n \n'''\n\ndef get_max_iou_data(iou_matrix):\n gt_max_value = iou_matrix.max(axis=0)[0] # for each gt box, this is the max iou\n \n #There is a possiblilty that corresponding to one gt box, there are multiple anchors with same iou (max value)\n all_gt_max = torch.where(iou_matrix == gt_max_value)[0]\n \n # For each anchor box, this is the max iou with any of the gt_box\n anchor_max_value = torch.max(iou_matrix, axis=1)[0]\n anchor_max = torch.argmax(iou_matrix, axis=1)\n \n return all_gt_max, anchor_max_value,anchor_max\n\n\n\n# 1 - positive || 0 - negative || -1 - ignore\ndef get_anchor_labels(anchor_positions, all_gt_max, anchor_max_value):\n anchor_labels = torch.zeros(anchor_positions.shape[0])\n anchor_labels.fill_(-1.0)\n\n # for each anchor box, if iou with any of the gt_box is less than threshold, mark as 0\n anchor_labels[anchor_max_value < 0.3] = 0\n \n # If corresponding to any gt_box, the anchor has max iou -> mark as 1\n anchor_labels[all_gt_max] = 1.0\n \n # If for any anchor box, iou is greater than threshold for any of the gt_box, mark as 1\n anchor_labels[anchor_max_value > 0.7] = 1.0\n return anchor_labels\n\n",
"_____no_output_____"
],
[
"'''\n RCNN paper \n randomly sample 256 anchors in an image to compute the loss function of a mini-batch, where\n the sampled positive and negative anchors have a ratio of up to 1:1. If there are fewer \n than 128 positive samples in an image, we pad the mini-batch with negative ones.\n'''\n\ndef sample_anchors_for_train(anchor_labels):\n pos_anchor_labels = torch.where(anchor_labels == 1)[0]\n num_pos = min(num_anchors_sample/2, len(pos_anchor_labels))\n pos_idx = np.random.choice(pos_anchor_labels, int(num_pos), replace=False)\n\n neg_anchor_labels = torch.where(anchor_labels == 0)[0]\n num_neg = num_anchors_sample - num_pos\n neg_idx = np.random.choice(neg_anchor_labels, int(num_neg), replace=False)\n \n anchor_labels[:] = -1\n anchor_labels[pos_idx] = 1\n anchor_labels[neg_idx] = 0\n \n return anchor_labels\n\n",
"_____no_output_____"
]
],
[
[
"### bbox regression training data calculation\n* delta_anchor_gt - Get delta between anchor_positions and gt_boxes\n* correct_anchor_positions - Given delta and anchor_positions, correct the anchors",
"_____no_output_____"
]
],
[
[
"'''\n x,y,w,h are ctr_x, ctr_y, width and height for GT box\n dx = (x - x_{a})/w_{a}\n dy = (y - y_{a})/h_{a}\n dw = log(w/ w_a)\n dh = log(h/ h_a)\n'''\n\n# Get delta between anchor_positions and gt_boxes\ndef delta_anchor_gt(anchor_positions, gt_boxes , anchor_max):\n\n anchor_gt_map = gt_boxes[anchor_max]\n \n anchor_height = anchor_positions[:,3] - anchor_positions[:,2] # y2-y1\n anchor_width = anchor_positions[:,1] - anchor_positions[:,0] # x2-x1\n anchor_ctr_y = anchor_positions[:,2] + anchor_height/2 # y1 + h/2\n anchor_ctr_x = anchor_positions[:,0] + anchor_width/2 # x1 + w/2\n \n gt_height = anchor_gt_map[:,3] - anchor_gt_map[:,2] # y2-y1\n gt_width = anchor_gt_map[:,1] - anchor_gt_map[:,0] # x2-x1\n gt_ctr_y = anchor_gt_map[:,2] + gt_height/2 # y1 + h/2\n gt_ctr_x = anchor_gt_map[:,0] + gt_width/2 # x1 + w/2\n \n dx = (gt_ctr_x - anchor_ctr_x)/anchor_width\n dy = (gt_ctr_y - anchor_ctr_y)/anchor_height\n dw = torch.log(gt_width/anchor_width)\n dh = torch.log(gt_height/anchor_height)\n \n delta = torch.zeros_like(anchor_positions)\n delta[:,0] = dx\n delta[:,1] = dy\n delta[:,2] = dw\n delta[:,3] = dh\n \n return delta\n\n\n# Given delta and anchor_positions, correct the anchors\ndef correct_anchor_positions(anchor_positions, delta):\n ha = anchor_positions[:,3] - anchor_positions[:,2] # y2-y1\n wa = anchor_positions[:,1] - anchor_positions[:,0] # x2-x1\n ya = anchor_positions[:,2] + ha/2 # y1 + h/2\n xa = anchor_positions[:,0] + wa/2 # x1 + w/2\n \n dx = delta[:,0]\n dy = delta[:,1]\n dw = delta[:,2]\n dh = delta[:,3]\n \n \n x = dx*wa + xa\n y = dy*ha + ya\n w = torch.exp(dw)*wa\n h = torch.exp(dh)*ha\n \n correct_anchor_positions = torch.zeros_like(anchor_positions)\n \n correct_anchor_positions[:,0] = x - w/2\n correct_anchor_positions[:,1] = x + w/2\n correct_anchor_positions[:,2] = y - h/2\n correct_anchor_positions[:,3] = y + h/2\n \n return correct_anchor_positions",
"_____no_output_____"
]
],
[
[
"### Faster RCNN region proposal network defination",
"_____no_output_____"
]
],
[
[
"# Region Proposal Network\n\nclass Faster_RCNN_rpn(nn.Module):\n def __init__(self,extracter):\n super().__init__()\n self.extracter = extracter\n self.conv1 = nn.Conv2d(512, 512, 3, 1, 1)\n #class_conv1 checks corresponding to 1 point in feature map, 18 outputs. \n # 9 anchors * (2) || anchor has object or not\n self.class_conv = nn.Conv2d(512, 2*len(anchor_scale)*len(anchor_ratio), 1, 1, 0) \n #reg_conv1 checks corresponding to 1 point in feature map, 36 outputs. \n # 9 anchors * (4) || anchor delta wrt ground truth boxes\n self.reg_conv = nn.Conv2d(512, 4*len(anchor_scale)*len(anchor_ratio), 1 ,1 , 0)\n\n self.conv1.weight.data.normal_(0, 0.01)\n self.conv1.bias.data.zero_()\n self.class_conv.weight.data.normal_(0, 0.01)\n self.class_conv.bias.data.zero_()\n self.reg_conv.weight.data.normal_(0, 0.01)\n self.reg_conv.bias.data.zero_()\n\n \n \n def forward(self,x):\n # input and output features of CNN are (nSamples x nChannels x Height x Width)\n \n features = self.extracter(x)\n conv1_out = F.relu(self.conv1(features))\n class_out = self.class_conv(conv1_out)\n reg_out = self.reg_conv(conv1_out)\n \n return features, class_out, reg_out",
"_____no_output_____"
]
],
[
[
"### Loss calculation - The same loss function is used for decider and RPN layer",
"_____no_output_____"
]
],
[
[
"# Loss for Region Proposal Netwoek\n# Same loss is used for decider network\n\ndef RPN_loss(locs_preditct, class_predict, final_RPN_locs,final_RPN_class):\n final_RPN_locs = final_RPN_locs.to(device)\n final_RPN_class = final_RPN_class.long().to(device)\n \n # Cross entropy loss (check if the target is background or foreground)\n # Only consider labels with values 1 or 0. ignore -1\n class_loss = F.cross_entropy(class_predict, final_RPN_class, ignore_index=-1)\n\n #smooth L1 regression loss (calculate the loss in predicted locations of foreground)\n '''\n Smooth L1 loss uses a squared term if the absolute element-wise error falls below 1 and an L1 term otherwise\n '''\n\n foreground_class_idx = (final_RPN_class > 0)\n locs_preditct = locs_preditct[foreground_class_idx]\n final_RPN_locs = final_RPN_locs[foreground_class_idx]\n\n \n \n loc_loss = F.smooth_l1_loss(locs_preditct, final_RPN_locs) / (sum(foreground_class_idx)+1e-6)\n\n \n rpn_loss = class_loss + rpn_loss_lambda*loc_loss\n \n return rpn_loss",
"_____no_output_____"
]
],
[
[
"### Non Maximum Suppression\n* Custom implemented method is implemented but not used\n* Pytorch nms method gives ~5-6 times speed up",
"_____no_output_____"
]
],
[
[
"# Apply non max suppression on anchors\n\ndef non_max_suppression(correct_anchor_positions, class_score, img_h, img_w, isTrain):\n \n if isTrain:\n nms_pre = nms_num_train_pre\n nms_post = nms_num_train_post\n else :\n nms_pre = nms_num_test_pre\n nms_post = nms_num_test_post\n \n \n # Clip the anchors to image dimensions\n correct_anchor_positions[correct_anchor_positions[:,0] < 0,0] = 0 # x1\n correct_anchor_positions[correct_anchor_positions[:,1] > img_w,1] = img_w # x2\n correct_anchor_positions[correct_anchor_positions[:,2] < 0,2] = 0 # y1\n correct_anchor_positions[correct_anchor_positions[:,3] > img_h,3] = img_h # y2\n \n \n # Only keep anchors with height and width > nms_min_size\n anchor_width = correct_anchor_positions[:,1] - correct_anchor_positions[:,0]\n anchor_height = correct_anchor_positions[:,3] - correct_anchor_positions[:,2]\n\n\n \n keep_idx = (anchor_height > nms_min_size) & (anchor_width > nms_min_size)\n correct_anchor_positions = correct_anchor_positions[keep_idx]\n class_score = class_score[keep_idx]\n\n # Get the index of sorted class scores in descending order and select top nms_pre idx\n sorted_class_scores = torch.argsort(class_score, descending=True)\n pre_nms_idx = sorted_class_scores[:nms_pre]\n correct_anchor_positions = correct_anchor_positions[pre_nms_idx]\n class_score = class_score[pre_nms_idx]\n \n # Implementation for non max suppression\n '''\n sorted_class_scores = torch.argsort(class_score, descending=True).to('cpu')\n keep_anchors = []\n \n\n Apply NMS\n while len(sorted_class_scores) > 1:\n current = sorted_class_scores[0]\n keep_anchors.append(current)\n iou_matrix = get_iou_matrix(correct_anchor_positions[sorted_class_scores[1:]],correct_anchor_positions[current].reshape(1,-1,4)[0])\n sorted_class_scores = sorted_class_scores[np.where(iou_matrix < nms_threshold)[0] + 1]\n \n if (len(sorted_class_scores) == 1):\n keep_anchors.append(sorted_class_scores[0])\n '''\n\n\n '''\n using pytorch standard nms function as it gives 5-6 times speedup\n '''\n change_format = torch.zeros_like(correct_anchor_positions)\n change_format[:,0] = correct_anchor_positions[:,0]\n change_format[:,1] = correct_anchor_positions[:,2]\n change_format[:,2] = correct_anchor_positions[:,1]\n change_format[:,3] = correct_anchor_positions[:,3]\n\n keep_anchors = nms(change_format.to('cpu'), class_score.clone().detach().to('cpu'), nms_threshold)\n\n keep_anchors = keep_anchors[:nms_post]\n correct_anchor_positions = correct_anchor_positions[keep_anchors]\n \n return correct_anchor_positions\n \n ",
"_____no_output_____"
]
],
[
[
"### Assign classes to output of Region Proposal Network ",
"_____no_output_____"
]
],
[
[
"def assign_classification_anchors(extracted_roi, gt_boxes, gt_labels, isTrain):\n\n \n # calculate iou of rois and gt boxes\n iou_matrix = get_iou_matrix(extracted_roi, gt_boxes)\n \n # for each ROI, find gt with max iou and corresponding value\n gt_roi_argmax = iou_matrix.argmax(axis=1)\n gt_roi_max = iou_matrix.max(axis=1)[0]\n \n #If a particular ROI has max overlap with a gt_box, assign label of gt_box to roi\n assign_labels = gt_labels[gt_roi_argmax]\n \n num_pos = pt_n_sample*pt_pos_ratio\n pos_idx = torch.where(gt_roi_max > pt_pos_iou_threshold)[0]\n if isTrain:\n pos_idx = np.random.choice(pos_idx, int(min(len(pos_idx), num_pos)), replace=False)\n \n \n num_neg = pt_n_sample - len(pos_idx)\n neg_idx = torch.where(gt_roi_max < pt_neg_iou_threshold)[0]\n if isTrain:\n neg_idx = np.random.choice(neg_idx, int(min(len(neg_idx), num_neg)), replace=False)\n \n \n keep_idx = np.append(pos_idx, neg_idx)\n assign_labels[neg_idx] = 0\n assign_labels = assign_labels[keep_idx]\n extracted_roi = extracted_roi[keep_idx]\n gt_roi_argmax = gt_roi_argmax[keep_idx]\n\n \n return assign_labels, extracted_roi,gt_roi_argmax, keep_idx",
"_____no_output_____"
]
],
[
[
"### ROI Pooling Layer",
"_____no_output_____"
]
],
[
[
"def ROI_pooling(extracted_roi, feature,ROI_pooling_layer):\n extracted_roi = extracted_roi/16.0\n out = []\n for roi in extracted_roi:\n \n x1 = int(roi[0])\n x2 = int(roi[1]+1)\n y1 = int(roi[2])\n y2 = int(roi[3]+1)\n out.append(ROI_pooling_layer(feature[:,:,y1:y2,x1:x2]))\n out = torch.cat(out)\n return out",
"_____no_output_____"
]
],
[
[
"### Faster RCNN decider layer definition",
"_____no_output_____"
]
],
[
[
"class Faster_RCNN_decider(nn.Module):\n def __init__(self,classifier):\n super().__init__()\n self.flatten = nn.Flatten()\n self.classifier = classifier\n self.class_lin = nn.Linear(4096, num_classes)\n self.reg_lin = nn.Linear(4096, num_classes*4)\n\n \n def forward(self, x):\n x = self.flatten(x)\n x = self.classifier(x)\n decider_class = self.class_lin(x)\n decider_loc = self.reg_lin(x)\n \n return decider_class, decider_loc",
"_____no_output_____"
]
],
[
[
"### Pipeline (train/validation) for a single image",
"_____no_output_____"
]
],
[
[
"\n\n\nimg_anchors_all = generate_anchors(int(input_image_height/conversion_scale), int(input_image_width/conversion_scale)).to(device)\n\ndef single_image_pipeline(input_image, gt_box, label,isTrain):\n\n input_image = input_image.to(device)\n gt_box = torch.FloatTensor(gt_box).to(device)\n label = torch.FloatTensor(label).to(device)\n\n # Generate CNN features for input image\n # Genearate region proposals predictions\n features, class_out, reg_out = rpn(input_image)\n\n\n locs_preditct = reg_out.permute(0,2,3,1).reshape(1,-1,4)[0]\n class_predict = class_out.permute(0,2,3,1).reshape(1,-1,2)[0]\n class_score = class_out.reshape(1,features.shape[2],features.shape[3],9,2)[:,:,:,:,1].reshape(1,-1)[0].detach()\n\n \n \n # For training region proposal network, generate anchors on the image. \n img_anchors_valid, img_anchors_valid_idx = get_valid_anchors(img_anchors_all.clone())\n\n iou_anchors_gt = get_iou_matrix(img_anchors_valid, gt_box)\n all_gt_max, anchor_max_value,anchor_max = get_max_iou_data(iou_anchors_gt)\n \n\n anchor_labels = get_anchor_labels(img_anchors_valid, all_gt_max, anchor_max_value)\n anchor_labels = sample_anchors_for_train(anchor_labels)\n \n # TODO - check if correct. - Done\n delta = delta_anchor_gt(img_anchors_valid, gt_box, anchor_max)\n \n\n \n\n final_RPN_locs = torch.zeros_like(img_anchors_all)\n final_RPN_locs[img_anchors_valid_idx] = delta\n\n final_RPN_class = torch.zeros(img_anchors_all.shape[0])\n final_RPN_class.fill_(-1)\n final_RPN_class[img_anchors_valid_idx] = anchor_labels\n\n # Loss for RPN layer\n loss1 = RPN_loss(locs_preditct, class_predict, final_RPN_locs, final_RPN_class).to(device)\n \n # Based on the bbox output of rpn, correct the generated anchors\n corrected_anchors = correct_anchor_positions(img_anchors_all.to(device), locs_preditct).detach()\n\n \n \n # Apply nms on the region proposals\n extracted_rois = non_max_suppression(corrected_anchors, class_score, input_image.shape[2],input_image.shape[3],isTrain)\n\n \n final_decider_class, extracted_roi_samples,gt_roi_argmax,idx = assign_classification_anchors(extracted_rois, gt_box, label, isTrain)\n\n final_decider_locs = delta_anchor_gt(extracted_roi_samples, gt_box,gt_roi_argmax)\n \n # Apply ROI pooling on the extracted ROIs\n pooled_features = ROI_pooling(extracted_roi_samples, features, ROI_pooling_layer)\n\n decider_class, decider_loc = decider(pooled_features)\n decider_loc = decider_loc.reshape(pooled_features.shape[0],-1,4) # 128*21*4\n decider_loc = decider_loc[torch.arange(0,pooled_features.shape[0]), final_decider_class.long()] # 128*4\n \n # Loss for decider layer\n loss2 = RPN_loss(decider_loc, decider_class, final_decider_locs, final_decider_class).to(device)\n \n with torch.no_grad():\n decider_loc_no_grad = decider_loc.clone().to(device)\n\n # Correct the ROIs based on bbox output for decider layers\n corrected_roi = correct_anchor_positions(extracted_roi_samples,decider_loc_no_grad).detach()\n \n return loss1, loss2 , decider_class, corrected_roi",
"_____no_output_____"
]
],
[
[
"#### Test model for input image",
"_____no_output_____"
]
],
[
[
"def test_model(input_image):\n rpn.eval()\n decider.eval()\n\n input_image = input_image.to(device)\n features, class_out, reg_out = rpn(input_image)\n locs_preditct = reg_out.permute(0,2,3,1).reshape(1,-1,4)[0]\n class_score = class_out.reshape(1,features.shape[2],features.shape[3],9,2)[:,:,:,:,1].reshape(1,-1)[0].detach()\n\n corrected_anchors = correct_anchor_positions(img_anchors_all.to(device), locs_preditct).detach()\n\n \n extracted_rois = non_max_suppression(corrected_anchors, class_score, input_image.shape[2],input_image.shape[3],False)\n\n\n pooled_features = ROI_pooling(extracted_rois, features, ROI_pooling_layer)\n\n decider_class, decider_loc = decider(pooled_features)\n \n with torch.no_grad():\n decider_loc_no_grad = decider_loc.clone().to(device)\n\n corrected_roi = correct_anchor_positions(extracted_rois,decider_loc_no_grad).detach()\n corrected_roi[corrected_roi[:,0] < 0,0] = 0 # x1\n corrected_roi[corrected_roi[:,1] > input_image_width,1] = input_image_width # x2\n corrected_roi[corrected_roi[:,2] < 0,2] = 0 # y1\n corrected_roi[corrected_roi[:,3] > input_image_height,3] = input_image_height # y2\n\n print(corrected_roi)\n\n decoder_conf = decider_class.softmax(dim=1).max(dim=1)[0]\n decoder_conf = decoder_conf.detach()\n decoder_conf = decoder_conf[decider_class.argmax(axis=1) != 0]\n \n\n keep_anchors = []\n sorted_class_scores = torch.argsort(decoder_conf, descending=True)\n\n while len(sorted_class_scores) > 1:\n current = sorted_class_scores[0]\n keep_anchors.append(current.item())\n iou_matrix = get_iou_matrix(corrected_roi[sorted_class_scores[1:]],corrected_roi[current].reshape(1,-1,4)[0])\n sorted_class_scores = sorted_class_scores[np.where(iou_matrix < 0.2)[0] + 1]\n\n if (len(sorted_class_scores) == 1):\n keep_anchors.append(sorted_class_scores[0].item())\n\n for pred in decider_class.argmax(axis=1)[decider_class.argmax(axis=1) != 0][keep_anchors]:\n print(val_to_lab[int(pred)], end=', ')\n print('')\n \n for pred in decoder_conf[keep_anchors]:\n print(pred.item(), end=', ')\n\n visualize_tensor(input_image,extracted_rois[decider_class.argmax(axis=1) != 0][keep_anchors], [])",
"_____no_output_____"
]
],
[
[
"### Use a single image pipeline multiple times for training or batch testing",
"_____no_output_____"
],
[
"##### Define variables, models, load saved models or training steps",
"_____no_output_____"
]
],
[
[
"load_model = ''\n\n\n\nloss1_hist = []\nloss2_hist = []\nloss_hist = []\nvalid_loss1_hist = []\nvalid_loss2_hist = []\nvalid_loss_hist = []\nepoch_start = 0\nbest_valid_score = 10000\n\n\nvgg_feature_extracter, vgg_classifier = Faster_RCNN_vgg16(num_freeze_top=10)\nrpn = Faster_RCNN_rpn(vgg_feature_extracter).to(device)\nROI_pooling_layer = nn.AdaptiveMaxPool2d(roi_size).to(device)\ndecider = Faster_RCNN_decider(vgg_classifier).to(device)\nall_params = list(list(rpn.parameters()) + list(decider.parameters()))\n\n\noptimizer = optim.Adam(all_params, lr=0.00005)\n\n\n\n\n\nif load_model != '':\n print('loading model ... ')\n checkpoint = torch.load(load_model, map_location=device)\n rpn.load_state_dict(checkpoint['rpn_state_dict'])\n decider.load_state_dict(checkpoint['decider_state_dict'])\n optimizer.load_state_dict(checkpoint['optimizer_state_dict'])\n loss1_hist = checkpoint['loss1_hist']\n loss2_hist = checkpoint['loss2_hist']\n loss_hist = checkpoint['loss_hist']\n valid_loss1_hist =checkpoint['valid_loss1_hist']\n valid_loss2_hist = checkpoint['valid_loss2_hist']\n valid_loss_hist = checkpoint['valid_loss_hist']\n epoch_start = checkpoint['epoch_start']\n best_valid_score = checkpoint['best_valid_score']\n rpn.train()\n decider.train()\n\n print('model loaded ...' )\n\n\nrunning_count = 0\nrunning_net_loss = 0\nrunning_loss1 = 0\nrunning_loss2 = 0\nloss_avg_step = 20\ntrain_visualise_step =150",
"_____no_output_____"
]
],
[
[
"##### Faster RCNN train/validation code (Supported batch size is 1)",
"_____no_output_____"
]
],
[
[
"print(\"Start epoch - \" + str(epoch_start))\nprint(\"best_valid_score - \" + str(best_valid_score))\nfor epoch in range(epoch_start,epoch_start+50):\n train_loader = DataLoader(train_dataset, batch_size=1, shuffle=True)\n for i, data in enumerate(train_loader, 0):\n\n img, gt_box, labels = data\n\n loss1, loss2, pred_class, pred_box = single_image_pipeline(img.to(device), gt_box, labels, True)\n net_loss = loss1 + loss2\n\n optimizer.zero_grad()\n net_loss.backward()\n optimizer.step()\n\n loss1 = loss1.detach()\n loss2 = loss2.detach()\n pred_class = pred_class.detach()\n pred_box = pred_box.detach()\n net_loss = net_loss.detach()\n if not((math.isnan(net_loss)) or (math.isnan(loss1)) or (math.isnan(loss2))):\n running_count += 1\n running_net_loss += net_loss.data\n running_loss1 += loss1.data\n running_loss2 += loss2.data\n\n \n if ((i+1)%(loss_avg_step) == 0):\n loss1_hist.append(running_loss1/(running_count + 1e-6))\n loss2_hist.append(running_loss2/(running_count + 1e-6))\n loss_hist.append(running_net_loss/(running_count + 1e-6))\n print(str(epoch) + '--' + str(i) + '--- ' + str(running_net_loss/(running_count + 1e-6)))\n running_count = 0\n running_net_loss = 0\n running_loss1 = 0\n running_loss2 = 0\n\n\n if ((i+1)%(train_visualise_step)) == 0:\n print(\"Train Data Visualise\")\n fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(30, 5))\n ax1.plot(loss1_hist)\n ax1.title.set_text('Train RPN Loss')\n ax2.plot(loss2_hist)\n ax2.title.set_text('Train Decider Loss')\n ax3.plot(loss_hist)\n ax3.title.set_text('Train Net Loss')\n visualize_tensor(img, pred_box[pred_class.argmax(axis=1) != 0], gt_box)\n for pred in pred_class.argmax(axis=1)[pred_class.argmax(axis=1) != 0]:\n print(val_to_lab[int(pred)], end=', ')\n print('')\n plt.show()\n\n\n '''\n Validation Code start\n '''\n\n valid_loader = DataLoader(valid_dataset, batch_size=1, shuffle=True)\n rpn.eval()\n decider.eval()\n print(\"-------------------------------\")\n print(\"Evaluating valid sets\")\n \n # test_model(iter(valid_loader).next()[0])\n \n valid_loss1 = 0\n valid_loss2 = 0\n valid_net_loss = 0\n valid_run_count = 0\n for valid_idx, valid_data in (enumerate(valid_loader,0)):\n img, gt_box, labels = valid_data\n loss1, loss2, pred_class, pred_box = single_image_pipeline(img.to(device), gt_box, labels, False)\n net_loss = loss1 + loss2\n \n if not((math.isnan(net_loss)) or (math.isnan(loss1)) or (math.isnan(loss2))):\n valid_loss1 += loss1.data\n valid_loss2 += loss2.data\n valid_net_loss += net_loss.data\n valid_run_count += 1\n\n \n valid_loss1_hist.append(valid_loss1/(valid_run_count + 1e-6))\n valid_loss2_hist.append(valid_loss2/(valid_run_count+ 1e-6))\n valid_loss_hist.append(valid_net_loss/(valid_run_count+ 1e-6))\n \n\n print(\"-------------------------------\")\n print(\"-------------------------------\")\n print(\"Validation Data Visualise -- \")\n print(\"-------------------------------\")\n print(\"-------------------------------\")\n fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(30, 5))\n ax1.plot(valid_loss1_hist)\n ax1.title.set_text('Valid RPN Loss')\n ax2.plot(valid_loss2_hist)\n ax2.title.set_text('Valid Decider Loss')\n ax3.plot(valid_loss_hist)\n ax3.title.set_text('Valid Net Loss')\n test_model(img)\n for pred in pred_class.argmax(axis=1)[pred_class.argmax(axis=1) != 0]:\n print(val_to_lab[int(pred)], end=', ')\n print('')\n plt.show()\n \n \n \n print(valid_run_count)\n print(\"-------------------------------\")\n print(\"-------------------------------\")\n rpn.train()\n decider.train()\n\n '''\n Validation Code end\n '''\n\n PATH = 'drive/My Drive/saved_models_faster_rcnn/current.pt'\n\n print(str(epoch)+ '--' + str(i) + ' saving model ' + PATH)\n torch.save({\n 'rpn_state_dict': rpn.state_dict(),\n 'decider_state_dict': decider.state_dict(),\n 'optimizer_state_dict': optimizer.state_dict(),\n 'loss1_hist':loss1_hist,\n 'loss2_hist':loss2_hist,\n 'loss_hist':loss_hist,\n 'valid_loss1_hist': valid_loss1_hist ,\n 'valid_loss2_hist':valid_loss2_hist,\n 'valid_loss_hist': valid_loss_hist,\n 'epoch_start':epoch,\n 'best_valid_score': best_valid_score\n }, PATH)\n\n \n valid_net_loss = valid_net_loss/(valid_run_count+ 1e-6)\n\n if (valid_net_loss < best_valid_score):\n best_valid_score = valid_net_loss\n print(\"-------------------------------\")\n print(\"-------------------------------\")\n print(\"Found new Best :)\")\n print(\"-------------------------------\")\n print(\"-------------------------------\")\n PATH = 'drive/My Drive/saved_models_faster_rcnn/best.pt'\n\n print(str(epoch)+ '--' + str(i) + ' saving model ' + PATH)\n torch.save({\n 'rpn_state_dict': rpn.state_dict(),\n 'decider_state_dict': decider.state_dict(),\n 'optimizer_state_dict': optimizer.state_dict(),\n 'loss1_hist':loss1_hist,\n 'loss2_hist':loss2_hist,\n 'loss_hist':loss_hist,\n 'valid_loss1_hist': valid_loss1_hist ,\n 'valid_loss2_hist':valid_loss2_hist,\n 'valid_loss_hist': valid_loss_hist,\n 'epoch_start':epoch,\n 'best_valid_score': best_valid_score\n }, PATH)\n\n",
"_____no_output_____"
]
],
[
[
"#### Test model on a single image",
"_____no_output_____"
]
],
[
[
"img = Image.open('drive/My Drive/saved_models/bike.jpg')\nimg = transform(img)\nimg = img.unsqueeze(0)\n\ntest_model(img)\n\n",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb69bcafbf9012ad02a6f9b2668238dd379db96f | 5,324 | ipynb | Jupyter Notebook | LeetCode/LeetCode_804UniqueMorseCodeWords.ipynb | foxsayy/python | 4560688e95f8fdd970ea4df29f8fb70c8138bc93 | [
"MIT"
]
| 1 | 2019-09-07T11:10:18.000Z | 2019-09-07T11:10:18.000Z | LeetCode/LeetCode_804UniqueMorseCodeWords.ipynb | foxsayy/python | 4560688e95f8fdd970ea4df29f8fb70c8138bc93 | [
"MIT"
]
| null | null | null | LeetCode/LeetCode_804UniqueMorseCodeWords.ipynb | foxsayy/python | 4560688e95f8fdd970ea4df29f8fb70c8138bc93 | [
"MIT"
]
| null | null | null | 29.577778 | 295 | 0.435199 | [
[
[
"# LeetCode #804. Unique Morse Code Words\n\n## Question\n \nhttps://leetcode.com/problems/unique-morse-code-words/\n\n International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: \"a\" maps to \".-\", \"b\" maps to \"-...\", \"c\" maps to \"-.-.\", and so on.\n\n For convenience, the full table for the 26 letters of the English alphabet is given below:\n\n [\".-\",\"-...\",\"-.-.\",\"-..\",\".\",\"..-.\",\"--.\",\"....\",\"..\",\".---\",\"-.-\",\".-..\",\"--\",\"-.\",\"---\",\".--.\",\"--.-\",\".-.\",\"...\",\"-\",\"..-\",\"...-\",\".--\",\"-..-\",\"-.--\",\"--..\"]\n Now, given a list of words, each word can be written as a concatenation of the Morse code of each letter. For example, \"cba\" can be written as \"-.-..--...\", (which is the concatenation \"-.-.\" + \"-...\" + \".-\"). We'll call such a concatenation, the transformation of a word.\n\n Return the number of different transformations among all words we have.\n\nExample:\n\n Input: words = [\"gin\", \"zen\", \"gig\", \"msg\"]\n Output: 2\n\nExplanation: \n\nThe transformation of each word is:\n \"gin\" -> \"--...-.\"\n \"zen\" -> \"--...-.\"\n \"gig\" -> \"--...--.\"\n \"msg\" -> \"--...--.\"\n\n There are 2 different transformations, \"--...-.\" and \"--...--.\".\nNote:\n\n The length of words will be at most 100.\n Each words[i] will have length in range [1, 12].\n words[i] will only consist of lowercase letters.",
"_____no_output_____"
],
[
"## My Solution",
"_____no_output_____"
]
],
[
[
"def uniqueMorseRepresentations(words):\n morse = [\".-\",\"-...\",\"-.-.\",\"-..\",\".\",\"..-.\",\"--.\",\"....\",\"..\",\".---\",\"-.-\",\".-..\",\"--\",\"-.\",\"---\",\".--.\",\"--.-\",\".-.\",\"...\",\"-\",\"..-\",\"...-\",\".--\",\"-..-\",\"-.--\",\"--..\"]\n from string import ascii_lowercase\n alphabet = list(ascii_lowercase)\n morse_dic = {}\n for i, a in enumerate(alphabet):\n morse_dic[a] = morse[i]\n res = list()\n for word in words:\n temp = \"\"\n for w in word:\n temp += morse_dic[w]\n res.append(temp)\n return len(set(res))",
"_____no_output_____"
],
[
"# test code\nwords = [\"gin\", \"zen\", \"gig\", \"msg\"]\nuniqueMorseRepresentations(words)",
"_____no_output_____"
]
],
[
[
"## My Result\n\n__Runtime__ : 16 ms, faster than 94.77% of Python online submissions for Unique Morse Code Words.\n\n__Memory Usage__ : 11.8 MB, less than 35.71% of Python online submissions for Unique Morse Code Words.",
"_____no_output_____"
],
[
"## @lee215's Solution",
"_____no_output_____"
]
],
[
[
"def uniqueMorseRepresentations(words):\n d = [\".-\", \"-...\", \"-.-.\", \"-..\", \".\", \"..-.\", \"--.\", \"....\", \"..\", \".---\", \"-.-\", \".-..\", \"--\",\n \"-.\", \"---\", \".--.\", \"--.-\", \".-.\", \"...\", \"-\", \"..-\", \"...-\", \".--\", \"-..-\", \"-.--\", \"--..\"]\n return len({''.join(d[ord(i) - ord('a')] for i in w) for w in words})",
"_____no_output_____"
],
[
"# test code\nwords = [\"gin\", \"zen\", \"gig\", \"msg\"]\nuniqueMorseRepresentations(words)",
"_____no_output_____"
]
],
[
[
"## @lee215's Result\n\n__Runtime__: 24 ms, faster than 51.63% of Python online submissions for Unique Morse Code Words.\n\n__Memory Usage__ : 11.9 MB, less than 28.57% of Python online submissions for Unique Morse Code Words.",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
]
|
cb69c3e78184ca6bb56ef9084886c789a53f300a | 25,496 | ipynb | Jupyter Notebook | Code/Day 2_Simple_Linear_Regression.ipynb | Fellno/100-Days-Of-ML-Code | 59dba8484a907ead8f4a810df96baac18577b8f4 | [
"MIT"
]
| null | null | null | Code/Day 2_Simple_Linear_Regression.ipynb | Fellno/100-Days-Of-ML-Code | 59dba8484a907ead8f4a810df96baac18577b8f4 | [
"MIT"
]
| null | null | null | Code/Day 2_Simple_Linear_Regression.ipynb | Fellno/100-Days-Of-ML-Code | 59dba8484a907ead8f4a810df96baac18577b8f4 | [
"MIT"
]
| null | null | null | 83.868421 | 9,432 | 0.830758 | [
[
[
"# 机器学习100天——第二天:简单线性回归\n## 第一步:数据预处理",
"_____no_output_____"
],
[
"这里导入我们需要的库,值得注意的是,这里比第一天多了一个matplotlib.pyplot,matplotlib是python上的一个2D绘图库,\nmatplotlib下的模块pyplot是一个有命令样式的函数集合,\nmatplotlib.pyplot是为我们对结果进行图像化作准备的。",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt",
"_____no_output_____"
]
],
[
[
"导入相关数据",
"_____no_output_____"
]
],
[
[
"dataset = pd.read_csv('../datasets/studentscores.csv')\nprint(dataset)",
" Hours Scores\n0 2.5 21\n1 5.1 47\n2 3.2 27\n3 8.5 75\n4 3.5 30\n5 1.5 20\n6 9.2 88\n7 5.5 60\n8 8.3 81\n9 2.7 25\n10 7.7 85\n11 5.9 62\n12 4.5 41\n13 3.3 42\n14 1.1 17\n15 8.9 95\n16 2.5 30\n17 1.9 24\n18 6.1 67\n19 7.4 69\n20 2.7 30\n21 4.8 54\n22 3.8 35\n23 6.9 76\n24 7.8 86\n25 2.1 93\n26 2.2 93\n27 2.5 93\n"
]
],
[
[
"这里我们需要使用pandas的iloc(区分于loc根据index来索引,iloc利用行号来索引)方法来对数据进行处理,第一个参数为行号,:表示全部行,第二个参数 :1表示截到第1列(也就是取第0列)",
"_____no_output_____"
]
],
[
[
"X = dataset.iloc[ : , : 1 ].values\nY = dataset.iloc[ : , 1 ].values\nprint(\"X:\",X)\nprint(\"Y:\",Y)",
"X: [[2.5]\n [5.1]\n [3.2]\n [8.5]\n [3.5]\n [1.5]\n [9.2]\n [5.5]\n [8.3]\n [2.7]\n [7.7]\n [5.9]\n [4.5]\n [3.3]\n [1.1]\n [8.9]\n [2.5]\n [1.9]\n [6.1]\n [7.4]\n [2.7]\n [4.8]\n [3.8]\n [6.9]\n [7.8]\n [2.1]\n [2.2]\n [2.5]]\nY: [21 47 27 75 30 20 88 60 81 25 85 62 41 42 17 95 30 24 67 69 30 54 35 76\n 86 93 93 93]\n"
]
],
[
[
"导入sklearn库的cross_validation类来对数据进行训练集、测试集划分",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import train_test_split\n#拆分数据,0.25作为测试集\nX_train, X_test, Y_train, Y_test = train_test_split( X, Y, test_size = 1/4, random_state = 0) ",
"_____no_output_____"
]
],
[
[
"## 训练线性回归",
"_____no_output_____"
]
],
[
[
"from sklearn.linear_model import LinearRegression\n#使用训练集对模型进行训练\nregressor = LinearRegression()\nregressor = regressor.fit(X_train, Y_train)",
"_____no_output_____"
]
],
[
[
"## 预测结果",
"_____no_output_____"
]
],
[
[
"Y_pred = regressor.predict(X_test)",
"_____no_output_____"
]
],
[
[
"## 可视化",
"_____no_output_____"
],
[
"### 训练集结果可视化",
"_____no_output_____"
]
],
[
[
"#散点图\nplt.scatter(X_train , Y_train, color = 'red')\n#线图\nplt.plot(X_train , regressor.predict(X_train), 'bo-')\nplt.show()",
"_____no_output_____"
]
],
[
[
"### 测试集结果可视化",
"_____no_output_____"
]
],
[
[
"#散点图\nplt.scatter(X_test , Y_test, color = 'red')\n#线图\nplt.plot(X_test ,Y_pred, 'bo-')\nplt.show()",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb69c56710bf8720beabb423fa50e9bfa7c04696 | 3,061 | ipynb | Jupyter Notebook | examples/reference/elements/plotly/HeatMap.ipynb | stonebig/holoviews | d5270c30dd1af38a785452aeac2fbabbe528e892 | [
"BSD-3-Clause"
]
| 2 | 2020-08-13T00:11:46.000Z | 2021-01-31T22:13:21.000Z | examples/reference/elements/plotly/HeatMap.ipynb | stonebig/holoviews | d5270c30dd1af38a785452aeac2fbabbe528e892 | [
"BSD-3-Clause"
]
| null | null | null | examples/reference/elements/plotly/HeatMap.ipynb | stonebig/holoviews | d5270c30dd1af38a785452aeac2fbabbe528e892 | [
"BSD-3-Clause"
]
| null | null | null | 32.56383 | 240 | 0.59523 | [
[
[
"<div class=\"contentcontainer med left\" style=\"margin-left: -50px;\">\n<dl class=\"dl-horizontal\">\n <dt>Title</dt> <dd> HeatMap Element</dd>\n <dt>Dependencies</dt> <dd>Plotly</dd>\n <dt>Backends</dt> <dd><a href='../bokeh/HeatMap.ipynb'>Bokeh</a></dd> <dd><a href='../matplotlib/HeatMap.ipynb'>Matplotlib</a></dd> <dd><a href='./HeatMap.ipynb'>Plotly</a></dd>\n</dl>\n</div>",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport holoviews as hv\nhv.extension('plotly')",
"_____no_output_____"
]
],
[
[
"``HeatMap`` visualises tabular data indexed by two key dimensions as a grid of colored values. This allows spotting correlations in multivariate data and provides a high-level overview of how the two variables are plotted.\n\nThe data for a ``HeatMap`` may be supplied as 2D tabular data with one or more associated value dimensions. The first value dimension will be colormapped, but further value dimensions may be revealed using the hover tool.",
"_____no_output_____"
]
],
[
[
"%%opts HeatMap (cmap='RdBu_r')\ndata = [(chr(65+i), chr(97+j), i*j) for i in range(5) for j in range(5) if i!=j]\nhv.HeatMap(data)",
"_____no_output_____"
]
],
[
[
"It is important to note that the data should be aggregated before plotting as the ``HeatMap`` cannot display multiple values for one coordinate and will simply use the first value it finds for each combination of x- and y-coordinates.",
"_____no_output_____"
]
],
[
[
"heatmap = hv.HeatMap([(0, 0, 0), (0, 0, 10), (1, 0, 2), (1, 1, 3)])\nheatmap + heatmap.aggregate(function=np.max).opts(plot=dict(colorbar=True))",
"_____no_output_____"
]
],
[
[
"As the above example shows before aggregating the second value for the (0, 0) is ignored unless we aggregate the data first.\n\nTo reveal the values of a ``HeatMap`` we can enable a ``colorbar`` and if you wish to have interactive hover information, you can use the hover tool in the [Bokeh backend](../bokeh/HeatMap.ipynb):",
"_____no_output_____"
]
],
[
[
"%%opts HeatMap [colorbar=True]\nhv.HeatMap((np.random.randint(0, 10, 100), np.random.randint(0, 10, 100),\n np.random.randn(100), np.random.randn(100)), vdims=['z', 'z2']).redim.range(z=(-2, 2)).sort()",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb69ce1ec61023c16971f6572f4fa9c0221a07ab | 61,891 | ipynb | Jupyter Notebook | results/Untitled1.ipynb | ProFrenchToast/comp300 | 7a5a53fa8d21ad22e3db3b723e1bac15d46d329a | [
"MIT"
]
| null | null | null | results/Untitled1.ipynb | ProFrenchToast/comp300 | 7a5a53fa8d21ad22e3db3b723e1bac15d46d329a | [
"MIT"
]
| null | null | null | results/Untitled1.ipynb | ProFrenchToast/comp300 | 7a5a53fa8d21ad22e3db3b723e1bac15d46d329a | [
"MIT"
]
| null | null | null | 384.416149 | 29,640 | 0.935887 | [
[
[
"import matplotlib.pyplot as plt \nfrom matplotlib.pyplot import figure\nimport numpy as np\n\nminReward = [-509.71, -396.09]\naverage = [85.63, 151.46]\nmaxReward = [278.98, 305.08]\n\nprint(\"mins: {}, maxs: {}, means: {}\".format(minReward, maxReward, average))\n# create plot\nfigure(num=None, figsize=(10, 10), dpi=80, facecolor='w', edgecolor='k')\n#fig, ax = plt.subplots()\nindex = np.arange(2)\nbar_width = 0.3\nopacity = 0.8\n\nrects1 = plt.bar(index, minReward, bar_width,\nalpha=opacity,\ncolor='b',\nlabel='Minimum Reward')\n\nrects2 = plt.bar(index + bar_width, average, bar_width,\nalpha=opacity,\ncolor='g',\nlabel='Average Reward')\n\nrects3 = plt.bar(index + bar_width +bar_width, maxReward, bar_width,\nalpha=opacity,\ncolor='r',\nlabel='Max Reward')\n\nplt.xlabel('Agent')\nplt.ylabel('Reward')\nplt.title('The min, max and mean reward of the demonstrator and trained agent')\nplt.xticks(index + bar_width, ('Demonstrations', 'Trained agent'))\nplt.legend()\n\nplt.tight_layout()\nplt.show()",
"mins: [-509.71, -396.09], maxs: [278.98, 305.08], means: [85.63, 151.46]\n"
],
[
"import matplotlib.pyplot as plt \n\nminReward = [-32.72, -69.3]\naverage = [-7.29, -29.08]\nmaxReward = [29.15, 39.64]\n\nprint(\"mins: {}, maxs: {}, means: {}\".format(minReward, maxReward, average))\n# create plot\nfigure(num=None, figsize=(10, 10), dpi=80, facecolor='w', edgecolor='k')\n#fig, ax = plt.subplots()\nindex = np.arange(2)\nbar_width = 0.3\nopacity = 0.8\n\nrects1 = plt.bar(index, minReward, bar_width,\nalpha=opacity,\ncolor='b',\nlabel='Minimum Reward')\n\nrects2 = plt.bar(index + bar_width, average, bar_width,\nalpha=opacity,\ncolor='g',\nlabel='Average Reward')\n\nrects3 = plt.bar(index + bar_width +bar_width, maxReward, bar_width,\nalpha=opacity,\ncolor='r',\nlabel='Max Reward')\n\nplt.xlabel('Agent')\nplt.ylabel('Reward')\nplt.title('The min, max and mean reward of the demonstrator and trained agent')\nplt.xticks(index + bar_width, ('Demonstrations', 'Trained agent'))\nplt.legend()\n\nplt.tight_layout()\nplt.show()",
"mins: [-32.72, -69.3], maxs: [29.15, 39.64], means: [-7.29, -29.08]\n"
]
]
]
| [
"code"
]
| [
[
"code",
"code"
]
]
|
cb69d698577ab242358b20f13fc20728f02c7b75 | 96,410 | ipynb | Jupyter Notebook | chapter_1/PyTorch_Basics.ipynb | sjskoko/nlp-with-pytorch | 3b2ba64d4593a26d5ebbee2bcb1cfdf23dc70729 | [
"Apache-2.0"
]
| null | null | null | chapter_1/PyTorch_Basics.ipynb | sjskoko/nlp-with-pytorch | 3b2ba64d4593a26d5ebbee2bcb1cfdf23dc70729 | [
"Apache-2.0"
]
| null | null | null | chapter_1/PyTorch_Basics.ipynb | sjskoko/nlp-with-pytorch | 3b2ba64d4593a26d5ebbee2bcb1cfdf23dc70729 | [
"Apache-2.0"
]
| null | null | null | 27.977365 | 8,888 | 0.53901 | [
[
[
"*아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.*\n\n<table class=\"tfo-notebook-buttons\" align=\"left\">\n <td>\n <a target=\"_blank\" href=\"https://nbviewer.org/github/rickiepark/nlp-with-pytorch/blob/master/chapter_1/PyTorch_Basics.ipynb\"><img src=\"https://jupyter.org/assets/share.png\" width=\"60\" />주피터 노트북 뷰어로 보기</a>\n </td>\n <td>\n <a target=\"_blank\" href=\"https://colab.research.google.com/github/rickiepark/nlp-with-pytorch/blob/master/chapter_1/PyTorch_Basics.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />구글 코랩(Colab)에서 실행하기</a>\n </td>\n</table>",
"_____no_output_____"
],
[
"# 샘플과 타깃의 인코딩",
"_____no_output_____"
],
[
"## TF 표현",
"_____no_output_____"
]
],
[
[
"import matplotlib.pyplot as plt\nfrom sklearn.feature_extraction.text import CountVectorizer\nimport seaborn as sns\n\ncorpus = ['Time flies like an arrow.', \n 'Fruit flies like a banana.']\none_hot_vectorizer = CountVectorizer(binary=True)\none_hot = one_hot_vectorizer.fit_transform(corpus).toarray()\nvocab = one_hot_vectorizer.get_feature_names()\nsns.heatmap(one_hot, annot=True,\n cbar=False, xticklabels=vocab,\n yticklabels=['Sentence 1', 'Sentence 2'])\n\n# plt.savefig('1-04.png', dpi=300)\nplt.show()",
"_____no_output_____"
]
],
[
[
"## TF-IDF 표현",
"_____no_output_____"
]
],
[
[
"from sklearn.feature_extraction.text import TfidfVectorizer\nimport seaborn as sns\n \ntfidf_vectorizer = TfidfVectorizer()\ntfidf = tfidf_vectorizer.fit_transform(corpus).toarray()\nsns.heatmap(tfidf, annot=True, cbar=False, xticklabels=vocab,\n yticklabels= ['Sentence 1', 'Sentence 2'])\n\n# plt.savefig('1-05.png', dpi=300)\nplt.show()",
"_____no_output_____"
]
],
[
[
"$IDF(w) = \\text{log} \\left(\\dfrac{N+1}{N_w+1}\\right)+1$",
"_____no_output_____"
],
[
"첫 번째 문장의 'flies'와 'like'의 경우 TF = 1이므로 $\\text{TF-IDF}=1\\times\\text{log}\\left(\\dfrac{2+1}{2+1}\\right)+1=1$입니다.\n\n단어 'an', 'arrow', 'time'의 경우 $N_w=1$입니다. 따라서 $\\text{TF-IDF}=1\\times\\text{log}\\left(\\dfrac{2+1}{1+1}\\right)+1=1.4054651081081644$입니다.\n\nL2 정규화를 적용하면 'flies'와 'like'는 $\\dfrac{1}{\\sqrt{2\\times1^2+3\\times1.4054651081081644^2+}}=0.3552$가 됩니다.\n\n'an', 'arrow', 'time'는 $\\dfrac{1.4054651081081644}{\\sqrt{2\\times1^2+3\\times1.4054651081081644^2+}}=0.4992$가 됩니다.",
"_____no_output_____"
],
[
"# 파이토치 기초",
"_____no_output_____"
]
],
[
[
"import torch\nimport numpy as np\ntorch.manual_seed(1234)",
"_____no_output_____"
]
],
[
[
"## 텐서",
"_____no_output_____"
],
[
"* 스칼라는 하나의 숫자입니다.\n* 벡터는 숫자의 배열입니다.\n* 행렬은 숫자의 2-D 배열입니다.\n* 텐서는 숫자의 N-D 배열입니다.",
"_____no_output_____"
],
[
"#### 텐서 만들기",
"_____no_output_____"
],
[
"크기를 지정하여 텐서를 만들 수 있습니다. 여기서는 행이 5개이고 열이 3개인 텐서를 만듭니다.",
"_____no_output_____"
]
],
[
[
"def describe(x):\n print(\"타입: {}\".format(x.type()))\n print(\"크기: {}\".format(x.shape))\n print(\"값: \\n{}\".format(x))",
"_____no_output_____"
],
[
"describe(torch.Tensor(2, 3))",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[-1.2722e+08, 3.0663e-41, 3.7835e-44],\n [ 0.0000e+00, nan, 3.0663e-41]])\n"
],
[
"describe(torch.randn(2, 3))",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[ 0.0461, 0.4024, -1.0115],\n [ 0.2167, -0.6123, 0.5036]])\n"
]
],
[
[
"특정 크기의 랜덤한 텐서를 만드느 것이 일반적입니다.",
"_____no_output_____"
]
],
[
[
"x = torch.rand(2, 3)\ndescribe(x)",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0.7749, 0.8208, 0.2793],\n [0.6817, 0.2837, 0.6567]])\n"
]
],
[
[
"1이나 0으로 채워진 텐서를 만들 수도 있습니다.",
"_____no_output_____"
]
],
[
[
"describe(torch.zeros(2, 3))\nx = torch.ones(2, 3)\ndescribe(x)\nx.fill_(5)\ndescribe(x)",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0., 0., 0.],\n [0., 0., 0.]])\n타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[1., 1., 1.],\n [1., 1., 1.]])\n타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[5., 5., 5.],\n [5., 5., 5.]])\n"
]
],
[
[
"텐서를 초기화한 후 값을 바꿀 수 있습니다.\n\n노트: 밑줄 문자(`_`)로 끝나는 연산은 인-플레이스 연산입니다.",
"_____no_output_____"
]
],
[
[
"x = torch.Tensor(3,4).fill_(5)\nprint(x.type())\nprint(x.shape)\nprint(x)",
"torch.FloatTensor\ntorch.Size([3, 4])\ntensor([[5., 5., 5., 5.],\n [5., 5., 5., 5.],\n [5., 5., 5., 5.]])\n"
]
],
[
[
"리스트의 리스트로 텐서를 만들 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.Tensor([[1, 2,], \n [2, 4,]])\ndescribe(x)",
"타입: torch.FloatTensor\n크기: torch.Size([2, 2])\n값: \ntensor([[1., 2.],\n [2., 4.]])\n"
]
],
[
[
"넘파이 배열로 텐서를 만들 수 있습니다.",
"_____no_output_____"
]
],
[
[
"npy = np.random.rand(2, 3)\ndescribe(torch.from_numpy(npy))\nprint(npy.dtype)",
"타입: torch.DoubleTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0.5603, 0.3505, 0.5762],\n [0.5849, 0.7525, 0.9362]], dtype=torch.float64)\nfloat64\n"
]
],
[
[
"#### 텐서 타입",
"_____no_output_____"
],
[
"The FloatTensor has been the default tensor that we have been creating all along",
"_____no_output_____"
]
],
[
[
"import torch\nx = torch.arange(6).view(2, 3)\ndescribe(x)",
"타입: torch.LongTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0, 1, 2],\n [3, 4, 5]])\n"
],
[
"x = torch.FloatTensor([[1, 2, 3], \n [4, 5, 6]])\ndescribe(x)\n\nx = x.long()\ndescribe(x)\n\nx = torch.tensor([[1, 2, 3], \n [4, 5, 6]], dtype=torch.int64)\ndescribe(x)\n\nx = x.float() \ndescribe(x)",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[1., 2., 3.],\n [4., 5., 6.]])\n타입: torch.LongTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[1, 2, 3],\n [4, 5, 6]])\n타입: torch.LongTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[1, 2, 3],\n [4, 5, 6]])\n타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[1., 2., 3.],\n [4., 5., 6.]])\n"
],
[
"x = torch.randn(2, 3)\ndescribe(x)",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[ 1.5385, -0.9757, 1.5769],\n [ 0.3840, -0.6039, -0.5240]])\n"
],
[
"describe(torch.add(x, x))",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[ 3.0771, -1.9515, 3.1539],\n [ 0.7680, -1.2077, -1.0479]])\n"
],
[
"describe(x + x)",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[ 3.0771, -1.9515, 3.1539],\n [ 0.7680, -1.2077, -1.0479]])\n"
],
[
"x = torch.arange(6)\ndescribe(x)",
"타입: torch.LongTensor\n크기: torch.Size([6])\n값: \ntensor([0, 1, 2, 3, 4, 5])\n"
],
[
"x = x.view(2, 3)\ndescribe(x)",
"타입: torch.LongTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0, 1, 2],\n [3, 4, 5]])\n"
],
[
"describe(torch.sum(x, dim=0))\ndescribe(torch.sum(x, dim=1))",
"타입: torch.LongTensor\n크기: torch.Size([3])\n값: \ntensor([3, 5, 7])\n타입: torch.LongTensor\n크기: torch.Size([2])\n값: \ntensor([ 3, 12])\n"
],
[
"describe(torch.transpose(x, 0, 1))",
"타입: torch.LongTensor\n크기: torch.Size([3, 2])\n값: \ntensor([[0, 3],\n [1, 4],\n [2, 5]])\n"
],
[
"import torch\nx = torch.arange(6).view(2, 3)\ndescribe(x)\ndescribe(x[:1, :2])\ndescribe(x[0, 1])",
"타입: torch.LongTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0, 1, 2],\n [3, 4, 5]])\n타입: torch.LongTensor\n크기: torch.Size([1, 2])\n값: \ntensor([[0, 1]])\n타입: torch.LongTensor\n크기: torch.Size([])\n값: \n1\n"
],
[
"indices = torch.LongTensor([0, 2])\ndescribe(torch.index_select(x, dim=1, index=indices))",
"타입: torch.LongTensor\n크기: torch.Size([2, 2])\n값: \ntensor([[0, 2],\n [3, 5]])\n"
],
[
"indices = torch.LongTensor([0, 0])\ndescribe(torch.index_select(x, dim=0, index=indices))",
"타입: torch.LongTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0, 1, 2],\n [0, 1, 2]])\n"
],
[
"row_indices = torch.arange(2).long()\ncol_indices = torch.LongTensor([0, 1])\ndescribe(x[row_indices, col_indices])",
"타입: torch.LongTensor\n크기: torch.Size([2])\n값: \ntensor([0, 4])\n"
]
],
[
[
"인덱싱 연산에는 넘파이 `int64` 타입에 해당하는 LongTensor가 사용됩니다.",
"_____no_output_____"
]
],
[
[
"x = torch.LongTensor([[1, 2, 3], \n [4, 5, 6],\n [7, 8, 9]])\ndescribe(x)\nprint(x.dtype)\nprint(x.numpy().dtype)",
"타입: torch.LongTensor\n크기: torch.Size([3, 3])\n값: \ntensor([[1, 2, 3],\n [4, 5, 6],\n [7, 8, 9]])\ntorch.int64\nint64\n"
]
],
[
[
"FloatTensor를 LongTensor로 바꿀 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.FloatTensor([[1, 2, 3], \n [4, 5, 6],\n [7, 8, 9]])\nx = x.long()\ndescribe(x)",
"타입: torch.LongTensor\n크기: torch.Size([3, 3])\n값: \ntensor([[1, 2, 3],\n [4, 5, 6],\n [7, 8, 9]])\n"
]
],
[
[
"### 특별한 텐서 초기화",
"_____no_output_____"
],
[
"숫자가 증가되는 벡터를 만들 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(0, 10)\nprint(x)",
"tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])\n"
]
],
[
[
"이따금 인덱싱을 위해 정수 기반의 배열이 필요합니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(0, 10).long()\nprint(x)",
"tensor([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])\n"
]
],
[
[
"## 연산\n\n텐서로 선형 대수 계산을 하는 것은 최신 딥러닝 기술의 기초가 되었습니다.",
"_____no_output_____"
],
[
"파이토치의 `view` 메서드를 사용하면 원소의 순서를 유지하면서 텐서의 차원을 자유롭게 바꿀 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(0, 20)\n\nprint(x.view(1, 20))\nprint(x.view(2, 10))\nprint(x.view(4, 5))\nprint(x.view(5, 4))\nprint(x.view(10, 2))\nprint(x.view(20, 1))",
"tensor([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n 18, 19]])\ntensor([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],\n [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]])\ntensor([[ 0, 1, 2, 3, 4],\n [ 5, 6, 7, 8, 9],\n [10, 11, 12, 13, 14],\n [15, 16, 17, 18, 19]])\ntensor([[ 0, 1, 2, 3],\n [ 4, 5, 6, 7],\n [ 8, 9, 10, 11],\n [12, 13, 14, 15],\n [16, 17, 18, 19]])\ntensor([[ 0, 1],\n [ 2, 3],\n [ 4, 5],\n [ 6, 7],\n [ 8, 9],\n [10, 11],\n [12, 13],\n [14, 15],\n [16, 17],\n [18, 19]])\ntensor([[ 0],\n [ 1],\n [ 2],\n [ 3],\n [ 4],\n [ 5],\n [ 6],\n [ 7],\n [ 8],\n [ 9],\n [10],\n [11],\n [12],\n [13],\n [14],\n [15],\n [16],\n [17],\n [18],\n [19]])\n"
]
],
[
[
"뷰를 사용하여 크기가 1인 차원을 추가할 수 있습니다. 이렇게 하면 다른 텐서와 연산할 때 브로드캐스팅을 활용할 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(12).view(3, 4)\ny = torch.arange(4).view(1, 4)\nz = torch.arange(3).view(3, 1)\n\nprint(x)\nprint(y)\nprint(z)\nprint(x + y)\nprint(x + z)",
"tensor([[ 0, 1, 2, 3],\n [ 4, 5, 6, 7],\n [ 8, 9, 10, 11]])\ntensor([[0, 1, 2, 3]])\ntensor([[0],\n [1],\n [2]])\ntensor([[ 0, 2, 4, 6],\n [ 4, 6, 8, 10],\n [ 8, 10, 12, 14]])\ntensor([[ 0, 1, 2, 3],\n [ 5, 6, 7, 8],\n [10, 11, 12, 13]])\n"
]
],
[
[
"`unsqueeze`와 `squeeze`는 크기가 1인 차원을 추가하고 삭제합니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(12).view(3, 4)\nprint(x.shape)\n\nx = x.unsqueeze(dim=1)\nprint(x.shape)\n\nx = x.squeeze()\nprint(x.shape)",
"torch.Size([3, 4])\ntorch.Size([3, 1, 4])\ntorch.Size([3, 4])\n"
]
],
[
[
"표준 수학 연산을 모두 지원합니다(예를 들어 `add`).",
"_____no_output_____"
]
],
[
[
"x = torch.rand(3,4)\nprint(\"x: \\n\", x)\nprint(\"--\")\nprint(\"torch.add(x, x): \\n\", torch.add(x, x))\nprint(\"--\")\nprint(\"x+x: \\n\", x + x)",
"x: \n tensor([[0.6662, 0.3343, 0.7893, 0.3216],\n [0.5247, 0.6688, 0.8436, 0.4265],\n [0.9561, 0.0770, 0.4108, 0.0014]])\n--\ntorch.add(x, x): \n tensor([[1.3324, 0.6686, 1.5786, 0.6433],\n [1.0494, 1.3377, 1.6872, 0.8530],\n [1.9123, 0.1540, 0.8216, 0.0028]])\n--\nx+x: \n tensor([[1.3324, 0.6686, 1.5786, 0.6433],\n [1.0494, 1.3377, 1.6872, 0.8530],\n [1.9123, 0.1540, 0.8216, 0.0028]])\n"
]
],
[
[
"메서드 이름 끝에 `_` 문자가 있으면 인-플레이스(in-place) 연산을 의미합니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(12).reshape(3, 4)\nprint(x)\nprint(x.add_(x))",
"tensor([[ 0, 1, 2, 3],\n [ 4, 5, 6, 7],\n [ 8, 9, 10, 11]])\ntensor([[ 0, 2, 4, 6],\n [ 8, 10, 12, 14],\n [16, 18, 20, 22]])\n"
]
],
[
[
"차원을 줄이는 연산이 많이 있습니다. 예를 들면 `sum`입니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(12).reshape(3, 4)\nprint(\"x: \\n\", x)\nprint(\"---\")\nprint(\"행을 따라 덧셈 (dim=0): \\n\", x.sum(dim=0))\nprint(\"---\")\nprint(\"열을 따라 덧셈 (dim=1): \\n\", x.sum(dim=1))",
"x: \n tensor([[ 0, 1, 2, 3],\n [ 4, 5, 6, 7],\n [ 8, 9, 10, 11]])\n---\n행을 따라 덧셈 (dim=0): \n tensor([12, 15, 18, 21])\n---\n열을 따라 덧셈 (dim=1): \n tensor([ 6, 22, 38])\n"
]
],
[
[
"#### 인덱싱, 슬라이싱, 연결, 수정",
"_____no_output_____"
]
],
[
[
"x = torch.arange(6).view(2, 3)\nprint(\"x: \\n\", x)\nprint(\"---\")\nprint(\"x[:2, :2]: \\n\", x[:2, :2])\nprint(\"---\")\nprint(\"x[0][1]: \\n\", x[0][1])\nprint(\"---\")\nprint(\"[0][1]에 8을 할당\")\nx[0][1] = 8\nprint(x)",
"x: \n tensor([[0, 1, 2],\n [3, 4, 5]])\n---\nx[:2, :2]: \n tensor([[0, 1],\n [3, 4]])\n---\nx[0][1]: \n tensor(1)\n---\n[0][1]에 8을 할당\ntensor([[0, 8, 2],\n [3, 4, 5]])\n"
]
],
[
[
"`index_select`을 사용해 텐서의 원소를 선택할 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(9).view(3,3)\nprint(x)\n\nprint(\"---\")\nindices = torch.LongTensor([0, 2])\nprint(torch.index_select(x, dim=0, index=indices))\n\nprint(\"---\")\nindices = torch.LongTensor([0, 2])\nprint(torch.index_select(x, dim=1, index=indices))",
"tensor([[0, 1, 2],\n [3, 4, 5],\n [6, 7, 8]])\n---\ntensor([[0, 1, 2],\n [6, 7, 8]])\n---\ntensor([[0, 2],\n [3, 5],\n [6, 8]])\n"
]
],
[
[
"넘파이 스타일의 인덱싱도 사용할 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(9).view(3,3)\nindices = torch.LongTensor([0, 2])\n\nprint(x[indices])\nprint(\"---\")\nprint(x[indices, :])\nprint(\"---\")\nprint(x[:, indices])",
"tensor([[0, 1, 2],\n [6, 7, 8]])\n---\ntensor([[0, 1, 2],\n [6, 7, 8]])\n---\ntensor([[0, 2],\n [3, 5],\n [6, 8]])\n"
]
],
[
[
"텐서를 연결할 수 있습니다. 먼저 행을 따라 열결합니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(6).view(2,3)\ndescribe(x)\ndescribe(torch.cat([x, x], dim=0))\ndescribe(torch.cat([x, x], dim=1))\ndescribe(torch.stack([x, x]))",
"타입: torch.LongTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0, 1, 2],\n [3, 4, 5]])\n타입: torch.LongTensor\n크기: torch.Size([4, 3])\n값: \ntensor([[0, 1, 2],\n [3, 4, 5],\n [0, 1, 2],\n [3, 4, 5]])\n타입: torch.LongTensor\n크기: torch.Size([2, 6])\n값: \ntensor([[0, 1, 2, 0, 1, 2],\n [3, 4, 5, 3, 4, 5]])\n타입: torch.LongTensor\n크기: torch.Size([2, 2, 3])\n값: \ntensor([[[0, 1, 2],\n [3, 4, 5]],\n\n [[0, 1, 2],\n [3, 4, 5]]])\n"
]
],
[
[
"열을 따라 연결할 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(9).view(3,3)\n\nprint(x)\nprint(\"---\")\nnew_x = torch.cat([x, x, x], dim=1)\nprint(new_x.shape)\nprint(new_x)",
"tensor([[0, 1, 2],\n [3, 4, 5],\n [6, 7, 8]])\n---\ntorch.Size([3, 9])\ntensor([[0, 1, 2, 0, 1, 2, 0, 1, 2],\n [3, 4, 5, 3, 4, 5, 3, 4, 5],\n [6, 7, 8, 6, 7, 8, 6, 7, 8]])\n"
]
],
[
[
"텐서를 쌓아 새로운 0번째 차원에 연결할 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(9).view(3,3)\nprint(x)\nprint(\"---\")\nnew_x = torch.stack([x, x, x])\nprint(new_x.shape)\nprint(new_x)",
"tensor([[0, 1, 2],\n [3, 4, 5],\n [6, 7, 8]])\n---\ntorch.Size([3, 3, 3])\ntensor([[[0, 1, 2],\n [3, 4, 5],\n [6, 7, 8]],\n\n [[0, 1, 2],\n [3, 4, 5],\n [6, 7, 8]],\n\n [[0, 1, 2],\n [3, 4, 5],\n [6, 7, 8]]])\n"
]
],
[
[
"#### 선형 대수 텐서 함수",
"_____no_output_____"
],
[
"전치는 다른 축의 차원을 서로 바꿉니다. 예를 들어 행과 열을 바꿀 수 있습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.arange(0, 12).view(3,4)\nprint(\"x: \\n\", x) \nprint(\"---\")\nprint(\"x.tranpose(1, 0): \\n\", x.transpose(1, 0))",
"x: \n tensor([[ 0, 1, 2, 3],\n [ 4, 5, 6, 7],\n [ 8, 9, 10, 11]])\n---\nx.tranpose(1, 0): \n tensor([[ 0, 4, 8],\n [ 1, 5, 9],\n [ 2, 6, 10],\n [ 3, 7, 11]])\n"
]
],
[
[
"3차원 텐서는 시퀀스의 배치로 표현됩니다. 시퀀스에 있는 각 아이템은 하나의 특성 벡터를 가집니다. 시퀀스 모델에서 시퀀스를 쉽게 인덱싱하기 위해 배치 차원과 시퀀스 차원을 바꾸는 일이 종종 있습니다.\n\n노트: 전치는 2개의 축을 바꿉니다. `permute`는 여러 축을 다룰 수 있습니다(다음 셀에서 설명합니다).",
"_____no_output_____"
]
],
[
[
"batch_size = 3\nseq_size = 4\nfeature_size = 5\n\nx = torch.arange(batch_size * seq_size * feature_size).view(batch_size, seq_size, feature_size)\n\nprint(\"x.shape: \\n\", x.shape)\nprint(\"x: \\n\", x)\nprint(\"-----\")\n\nprint(\"x.transpose(1, 0).shape: \\n\", x.transpose(1, 0).shape)\nprint(\"x.transpose(1, 0): \\n\", x.transpose(1, 0))",
"x.shape: \n torch.Size([3, 4, 5])\nx: \n tensor([[[ 0, 1, 2, 3, 4],\n [ 5, 6, 7, 8, 9],\n [10, 11, 12, 13, 14],\n [15, 16, 17, 18, 19]],\n\n [[20, 21, 22, 23, 24],\n [25, 26, 27, 28, 29],\n [30, 31, 32, 33, 34],\n [35, 36, 37, 38, 39]],\n\n [[40, 41, 42, 43, 44],\n [45, 46, 47, 48, 49],\n [50, 51, 52, 53, 54],\n [55, 56, 57, 58, 59]]])\n-----\nx.transpose(1, 0).shape: \n torch.Size([4, 3, 5])\nx.transpose(1, 0): \n tensor([[[ 0, 1, 2, 3, 4],\n [20, 21, 22, 23, 24],\n [40, 41, 42, 43, 44]],\n\n [[ 5, 6, 7, 8, 9],\n [25, 26, 27, 28, 29],\n [45, 46, 47, 48, 49]],\n\n [[10, 11, 12, 13, 14],\n [30, 31, 32, 33, 34],\n [50, 51, 52, 53, 54]],\n\n [[15, 16, 17, 18, 19],\n [35, 36, 37, 38, 39],\n [55, 56, 57, 58, 59]]])\n"
]
],
[
[
"`permute`는 전치의 일반화된 버전입니다.",
"_____no_output_____"
]
],
[
[
"batch_size = 3\nseq_size = 4\nfeature_size = 5\n\nx = torch.arange(batch_size * seq_size * feature_size).view(batch_size, seq_size, feature_size)\n\nprint(\"x.shape: \\n\", x.shape)\nprint(\"x: \\n\", x)\nprint(\"-----\")\n\nprint(\"x.permute(1, 0, 2).shape: \\n\", x.permute(1, 0, 2).shape)\nprint(\"x.permute(1, 0, 2): \\n\", x.permute(1, 0, 2))",
"x.shape: \n torch.Size([3, 4, 5])\nx: \n tensor([[[ 0, 1, 2, 3, 4],\n [ 5, 6, 7, 8, 9],\n [10, 11, 12, 13, 14],\n [15, 16, 17, 18, 19]],\n\n [[20, 21, 22, 23, 24],\n [25, 26, 27, 28, 29],\n [30, 31, 32, 33, 34],\n [35, 36, 37, 38, 39]],\n\n [[40, 41, 42, 43, 44],\n [45, 46, 47, 48, 49],\n [50, 51, 52, 53, 54],\n [55, 56, 57, 58, 59]]])\n-----\nx.permute(1, 0, 2).shape: \n torch.Size([4, 3, 5])\nx.permute(1, 0, 2): \n tensor([[[ 0, 1, 2, 3, 4],\n [20, 21, 22, 23, 24],\n [40, 41, 42, 43, 44]],\n\n [[ 5, 6, 7, 8, 9],\n [25, 26, 27, 28, 29],\n [45, 46, 47, 48, 49]],\n\n [[10, 11, 12, 13, 14],\n [30, 31, 32, 33, 34],\n [50, 51, 52, 53, 54]],\n\n [[15, 16, 17, 18, 19],\n [35, 36, 37, 38, 39],\n [55, 56, 57, 58, 59]]])\n"
]
],
[
[
"행렬 곱셈은 `mm`입니다.",
"_____no_output_____"
]
],
[
[
"torch.randn(2, 3, requires_grad=True)",
"_____no_output_____"
],
[
"x1 = torch.arange(6).view(2, 3).float()\ndescribe(x1)\n\nx2 = torch.ones(3, 2)\nx2[:, 1] += 1\ndescribe(x2)\n\ndescribe(torch.mm(x1, x2))",
"타입: torch.FloatTensor\n크기: torch.Size([2, 3])\n값: \ntensor([[0., 1., 2.],\n [3., 4., 5.]])\n타입: torch.FloatTensor\n크기: torch.Size([3, 2])\n값: \ntensor([[1., 2.],\n [1., 2.],\n [1., 2.]])\n타입: torch.FloatTensor\n크기: torch.Size([2, 2])\n값: \ntensor([[ 3., 6.],\n [12., 24.]])\n"
],
[
"x = torch.arange(0, 12).view(3,4).float()\nprint(x)\n\nx2 = torch.ones(4, 2)\nx2[:, 1] += 1\nprint(x2)\n\nprint(x.mm(x2))",
"tensor([[ 0., 1., 2., 3.],\n [ 4., 5., 6., 7.],\n [ 8., 9., 10., 11.]])\ntensor([[1., 2.],\n [1., 2.],\n [1., 2.],\n [1., 2.]])\ntensor([[ 6., 12.],\n [22., 44.],\n [38., 76.]])\n"
]
],
[
[
"더 자세한 내용은 [파이토치 수학 연산 문서](https://pytorch.org/docs/stable/torch.html#math-operations)를 참고하세요!",
"_____no_output_____"
],
[
"## 그레이디언트 계산",
"_____no_output_____"
]
],
[
[
"x = torch.tensor([[2.0, 3.0]], requires_grad=True)\nz = 3 * x\nprint(z)",
"tensor([[6., 9.]], grad_fn=<MulBackward0>)\n"
]
],
[
[
"아래 간단한 코드에서 그레이디언트 계산을 엿볼 수 있습니다. 텐서 하나를 만들고 3을 곱합니다. 그다음 `sum()`을 사용해 스칼라 출력을 만듭니다. 손실 함수에는 스칼라 값이 필요하기 때문입니다. 그다음 손실에 `backward()`를 호출해 입력에 대한 변화율을 계산합니다. `sum()`으로 스칼라 값을 만들었기 때문에 `z`와 `x`에 있는 각 원소는 손실 스칼라 값에 대해 독립적입니다.\n\n출력에 대한 `x`의 변화율은 `x`에 곱한 상수 3입니다.",
"_____no_output_____"
]
],
[
[
"x = torch.tensor([[2.0, 3.0]], requires_grad=True)\nprint(\"x: \\n\", x)\nprint(\"---\")\nz = 3 * x\nprint(\"z = 3*x: \\n\", z)\nprint(\"---\")\n\nloss = z.sum()\nprint(\"loss = z.sum(): \\n\", loss)\nprint(\"---\")\n\nloss.backward()\n\nprint(\"loss.backward()를 호출한 후, x.grad: \\n\", x.grad)\n",
"x: \n tensor([[2., 3.]], requires_grad=True)\n---\nz = 3*x: \n tensor([[6., 9.]], grad_fn=<MulBackward0>)\n---\nloss = z.sum(): \n tensor(15., grad_fn=<SumBackward0>)\n---\nloss.backward()를 호출한 후, x.grad: \n tensor([[3., 3.]])\n"
]
],
[
[
"### 예제: 조건 그레이디언트 계산하기\n\n$$ \\text{x=1에서 f(x)의 그레이디언트 찾기} $$\n$$ {} $$\n$$ f(x)=\\left\\{\n\\begin{array}{ll}\n sin(x) \\; x>0 \\text{ 일 때 }\\\\\n cos(x) \\text{ 그 외 } \\\\\n\\end{array}\n\\right.$$",
"_____no_output_____"
]
],
[
[
"def f(x):\n if (x.data > 0).all():\n return torch.sin(x)\n else:\n return torch.cos(x)",
"_____no_output_____"
],
[
"x = torch.tensor([1.0], requires_grad=True)\ny = f(x)\ny.backward()\nprint(x.grad)",
"tensor([0.5403])\n"
]
],
[
[
"큰 벡터에 적용할 수 있지만 출력은 스칼라 값이어야 합니다.",
"_____no_output_____"
]
],
[
[
"x = torch.tensor([1.0, 0.5], requires_grad=True)\ny = f(x)\n# 에러가 발생합니다!\ny.backward()\nprint(x.grad)",
"_____no_output_____"
]
],
[
[
"스칼라 출력을 만들어 보죠.",
"_____no_output_____"
]
],
[
[
"x = torch.tensor([1.0, 0.5], requires_grad=True)\ny = f(x)\ny.sum().backward()\nprint(x.grad)",
"tensor([0.5403, 0.8776])\n"
]
],
[
[
"하지만 이슈가 있습니다. 이 함수는 예외적인 경우에 맞지 않습니다.",
"_____no_output_____"
]
],
[
[
"x = torch.tensor([1.0, -1], requires_grad=True)\ny = f(x)\ny.sum().backward()\nprint(x.grad)",
"tensor([-0.8415, 0.8415])\n"
],
[
"x = torch.tensor([-0.5, -1], requires_grad=True)\ny = f(x)\ny.sum().backward()\nprint(x.grad)",
"tensor([0.4794, 0.8415])\n"
]
],
[
[
"이는 원소별로 불리언 연산과 코사인/사인 계산이 수행되지 않기 때문입니다. 이를 해결하기 위해 자주 사용되는 방법은 마스킹입니다.",
"_____no_output_____"
]
],
[
[
"def f2(x):\n mask = torch.gt(x, 0).float()\n return mask * torch.sin(x) + (1 - mask) * torch.cos(x)\n\nx = torch.tensor([1.0, -1], requires_grad=True)\ny = f2(x)\ny.sum().backward()\nprint(x.grad)",
"tensor([0.5403, 0.8415])\n"
],
[
"def describe_grad(x):\n if x.grad is None:\n print(\"그레이디언트 정보 없음\")\n else:\n print(\"그레이디언트: \\n{}\".format(x.grad))\n print(\"그레이디언트 함수: {}\".format(x.grad_fn))",
"_____no_output_____"
],
[
"import torch\nx = torch.ones(2, 2, requires_grad=True)\ndescribe(x)\ndescribe_grad(x)\nprint(\"--------\")\n\ny = (x + 2) * (x + 5) + 3\ndescribe(y)\nz = y.mean()\ndescribe(z)\ndescribe_grad(x)\nprint(\"--------\")\nz.backward(create_graph=True, retain_graph=True)\ndescribe_grad(x)\nprint(\"--------\")\n",
"타입: torch.FloatTensor\n크기: torch.Size([2, 2])\n값: \ntensor([[1., 1.],\n [1., 1.]], requires_grad=True)\n그레이디언트 정보 없음\n--------\n타입: torch.FloatTensor\n크기: torch.Size([2, 2])\n값: \ntensor([[21., 21.],\n [21., 21.]], grad_fn=<AddBackward0>)\n타입: torch.FloatTensor\n크기: torch.Size([])\n값: \n21.0\n그레이디언트 정보 없음\n--------\n그레이디언트: \ntensor([[2.2500, 2.2500],\n [2.2500, 2.2500]], grad_fn=<CopyBackwards>)\n그레이디언트 함수: None\n--------\n"
],
[
"x = torch.ones(2, 2, requires_grad=True)",
"_____no_output_____"
],
[
"y = x + 2",
"_____no_output_____"
],
[
"y.grad_fn",
"_____no_output_____"
]
],
[
[
"### CUDA 텐서",
"_____no_output_____"
],
[
"파이토치 연산은 GPU나 CPU에서 수행할 수 있습니다. 두 장치를 사용하기 위한 몇 가지 연산을 제공합니다. (코랩에서 실행할 경우 런타임 유형을 GPU로 바꾸세요)",
"_____no_output_____"
]
],
[
[
"print(torch.cuda.is_available())",
"True\n"
],
[
"x = torch.rand(3,3)\ndescribe(x)",
"타입: torch.FloatTensor\n크기: torch.Size([3, 3])\n값: \ntensor([[0.9149, 0.3993, 0.1100],\n [0.2541, 0.4333, 0.4451],\n [0.4966, 0.7865, 0.6604]])\n"
],
[
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\nprint(device)",
"cuda\n"
],
[
"x = torch.rand(3, 3).to(device)\ndescribe(x)\nprint(x.device)",
"타입: torch.cuda.FloatTensor\n크기: torch.Size([3, 3])\n값: \ntensor([[0.1303, 0.3498, 0.3824],\n [0.8043, 0.3186, 0.2908],\n [0.4196, 0.3728, 0.3769]], device='cuda:0')\ncuda:0\n"
],
[
"cpu_device = torch.device(\"cpu\")",
"_____no_output_____"
],
[
"# 에러 발생!\ny = torch.rand(3, 3)\nx + y",
"_____no_output_____"
],
[
"y = y.to(cpu_device)\nx = x.to(cpu_device)\nx + y",
"_____no_output_____"
],
[
"if torch.cuda.is_available(): # GPU가 있을 경우에\n a = torch.rand(3,3).to(device='cuda:0') # CUDA 텐서\n print(a)\n \n b = torch.rand(3,3).cuda()\n print(b)\n\n print(a + b)\n\n a = a.cpu() # 에러 발생\n print(a + b)",
"tensor([[0.7091, 0.1775, 0.4443],\n [0.1230, 0.9638, 0.7695],\n [0.0378, 0.2239, 0.6772]], device='cuda:0')\ntensor([[0.5274, 0.6325, 0.0910],\n [0.2323, 0.7269, 0.1187],\n [0.3951, 0.7199, 0.7595]], device='cuda:0')\ntensor([[1.2365, 0.8100, 0.5353],\n [0.3552, 1.6906, 0.8883],\n [0.4330, 0.9438, 1.4367]], device='cuda:0')\n"
]
],
[
[
"### 연습문제\n\n연습문제에 필요한 일부 연산은 이 노트북에 있지 않습니다. [파이토치 문서](https://pytorch.org/docs/)를 참고하세요!\n\n(정답은 맨 아래 있습니다)",
"_____no_output_____"
],
[
"#### 문제 1\n\n2D 텐서를 만들고 차원 0 위치에 크기가 1인 차원을 추가하세요.",
"_____no_output_____"
],
[
"#### 문제 2 \n\n이전 텐서에 추가한 차원을 삭제하세요.",
"_____no_output_____"
],
[
"#### 문제\u001f 3\n\n[3, 7) 범위를 갖는 5x3 크기의 랜덤한 텐서를 만드세요.",
"_____no_output_____"
],
[
"#### 문제 4\n\n정규 분포(평균=0, 표준편차=1)를 사용해 텐서를 만드세요.",
"_____no_output_____"
],
[
"#### 문제 5\n\n텐서 `torch.Tensor([1, 1, 1, 0, 1])`에서 0이 아닌 원소의 인덱스를 추출하세요.",
"_____no_output_____"
],
[
"#### 문제 6\n\n(3,1) 크기가 인 랜덤한 텐서를 만들고 네 벌을 복사해 쌓으세요.",
"_____no_output_____"
],
[
"#### 문제 7\n\n두 개의 2차원 행렬(`a=torch.rand(3,4,5)`, `b=torch.rand(3,5,4)`)의 배치 행렬 곱셈(batch matrix-matrix product)을 계산하세요.",
"_____no_output_____"
],
[
"#### 문제 8\n\n3차원 행렬(`a=torch.rand(3,4,5)`)과 2차원 행렬(`b=torch.rand(5,4)`)의 배치 행렬 곱셈을 계산하세요.",
"_____no_output_____"
],
[
"정답은 아래에..",
"_____no_output_____"
],
[
"정답은 더 아래에..",
"_____no_output_____"
],
[
"#### 문제 1\n\n2D 텐서를 만들고 차원 0 위치에 크기가 1인 차원을 추가하세요.",
"_____no_output_____"
]
],
[
[
"a = torch.rand(3,3)\na = a.unsqueeze(0)\nprint(a)\nprint(a.shape)",
"tensor([[[0.5311, 0.6449, 0.7224],\n [0.4416, 0.3634, 0.8818],\n [0.9874, 0.7316, 0.2814]]])\ntorch.Size([1, 3, 3])\n"
]
],
[
[
"#### 문제 2 \n\n이전 텐서에 추가한 차원을 삭제하세요.",
"_____no_output_____"
]
],
[
[
"a = a.squeeze(0)\nprint(a.shape)",
"torch.Size([3, 3])\n"
]
],
[
[
"#### 문제\u001f 3\n\n[3, 7) 범위를 갖는 5x3 크기의 랜덤한 텐서를 만드세요.",
"_____no_output_____"
]
],
[
[
"3 + torch.rand(5, 3) * 4",
"_____no_output_____"
]
],
[
[
"#### 문제 4\n\n정규 분포(평균=0, 표준편차=1)를 사용해 텐서를 만드세요.",
"_____no_output_____"
]
],
[
[
"a = torch.rand(3,3)\na.normal_(mean=0, std=1)",
"_____no_output_____"
]
],
[
[
"#### 문제 5\n\n텐서 `torch.Tensor([1, 1, 1, 0, 1])`에서 0이 아닌 원소의 인덱스를 추출하세요.",
"_____no_output_____"
]
],
[
[
"a = torch.Tensor([1, 1, 1, 0, 1])\ntorch.nonzero(a)",
"_____no_output_____"
]
],
[
[
"#### 문제 6\n\n(3,1) 크기가 인 랜덤한 텐서를 만들고 네 벌을 복사해 쌓으세요.",
"_____no_output_____"
]
],
[
[
"a = torch.rand(3,1)\na.expand(3,4)",
"_____no_output_____"
]
],
[
[
"#### 문제 7\n\n두 개의 2차원 행렬(`a=torch.rand(3,4,5)`, `b=torch.rand(3,5,4)`)의 배치 행렬 곱셈(batch matrix-matrix product)을 계산하세요.",
"_____no_output_____"
]
],
[
[
"a = torch.rand(3,4,5)\nb = torch.rand(3,5,4)\ntorch.bmm(a, b)",
"_____no_output_____"
]
],
[
[
"#### 문제 8\n\n3차원 행렬(`a=torch.rand(3,4,5)`)과 2차원 행렬(`b=torch.rand(5,4)`)의 배치 행렬 곱셈을 계산하세요.",
"_____no_output_____"
]
],
[
[
"a = torch.rand(3,4,5)\nb = torch.rand(5,4)\ntorch.bmm(a, b.unsqueeze(0).expand(a.size(0), *b.size()))",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb69db9af59b2246654cf78227608dcbd7293e70 | 4,970 | ipynb | Jupyter Notebook | colabs/dcm_to_sheets.ipynb | Gregorfran/starthinker | 4c9031f3001d380dbfc213a83b11ec61dfcffe47 | [
"Apache-2.0"
]
| null | null | null | colabs/dcm_to_sheets.ipynb | Gregorfran/starthinker | 4c9031f3001d380dbfc213a83b11ec61dfcffe47 | [
"Apache-2.0"
]
| 6 | 2021-03-19T12:00:18.000Z | 2022-02-10T09:43:42.000Z | colabs/dcm_to_sheets.ipynb | Gregorfran/starthinker-gregor | 4c9031f3001d380dbfc213a83b11ec61dfcffe47 | [
"Apache-2.0"
]
| null | null | null | 30.679012 | 230 | 0.484306 | [
[
[
"#1. Install Dependencies\nFirst install the libraries needed to execute recipes, this only needs to be done once, then click play.\n",
"_____no_output_____"
]
],
[
[
"!pip install git+https://github.com/google/starthinker\n",
"_____no_output_____"
]
],
[
[
"#2. Get Cloud Project ID\nTo run this recipe [requires a Google Cloud Project](https://github.com/google/starthinker/blob/master/tutorials/cloud_project.md), this only needs to be done once, then click play.\n",
"_____no_output_____"
]
],
[
[
"CLOUD_PROJECT = 'PASTE PROJECT ID HERE'\n\nprint(\"Cloud Project Set To: %s\" % CLOUD_PROJECT)\n",
"_____no_output_____"
]
],
[
[
"#3. Get Client Credentials\nTo read and write to various endpoints requires [downloading client credentials](https://github.com/google/starthinker/blob/master/tutorials/cloud_client_installed.md), this only needs to be done once, then click play.\n",
"_____no_output_____"
]
],
[
[
"CLIENT_CREDENTIALS = 'PASTE CREDENTIALS HERE'\n\nprint(\"Client Credentials Set To: %s\" % CLIENT_CREDENTIALS)\n",
"_____no_output_____"
]
],
[
[
"#4. Enter CM To Sheets Parameters\nMove existing CM report into a Sheet tab.\n 1. Specify an account id.\n 1. Specify either report name or report id to move a report.\n 1. The most recent valid file will be moved to the sheet.\n 1. Schema is pulled from the official CM specification.\nModify the values below for your use case, can be done multiple times, then click play.\n",
"_____no_output_____"
]
],
[
[
"FIELDS = {\n 'auth_read': 'user', # Credentials used for reading data.\n 'account': '',\n 'report_id': '',\n 'report_name': '',\n 'sheet': '',\n 'tab': '',\n}\n\nprint(\"Parameters Set To: %s\" % FIELDS)\n",
"_____no_output_____"
]
],
[
[
"#5. Execute CM To Sheets\nThis does NOT need to be modified unles you are changing the recipe, click play.\n",
"_____no_output_____"
]
],
[
[
"from starthinker.util.project import project\nfrom starthinker.script.parse import json_set_fields, json_expand_includes\n\nUSER_CREDENTIALS = '/content/user.json'\n\nTASKS = [\n {\n 'dcm': {\n 'auth': 'user',\n 'report': {\n 'account': {'field': {'name': 'account','kind': 'integer','order': 2,'default': ''}},\n 'report_id': {'field': {'name': 'report_id','kind': 'integer','order': 3,'default': ''}},\n 'name': {'field': {'name': 'report_name','kind': 'string','order': 4,'default': ''}}\n },\n 'out': {\n 'sheets': {\n 'sheet': {'field': {'name': 'sheet','kind': 'string','order': 5,'default': ''}},\n 'tab': {'field': {'name': 'tab','kind': 'string','order': 6,'default': ''}},\n 'range': 'A1'\n }\n }\n }\n }\n]\n\njson_set_fields(TASKS, FIELDS)\njson_expand_includes(TASKS)\n\nproject.initialize(_recipe={ 'tasks':TASKS }, _project=CLOUD_PROJECT, _user=USER_CREDENTIALS, _client=CLIENT_CREDENTIALS, _verbose=True)\nproject.execute()\n",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb69dc8728e68c8bac2836dc9dc986b4d3f4ff89 | 63,043 | ipynb | Jupyter Notebook | Creating plots with multiple axes.ipynb | Blitzbert/Covid19 | 2690e69d0dfa55f3ccddf592c1e082f042034114 | [
"Apache-2.0"
]
| null | null | null | Creating plots with multiple axes.ipynb | Blitzbert/Covid19 | 2690e69d0dfa55f3ccddf592c1e082f042034114 | [
"Apache-2.0"
]
| null | null | null | Creating plots with multiple axes.ipynb | Blitzbert/Covid19 | 2690e69d0dfa55f3ccddf592c1e082f042034114 | [
"Apache-2.0"
]
| null | null | null | 72.380023 | 18,192 | 0.711118 | [
[
[
"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns",
"_____no_output_____"
],
[
"df = pd.read_csv(\"rawdata.csv\")\ndf.head()",
"_____no_output_____"
],
[
"x=df[[\"continent\",\"location\",\"total_deaths\",\"new_deaths\"]]\nx.head()",
"_____no_output_____"
],
[
"y = pd.DataFrame({'location': [\"UK\", \"Italy\" , \"Russia\",\"France\",\"Germany\"],\n 'mean_smokers': [22.35,23.80,40.85,32.85,30.65],\n 'total_deaths': [127224.0,112861.0,100158.0,98196.0,78049.0]\n \n \n },\n index=['1', '2',\"3\",\"4\",\"5\"])\ny",
"_____no_output_____"
],
[
"data_smokers = df[[\"total_deaths\", \"continent\", \"date\", \"location\", \"female_smokers\", \"male_smokers\"]]\n\ndata_smokers_EU = data_smokers[data_smokers[\"continent\"] == \"Europe\"]\ndata_smokers_EU_08_04_2021 = data_smokers_EU[data_smokers_EU[\"date\"] == \"2021-04-08\"]\n\n\ndata_smokers_EU_top10 = data_smokers_EU_08_04_2021.groupby(\"location\").sum().sort_values(\"total_deaths\", ascending=False).head(10)\n\n\ndata_smokers_EU_top10[\"mean_smokers\"]=data_smokers_EU_top10[\"female_smokers\"]/2 + data_smokers_EU_top10[\"male_smokers\"]/2\ndata_smokers_EU_top10_mean = data_smokers_EU_top10\ndata_smokers_EU_top10_mean\n",
"_____no_output_____"
],
[
"x=data_smokers_EU_top10_mean[[\"total_deaths\"]]\nx.head()",
"_____no_output_____"
],
[
"y=data_smokers_EU_top10_mean[[\"mean_smokers\"]]\ny.head()\n",
"_____no_output_____"
],
[
"#plot 1:\nx = np.array([0,1,2,3])\ny = np.array([3, 8, 1, 10])\n\nplt.subplot(1,3,2)\nplt.plot(x,y)\n\n#plot 2:\n#x = np.array([0, 1, 2, 3])\n#y = np.array([10, 20, 30, 40])\n\n#plt.subplot(1, 2, 2)\n#plt.plot(x,y)\n\nplt.show()",
"_____no_output_____"
],
[
"z= y.set_index(\"location\")\nz.plot(y=\"mean_smokers\")",
"_____no_output_____"
],
[
"z.plot.bar(y=\"total_deaths\")",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb69e13f39b8f9d469d425ed27a53bab7d22e9ec | 130 | ipynb | Jupyter Notebook | 01-Lesson-Plans/11-Classification/1/Activities/01-Ins_Logistic_Regression/Solved/logistic_regression.ipynb | tatianegercina/FinTech | b40687aa362d78674e223eb15ecf14bc59f90b62 | [
"ADSL"
]
| 1 | 2021-04-13T07:14:34.000Z | 2021-04-13T07:14:34.000Z | 01-Lesson-Plans/11-Classification/1/Activities/01-Ins_Logistic_Regression/Solved/logistic_regression.ipynb | tatianegercina/FinTech | b40687aa362d78674e223eb15ecf14bc59f90b62 | [
"ADSL"
]
| 2 | 2021-06-02T03:14:19.000Z | 2022-02-11T23:21:24.000Z | 01-Lesson-Plans/11-Classification/1/Activities/01-Ins_Logistic_Regression/Solved/logistic_regression.ipynb | tatianegercina/FinTech | b40687aa362d78674e223eb15ecf14bc59f90b62 | [
"ADSL"
]
| 1 | 2021-05-07T13:26:50.000Z | 2021-05-07T13:26:50.000Z | 32.5 | 75 | 0.884615 | [
[
[
"empty"
]
]
]
| [
"empty"
]
| [
[
"empty"
]
]
|
cb69ef933c641db567a27d38dbb6a27250e61272 | 295,603 | ipynb | Jupyter Notebook | Heart (2)-checkpoint.ipynb | MKSanjana/Heart-Disease-Rescue | 4ce6a1e695b79347ab7d6b891ffbe10454d0742b | [
"MIT"
]
| null | null | null | Heart (2)-checkpoint.ipynb | MKSanjana/Heart-Disease-Rescue | 4ce6a1e695b79347ab7d6b891ffbe10454d0742b | [
"MIT"
]
| null | null | null | Heart (2)-checkpoint.ipynb | MKSanjana/Heart-Disease-Rescue | 4ce6a1e695b79347ab7d6b891ffbe10454d0742b | [
"MIT"
]
| null | null | null | 143.915774 | 172,772 | 0.847901 | [
[
[
"# Exploratory Data Analysis and Plotting Libraries\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\n# Scikit-Learn Models\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.neighbors import KNeighborsClassifier\nfrom sklearn.ensemble import RandomForestClassifier\n\n# Model Evaluations\nfrom sklearn.model_selection import train_test_split, cross_val_score\nfrom sklearn.model_selection import RandomizedSearchCV, GridSearchCV\nfrom sklearn.metrics import confusion_matrix, classification_report\nfrom sklearn.metrics import precision_score, recall_score, f1_score\nfrom sklearn.metrics import plot_roc_curve",
"_____no_output_____"
],
[
"df = pd.read_csv(\"heart.csv\")\ndf.shape # (rows, columns)",
"_____no_output_____"
],
[
"df.target.value_counts().plot(kind='bar', figsize=(10, 6), color=['pink', 'blue'])\nplt.title('Frequency of Heart Disease')\nplt.xlabel('1 = Disease, 0 = No Disease')\nplt.ylabel('Amount')\nplt.xticks(rotation=0);",
"_____no_output_____"
],
[
"df.describe()",
"_____no_output_____"
],
[
"# sex: (1 = male; 0 = female)\ndf.sex.value_counts()",
"_____no_output_____"
],
[
"pd.crosstab(df.target, df.sex).plot(kind='bar',\n figsize=(10, 6),\n color=['pink', 'blue'])\nplt.title('Heart Disease Frequency for Sex')\nplt.xlabel('0 = No Disease, 1 = Disease')\nplt.ylabel('Amount')\nplt.legend(['Female', 'Male']);\nplt.xticks(rotation=0);",
"_____no_output_____"
],
[
"df.age.plot.hist();",
"_____no_output_____"
],
[
"pd.crosstab(df.cp, df.target)",
"_____no_output_____"
],
[
"pd.crosstab(df.cp, df.target).plot(kind='bar',\n figsize=(10, 6),\n color=['blue', 'pink'])\nplt.title('Heart Disease Frequency for Chest Pain Type')\nplt.xlabel('Chest Pain Type')\nplt.ylabel('Amount')\nplt.legend(['No Disease', 'Disease']);\nplt.xticks(rotation=0);",
"_____no_output_____"
],
[
"df.corr()",
"_____no_output_____"
],
[
"ix = df.corr().sort_values('target', ascending=True).index\ndf_sorted = df.loc[:, ix]\ncorrmat = df_sorted.corr()\nfig, ax = plt.subplots(figsize=(20, 25))\ng = sns.heatmap(corrmat, vmin=-1.0, vmax=1.0, square=True, annot=True, fmt='.2f', annot_kws={'size': 12}, cbar_kws= {'shrink': 0.65}, linecolor='black', center=0, linewidths=.25, cmap='BrBG')\ng.tick_params(labelsize=15)",
"_____no_output_____"
],
[
"df.head()",
"_____no_output_____"
],
[
"X = df.drop('target', axis=1)\ny = df.target",
"_____no_output_____"
],
[
"X",
"_____no_output_____"
],
[
"y",
"_____no_output_____"
],
[
"np.random.seed(33)\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)",
"_____no_output_____"
],
[
"print(X_train.shape, y_train.shape, X_test.shape, y_test.shape)",
"(242, 13) (242,) (61, 13) (61,)\n"
],
[
"# Put models in dictionary\nmodels = {'Logistic Regression': LogisticRegression(solver='lbfgs', max_iter=1000),\n 'KNN': KNeighborsClassifier(),\n 'Random Forest': RandomForestClassifier()}\n\n# Create a function to fit and score models\ndef fit_and_score(models, X_train, X_test, y_train, y_test):\n \"\"\"\n Fits and evaluates given machine learning models.\n models: a dictionary of different Scikit-Learn machine learning models\n X_train: training data (no labels)\n X_test: testing data (no labels)\n y_train: training labels\n y_test: test labels\n \"\"\"\n # Set random seed\n np.random.seed(33)\n # Make dictionary to keep model scores\n model_scores = {}\n # Loop through models\n for name, model in models.items():\n # Fit the model to the data\n model.fit(X_train, y_train)\n # Evaluate the model and append its score to model_scores\n model_scores[name] = model.score(X_test, y_test)\n return model_scores",
"_____no_output_____"
],
[
"model_scores = fit_and_score(models, X_train, X_test, y_train, y_test)\nmodel_scores",
"_____no_output_____"
],
[
"# Tuning KNN\ntrain_scores = []\ntest_scores = []\n\n# Create a list of different values for n_neighbors\nneighbors = range(1, 21)\n\n# Create KNN instance\nknn = KNeighborsClassifier()\n\n# Loop through different n_neighbors\nfor i in neighbors:\n knn.set_params(n_neighbors = i)\n \n # Fit the algorithm\n knn.fit(X_train, y_train)\n \n # Update the training scores list\n train_scores.append(knn.score(X_train, y_train))\n \n # Update the testing scores list\n test_scores.append(knn.score(X_test, y_test))",
"_____no_output_____"
],
[
"train_scores",
"_____no_output_____"
],
[
"test_scores",
"_____no_output_____"
],
[
"plt.plot(neighbors, train_scores, label='Train Score')\nplt.plot(neighbors, test_scores, label='Test Score')\nplt.xticks(np.arange(1, 21, 1))\nplt.xlabel('Number of Neighbors')\nplt.ylabel('Model Score')\nplt.legend()\n\nprint(f'Maximum KNN score on the test data: {max(test_scores)*100:.2f}%')",
"Maximum KNN score on the test data: 57.38%\n"
],
[
"rf_grid = {'n_estimators': np.arange(100, 102, 1), \n 'max_depth': np.arange(5, 10, 1),\n 'min_samples_split': np.arange(10, 15, 1),\n 'min_samples_leaf': np.arange(10, 15, 1),\n 'n_jobs': [-1]}",
"_____no_output_____"
],
[
"gs_rf = GridSearchCV(RandomForestClassifier(),\n param_grid=rf_grid,\n cv=5,\n verbose=True)\n\n# Fit random hyperparameter search model\ngs_rf.fit(X_train, y_train)",
"Fitting 5 folds for each of 250 candidates, totalling 1250 fits\n"
],
[
"gs_rf.best_params_",
"_____no_output_____"
],
[
"gs_rf.score(X_test, y_test)",
"_____no_output_____"
],
[
"y_preds = gs_rf.predict(X_test)",
"_____no_output_____"
],
[
"y_preds",
"_____no_output_____"
],
[
"y_test",
"_____no_output_____"
],
[
"plot_roc_curve(gs_rf, X_test, y_test);",
"_____no_output_____"
],
[
"print(confusion_matrix(y_test, y_preds))",
"_____no_output_____"
],
[
"sns.set(font_scale=1.5) # Increase font size\n \ndef plot_conf_mat(y_test, y_preds):\n \"\"\"\n Plots a confusion matrix using Seaborn's heatmap()\n \"\"\"\n fig, ax = plt.subplots(figsize=(3, 3))\n ax = sns.heatmap(confusion_matrix(y_test, y_preds),\n annot=True, # Annotate the boxes\n cbar=False)\n plt.xlabel(\"Predicted label\") # predictions go on the x-axis\n plt.ylabel(\"True label\") # true labels go on the y-axis \n \nplot_conf_mat(y_test, y_preds)",
"_____no_output_____"
],
[
"print(classification_report(y_test, y_preds))",
"_____no_output_____"
],
[
"best_params = gs_rf.best_params_\nbest_params",
"_____no_output_____"
],
[
"clf = RandomForestClassifier(n_estimators=best_params['n_estimators'],\n min_samples_split=best_params['min_samples_split'],\n min_samples_leaf=best_params['min_samples_leaf'],\n max_depth=best_params['max_depth'],\n n_jobs=best_params['n_jobs'])",
"_____no_output_____"
],
[
"cv_acc = cross_val_score(clf, X, y, scoring='accuracy')\ncv_acc",
"_____no_output_____"
],
[
"cv_acc = np.mean(cv_acc)\ncv_acc",
"_____no_output_____"
],
[
"cv_precision = cross_val_score(clf, X, y, scoring='precision')\ncv_precision = np.mean(cv_precision)\ncv_precision",
"_____no_output_____"
],
[
"cv_recall = cross_val_score(clf, X, y, scoring='recall')\ncv_recall = np.mean(cv_recall)\ncv_recall",
"_____no_output_____"
],
[
"cv_f1 = cross_val_score(clf, X, y, scoring='f1')\ncv_f1 = np.mean(cv_f1)\ncv_f1",
"_____no_output_____"
],
[
"cv_metrics = pd.DataFrame({'Accuracy': cv_acc,\n 'Precision': cv_precision,\n 'Recall': cv_recall,\n 'F1': cv_f1},\n index=[0])\n\ncv_metrics.T.plot.bar(title='Cross-Validated Classification Metrics',\n legend=False);",
"_____no_output_____"
],
[
"best_params = gs_rf.best_params_\nbest_params",
"_____no_output_____"
],
[
"# Different parameters for our RandomForestClassifier model\nrf_grid = {'n_estimators': [102], \n 'max_depth': [6],\n 'min_samples_split': [14],\n 'min_samples_leaf': [13],\n 'n_jobs': [-1],\n 'max_features': range(1, 14),}\n\n# Create hyperparameter search\ngs_rf = GridSearchCV(RandomForestClassifier(),\n param_grid=rf_grid,\n cv=5,\n verbose=True)\n\n# Fit hyperparameter search model\ngs_rf.fit(X_train, y_train)",
"_____no_output_____"
],
[
"best_params = gs_rf.best_params_\nbest_params",
"_____no_output_____"
],
[
"model = RandomForestClassifier(max_depth=best_params[\"max_depth\"], n_estimators=best_params[\"n_estimators\"],\n max_features=best_params[\"max_features\"], min_samples_leaf=best_params[\"min_samples_leaf\"],\n min_samples_split=best_params['min_samples_split'], n_jobs=-1,\n random_state=33)",
"_____no_output_____"
],
[
"model.fit(X_train, y_train)",
"_____no_output_____"
],
[
"model.score(X_test, y_test)",
"_____no_output_____"
],
[
"model.feature_importances_",
"_____no_output_____"
],
[
"X.columns",
"_____no_output_____"
],
[
"feat_importance = []\nfor feature in zip(X.columns, model.feature_importances_):\n feat_importance.append(feature)",
"_____no_output_____"
],
[
"importance = pd.DataFrame(feat_importance,columns=[\"Feature\", \"Importance\"])\nprint(importance.sort_values(by=[\"Importance\"],ascending=False))",
"_____no_output_____"
],
[
"from sklearn.ensemble import AdaBoostClassifier\n\nclf = AdaBoostClassifier(n_estimators=100, base_estimator=model, learning_rate=1)\nclf.fit(X_train, y_train)\nclf.score(X_test, y_test)",
"_____no_output_____"
],
[
"from sklearn.ensemble import GradientBoostingClassifier\n\nclf = GradientBoostingClassifier(n_estimators=100, learning_rate=1.0, max_depth=5)\nclf.fit(X_train, y_train)\nclf.score(X_test, y_test)",
"_____no_output_____"
],
[
"!pip install xgboost",
"_____no_output_____"
],
[
"from xgboost import XGBClassifier\n\nclf = XGBClassifier()\nclf.fit(X_train, y_train)\nclf.score(X_test, y_test)",
"_____no_output_____"
],
[
"import pickle\n\nclf = AdaBoostClassifier(n_estimators=100, base_estimator=model, learning_rate=1)\nclf.fit(X_train, y_train)\n\npickle.dump(clf, open('./heart.pkl','wb'))",
"_____no_output_____"
],
[
"input_data = input(\"Enter comm seperated values : \")\ninput_data = input_data.split(',')\ninput_data = map(float , input_data)\ninput_data = np.asarray(list(input_data))\ninput_data = input_data.reshape(1,-1)\nprediction =model.predict(input_data)\nif prediction[0] == 0:\n print('Congratulation! You do not have heart dieases')\nelse:\n print('The person have heart dieases')",
"_____no_output_____"
],
[
"input_data = input(\"Enter comm seperated values: \")\ninput_data = input_data.split(',')\ninput_data = map(float , input_data)\ninput_data = np.asarray(list(input_data))\ninput_data = input_data.reshape(1,-1)\nprediction =model.predict(input_data)\nif prediction[0] == 0:\n print('Congratulation! You do not have heart dieases')\nelse:\n print('The person have heart dieases')",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb69f9fe6b114ff53d8bca52ab36a88031e94c9c | 165,576 | ipynb | Jupyter Notebook | DangdangRank/save_res.ipynb | zhbink/DangdangRank | 07a11de1d3a9ce5e1e0d3179f5a1b33100b5cb2f | [
"MIT"
]
| null | null | null | DangdangRank/save_res.ipynb | zhbink/DangdangRank | 07a11de1d3a9ce5e1e0d3179f5a1b33100b5cb2f | [
"MIT"
]
| 3 | 2022-01-13T03:45:18.000Z | 2022-03-12T00:57:25.000Z | DangdangRank/save_res.ipynb | zhbink/DangdangRank | 07a11de1d3a9ce5e1e0d3179f5a1b33100b5cb2f | [
"MIT"
]
| null | null | null | 36.104666 | 1,372 | 0.569956 | [
[
[
"import pymongo\nuri = \"mongodb://user1:MongoPassWd1@localhost:27017/\"\nclient = pymongo.MongoClient(uri, 27017)\ndb = client[\"DjangoServer\"]\ncol = db[\"dangdangBook\"]\ncol.estimated_document_count()",
"_____no_output_____"
],
[
"from bson import json_util \nimport json \nfrom bson import ObjectId\n\nclass JSONEncoder(json.JSONEncoder):\n \"\"\"处理ObjectId,该类型无法转为json\"\"\"\n def default(self, obj):\n if isinstance(obj, ObjectId):\n return str(obj)\n if isinstance(obj, datetime.datetime):\n return datetime.datetime.strftime(obj, '%Y-%m-%d %H:%M:%S')\n return json.JSONEncoder.default(self, obj)\n\nret_all = col.find({'book_name':'小王子'})\nlst = []\n\nfor ret in ret_all:\n ret = JSONEncoder(ensure_ascii=False).encode(ret)\n lst.append(ret)\n \nwith open('b.json', 'w', encoding='utf8') as json_file:\n json.dump(lst, json_file, ensure_ascii=False)",
"_____no_output_____"
],
[
"lst = list(col.find())\nimport pandas as pd\ndf = pd.DataFrame(lst)\ndf.to_pickle('a.pkl')\nimport pandas as pd\nb = pd.read_pickle('a.pkl')\nc = b[:10]\nc",
"_____no_output_____"
],
[
"from bs4 import BeautifulSoup\nimport requests\nheaders = {\n 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',\n 'Cookie': \"dest_area=country_id%3D9000%26province_id%3D111%26city_id%20%3D0%26district_id%3D0%26town_id%3D0; __permanent_id=20210512154623746232757573324420947; __visit_id=20210512154623747290487860872431240; __out_refer=1620805584%7C!%7Cwww.google.com.hk%7C!%7C; secret_key=c678ec4c9955d819a97c84a7606fda28; ddscreen=2; permanent_key=202105121557215846416956186de617; alipay_request_from=https://login.dangdang.com/signin.aspx?returnurl=http%253A//product.dangdang.com/25105726.html; __rpm=p_25105726...1620806240994%7Clogin_page.login_nolocal_mobile_div..1620806284555; USERNUM=7afn2DlXXMRAh7wXO8lg6w==; login.dangdang.com=.AYH=2021051215572205227690999&.ASPXAUTH=incqod/9NNx+A93OUEXKrFCQf9h2PIRXNf/GKJOOytGgahjg4CbwQA==; dangdang.com=email=MTgzMzI2NTY1MDAzNjI4N0BkZG1vYmlscGhvbmVfX3VzZXIuY29t&nickname=&display_id=2489274153678&customerid=LHcFQVLu5mnRLjof+Erviw==&viptype=MkzDXh7F+lA=&show_name=183%2A%2A%2A%2A6500; ddoy=email=1833265650036287%40ddmobilphone__user.com&nickname=&agree_date=1&validatedflag=0&uname=18332656500&utype=1&.ALFG=on&.ALTM=1620806284; sessionID=pc_b425763bb9cb47e97dc946f42fec14f95f8629044985e6e025d8ce00a91597fc; __dd_token_id=20210512155804775128630933e71fe8; LOGIN_TIME=1620806285979; __trace_id=20210512155822842100828995796889730; pos_6_start=1620806302879; pos_6_end=1620806303248\", # 登录B站后复制一下cookie中的SESSDATA字段,有效期1个月\n }\ncol2 = db[\"dangdang1\"]\nfor i, cur_row in b.iterrows():\n url = cur_row['url']\n print(url)\n r = requests.get(url,headers=headers)\n soup = BeautifulSoup(r.text, 'html.parser')\n cat = \"\"\n res = soup.select('#breadcrumb > a:nth-child(3)')\n if (len(res)):\n cat = res[0].text\n# cat = soup.select('#breadcrumb > a:nth-child(3)')[0].text\n print(cat, i)\n cur_row['cat'] = cat\n# print(i, cat, cur_row)\n col2.insert_one(dict(cur_row))",
"http://product.dangdang.com/26488700.html\n童书 0\nhttp://product.dangdang.com/25105726.html\n青春文学 1\nhttp://product.dangdang.com/25172573.html\n小说 2\nhttp://product.dangdang.com/26263139.html\n青春文学 3\nhttp://product.dangdang.com/22506353.html\n童书 4\nhttp://product.dangdang.com/23678069.html\n社会科学 5\nhttp://product.dangdang.com/26919639.html\n传记 6\nhttp://product.dangdang.com/24008167.html\n童书 7\nhttp://product.dangdang.com/20927266.html\n童书 8\nhttp://product.dangdang.com/20605371.html\n小说 9\nhttp://product.dangdang.com/25273781.html\n童书 10\nhttp://product.dangdang.com/23763621.html\n文学 11\nhttp://product.dangdang.com/25126137.html\n中小学教辅 12\nhttp://product.dangdang.com/28473192.html\n文学 13\nhttp://product.dangdang.com/23422952.html\n亲子/家教 14\nhttp://product.dangdang.com/23629643.html\n小说 15\nhttp://product.dangdang.com/26924000.html\n童书 16\nhttp://product.dangdang.com/23640199.html\n亲子/家教 17\nhttp://product.dangdang.com/27908003.html\n文化 18\nhttp://product.dangdang.com/27950672.html\n童书 19\nhttp://product.dangdang.com/25257603.html\n中小学教辅 20\nhttp://product.dangdang.com/20093876.html\n 21\nhttp://product.dangdang.com/27900798.html\n保健/养生 22\nhttp://product.dangdang.com/23812472.html\n童书 23\nhttp://product.dangdang.com/25220963.html\n管理 24\nhttp://product.dangdang.com/23568685.html\n古籍 25\nhttp://product.dangdang.com/27882152.html\n政治/军事 26\nhttp://product.dangdang.com/25342352.html\n童书 27\nhttp://product.dangdang.com/22800638.html\n中小学教辅 28\nhttp://product.dangdang.com/23828979.html\n童书 29\nhttp://product.dangdang.com/22781388.html\n管理 30\nhttp://product.dangdang.com/25323286.html\n童书 31\nhttp://product.dangdang.com/23487613.html\n童书 32\nhttp://product.dangdang.com/24187625.html\n中小学教辅 33\nhttp://product.dangdang.com/23954654.html\n文学 34\nhttp://product.dangdang.com/23618525.html\n中小学教辅 35\nhttp://product.dangdang.com/23368941.html\n童书 36\nhttp://product.dangdang.com/25301807.html\n小说 37\nhttp://product.dangdang.com/25184200.html\n童书 38\nhttp://product.dangdang.com/25287231.html\n心理学 39\nhttp://product.dangdang.com/24002578.html\n成功/励志 40\nhttp://product.dangdang.com/25547473.html\n童书 41\nhttp://product.dangdang.com/23174548.html\n童书 42\nhttp://product.dangdang.com/27852072.html\n童书 43\nhttp://product.dangdang.com/25315653.html\n童书 44\nhttp://product.dangdang.com/25583220.html\n历史 45\nhttp://product.dangdang.com/25146931.html\n小说 46\nhttp://product.dangdang.com/26241664.html\n管理 47\nhttp://product.dangdang.com/24170731.html\n小说 48\nhttp://product.dangdang.com/26436060.html\n成功/励志 49\nhttp://product.dangdang.com/27857250.html\n动漫/幽默 50\nhttp://product.dangdang.com/23643237.html\n中小学教辅 51\nhttp://product.dangdang.com/23776739.html\n童书 52\nhttp://product.dangdang.com/23326300.html\n 53\nhttp://product.dangdang.com/23474802.html\n 54\nhttp://product.dangdang.com/26924951.html\n经济 55\nhttp://product.dangdang.com/24229885.html\n中小学教辅 56\nhttp://product.dangdang.com/26923597.html\n亲子/家教 57\nhttp://product.dangdang.com/24167579.html\n小说 58\nhttp://product.dangdang.com/25280355.html\n童书 59\nhttp://product.dangdang.com/25176229.html\n童书 60\nhttp://product.dangdang.com/20975698.html\n小说 61\nhttp://product.dangdang.com/27871437.html\n成功/励志 62\nhttp://product.dangdang.com/23301044.html\n小说 63\nhttp://product.dangdang.com/23504060.html\n童书 64\nhttp://product.dangdang.com/23396665.html\n童书 65\nhttp://product.dangdang.com/23730173.html\n小说 66\nhttp://product.dangdang.com/25278830.html\n中小学教辅 67\nhttp://product.dangdang.com/25583530.html\n童书 68\nhttp://product.dangdang.com/23767677.html\n童书 69\nhttp://product.dangdang.com/25265074.html\n童书 70\nhttp://product.dangdang.com/23292645.html\n童书 71\nhttp://product.dangdang.com/23812473.html\n童书 72\nhttp://product.dangdang.com/26916193.html\n管理 73\nhttp://product.dangdang.com/24106554.html\n小说 74\nhttp://product.dangdang.com/23811754.html\n小说 75\nhttp://product.dangdang.com/27938272.html\n文学 76\nhttp://product.dangdang.com/25267314.html\n中小学教辅 77\nhttp://product.dangdang.com/26516204.html\n小说 78\nhttp://product.dangdang.com/22854395.html\n中小学教辅 79\nhttp://product.dangdang.com/25169361.html\n童书 80\nhttp://product.dangdang.com/25583206.html\n童书 81\nhttp://product.dangdang.com/25546179.html\n历史 82\nhttp://product.dangdang.com/25321845.html\n传记 83\nhttp://product.dangdang.com/25061584.html\n中小学教辅 84\nhttp://product.dangdang.com/25350593.html\n成功/励志 85\nhttp://product.dangdang.com/22800645.html\n中小学教辅 86\nhttp://product.dangdang.com/26923356.html\n青春文学 87\nhttp://product.dangdang.com/25257570.html\n中小学教辅 88\nhttp://product.dangdang.com/23920356.html\n历史 89\nhttp://product.dangdang.com/25067286.html\n动漫/幽默 90\nhttp://product.dangdang.com/25147357.html\n小说 91\nhttp://product.dangdang.com/26487694.html\n文学 92\nhttp://product.dangdang.com/22584137.html\n政治/军事 93\nhttp://product.dangdang.com/23292646.html\n童书 94\nhttp://product.dangdang.com/25257583.html\n中小学教辅 95\nhttp://product.dangdang.com/23808286.html\n文学 96\nhttp://product.dangdang.com/22800647.html\n中小学教辅 97\nhttp://product.dangdang.com/23967003.html\n童书 98\nhttp://product.dangdang.com/27913770.html\n童书 99\nhttp://product.dangdang.com/22547397.html\n童书 100\nhttp://product.dangdang.com/26513576.html\n童书 101\nhttp://product.dangdang.com/24043287.html\n小说 102\nhttp://product.dangdang.com/22545142.html\n童书 103\nhttp://product.dangdang.com/25086655.html\n文学 104\nhttp://product.dangdang.com/25280354.html\n童书 105\nhttp://product.dangdang.com/25146532.html\n政治/军事 106\nhttp://product.dangdang.com/25178748.html\n童书 107\nhttp://product.dangdang.com/23717136.html\n小说 108\nhttp://product.dangdang.com/23780305.html\n小说 109\nhttp://product.dangdang.com/24021172.html\n古籍 110\nhttp://product.dangdang.com/24193586.html\n童书 111\nhttp://product.dangdang.com/25201182.html\n小说 112\nhttp://product.dangdang.com/23379457.html\n中小学教辅 113\nhttp://product.dangdang.com/23964234.html\n科普读物 114\nhttp://product.dangdang.com/26914951.html\n哲学/宗教 115\nhttp://product.dangdang.com/23298283.html\n中小学教辅 116\nhttp://product.dangdang.com/24026197.html\n传记 117\nhttp://product.dangdang.com/25267186.html\n中小学教辅 118\nhttp://product.dangdang.com/24003310.html\n计算机/网络 119\nhttp://product.dangdang.com/21055821.html\n文学 120\nhttp://product.dangdang.com/23194043.html\n亲子/家教 121\nhttp://product.dangdang.com/25336322.html\n管理 122\nhttp://product.dangdang.com/23415029.html\n文学 123\nhttp://product.dangdang.com/23665180.html\n童书 124\nhttp://product.dangdang.com/25061583.html\n动漫/幽默 125\nhttp://product.dangdang.com/24105846.html\n童书 126\nhttp://product.dangdang.com/23415182.html\n童书 127\nhttp://product.dangdang.com/25353292.html\n童书 128\nhttp://product.dangdang.com/24215745.html\n社会科学 129\nhttp://product.dangdang.com/23331336.html\n亲子/家教 130\nhttp://product.dangdang.com/23692356.html\n管理 131\nhttp://product.dangdang.com/25352678.html\n童书 132\nhttp://product.dangdang.com/25283331.html\n亲子/家教 133\nhttp://product.dangdang.com/26445135.html\n成功/励志 134\nhttp://product.dangdang.com/23359376.html\n成功/励志 135\nhttp://product.dangdang.com/21091360.html\n童书 136\nhttp://product.dangdang.com/25122026.html\n中小学教辅 137\nhttp://product.dangdang.com/25584012.html\n成功/励志 138\nhttp://product.dangdang.com/23197949.html\n中小学教辅 139\nhttp://product.dangdang.com/25113732.html\n文化 140\nhttp://product.dangdang.com/24028342.html\n管理 141\nhttp://product.dangdang.com/26487439.html\n童书 142\nhttp://product.dangdang.com/23555432.html\n科普读物 143\nhttp://product.dangdang.com/23530913.html\n小说 144\nhttp://product.dangdang.com/25233927.html\n小说 145\nhttp://product.dangdang.com/25297030.html\n哲学/宗教 146\nhttp://product.dangdang.com/27885398.html\n管理 147\nhttp://product.dangdang.com/24167593.html\n童书 148\nhttp://product.dangdang.com/25216473.html\n童书 149\nhttp://product.dangdang.com/25181430.html\n中小学教辅 150\nhttp://product.dangdang.com/24104216.html\n童书 151\nhttp://product.dangdang.com/24183943.html\n小说 152\nhttp://product.dangdang.com/23798047.html\n童书 153\nhttp://product.dangdang.com/27887253.html\n成功/励志 154\nhttp://product.dangdang.com/23288237.html\n童书 155\nhttp://product.dangdang.com/22765017.html\n哲学/宗教 156\nhttp://product.dangdang.com/25279755.html\n小说 157\nhttp://product.dangdang.com/20948886.html\n童书 158\nhttp://product.dangdang.com/25230329.html\n童书 159\nhttp://product.dangdang.com/25325424.html\n童书 160\nhttp://product.dangdang.com/24188188.html\n小说 161\nhttp://product.dangdang.com/25081547.html\n 162\nhttp://product.dangdang.com/25309478.html\n童书 163\nhttp://product.dangdang.com/25069494.html\n童书 164\nhttp://product.dangdang.com/23898712.html\n文学 165\nhttp://product.dangdang.com/25268159.html\n"
],
[
"# 测试单页面\nurl = \"http://product.dangdang.com/20093876.html\"\nheaders = {\n 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',\n 'Cookie': \"dest_area=country_id%3D9000%26province_id%3D111%26city_id%20%3D0%26district_id%3D0%26town_id%3D0; __permanent_id=20210512154623746232757573324420947; __visit_id=20210512154623747290487860872431240; __out_refer=1620805584%7C!%7Cwww.google.com.hk%7C!%7C; secret_key=c678ec4c9955d819a97c84a7606fda28; ddscreen=2; permanent_key=202105121557215846416956186de617; alipay_request_from=https://login.dangdang.com/signin.aspx?returnurl=http%253A//product.dangdang.com/25105726.html; __rpm=p_25105726...1620806240994%7Clogin_page.login_nolocal_mobile_div..1620806284555; USERNUM=7afn2DlXXMRAh7wXO8lg6w==; login.dangdang.com=.AYH=2021051215572205227690999&.ASPXAUTH=incqod/9NNx+A93OUEXKrFCQf9h2PIRXNf/GKJOOytGgahjg4CbwQA==; dangdang.com=email=MTgzMzI2NTY1MDAzNjI4N0BkZG1vYmlscGhvbmVfX3VzZXIuY29t&nickname=&display_id=2489274153678&customerid=LHcFQVLu5mnRLjof+Erviw==&viptype=MkzDXh7F+lA=&show_name=183%2A%2A%2A%2A6500; ddoy=email=1833265650036287%40ddmobilphone__user.com&nickname=&agree_date=1&validatedflag=0&uname=18332656500&utype=1&.ALFG=on&.ALTM=1620806284; sessionID=pc_b425763bb9cb47e97dc946f42fec14f95f8629044985e6e025d8ce00a91597fc; __dd_token_id=20210512155804775128630933e71fe8; LOGIN_TIME=1620806285979; __trace_id=20210512155822842100828995796889730; pos_6_start=1620806302879; pos_6_end=1620806303248\", # 登录B站后复制一下cookie中的SESSDATA字段,有效期1个月\n }\nr = requests.get(url,headers=headers)\nsoup = BeautifulSoup(r.text, 'html.parser')\na = soup.select('#breadcrumb > a:nth-child(1)')",
"_____no_output_____"
],
[
"# 保存数据到pkl\nimport pymongo\nuri = \"mongodb://user1:MongoPassWd1@localhost:27017/\"\nclient = pymongo.MongoClient(uri, 27017)\ndb = client[\"DjangoServer\"]\ncol = db[\"dangdang1\"]\ncol.estimated_document_count()\n",
"_____no_output_____"
],
[
"lst = list(col.find())\nimport pandas as pd\ndf = pd.DataFrame(lst)\ndf.to_pickle('a2.pkl')",
"_____no_output_____"
],
[
"# 读pkl到df\nimport pandas as pd\nb2 = pd.read_pickle('a2.pkl')\nc = b2[:10]",
"_____no_output_____"
],
[
"c",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6a07ba5851197b33910ace315ca437981793c5 | 29,820 | ipynb | Jupyter Notebook | examples/sklearn/demo_grid_search_reduction_classification_sklearn.ipynb | sohiniu/AIF360 | 15c31fcd2f5b92b990d2b6f31718e0a90d4516ff | [
"Apache-2.0"
]
| null | null | null | examples/sklearn/demo_grid_search_reduction_classification_sklearn.ipynb | sohiniu/AIF360 | 15c31fcd2f5b92b990d2b6f31718e0a90d4516ff | [
"Apache-2.0"
]
| null | null | null | examples/sklearn/demo_grid_search_reduction_classification_sklearn.ipynb | sohiniu/AIF360 | 15c31fcd2f5b92b990d2b6f31718e0a90d4516ff | [
"Apache-2.0"
]
| null | null | null | 33.543307 | 387 | 0.384172 | [
[
[
"# Sklearn compatible Grid Search for classification\n\nGrid search is an in-processing technique that can be used for fair classification or fair regression. For classification it reduces fair classification to a sequence of cost-sensitive classification problems, returning the deterministic classifier with the lowest empirical error subject to fair classification constraints among\nthe candidates searched. The code for grid search wraps the source class `fairlearn.reductions.GridSearch` available in the https://github.com/fairlearn/fairlearn library, licensed under the MIT Licencse, Copyright Microsoft Corporation.",
"_____no_output_____"
]
],
[
[
"%matplotlib inline\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\n\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.model_selection import GridSearchCV, train_test_split\nfrom sklearn.preprocessing import OneHotEncoder\n\nfrom aif360.sklearn.inprocessing import GridSearchReduction\n\nfrom aif360.sklearn.datasets import fetch_adult\nfrom aif360.sklearn.metrics import disparate_impact_ratio, average_odds_error, generalized_fpr\nfrom aif360.sklearn.metrics import generalized_fnr, difference",
"_____no_output_____"
]
],
[
[
"### Loading data",
"_____no_output_____"
],
[
"Datasets are formatted as separate `X` (# samples x # features) and `y` (# samples x # labels) DataFrames. The index of each DataFrame contains protected attribute values per sample. Datasets may also load a `sample_weight` object to be used with certain algorithms/metrics. All of this makes it so that aif360 is compatible with scikit-learn objects.\n\nFor example, we can easily load the Adult dataset from UCI with the following line:",
"_____no_output_____"
]
],
[
[
"X, y, sample_weight = fetch_adult()\nX.head()",
"_____no_output_____"
],
[
"# there is one unused category ('Never-worked') that was dropped during dropna\nX.workclass.cat.remove_unused_categories(inplace=True)",
"_____no_output_____"
]
],
[
[
"We can then map the protected attributes to integers,",
"_____no_output_____"
]
],
[
[
"X.index = pd.MultiIndex.from_arrays(X.index.codes, names=X.index.names)\ny.index = pd.MultiIndex.from_arrays(y.index.codes, names=y.index.names)",
"_____no_output_____"
]
],
[
[
"and the target classes to 0/1,",
"_____no_output_____"
]
],
[
[
"y = pd.Series(y.factorize(sort=True)[0], index=y.index)",
"_____no_output_____"
]
],
[
[
"split the dataset,",
"_____no_output_____"
]
],
[
[
"(X_train, X_test,\n y_train, y_test) = train_test_split(X, y, train_size=0.7, random_state=1234567)",
"_____no_output_____"
]
],
[
[
"We use Pandas for one-hot encoding for easy reference to columns associated with protected attributes, information necessary for grid search reduction.",
"_____no_output_____"
]
],
[
[
"X_train, X_test = pd.get_dummies(X_train), pd.get_dummies(X_test)\nX_train.head()",
"_____no_output_____"
]
],
[
[
"The protected attribute information is also replicated in the labels:",
"_____no_output_____"
]
],
[
[
"y_train.head()",
"_____no_output_____"
]
],
[
[
"### Running metrics",
"_____no_output_____"
],
[
"With the data in this format, we can easily train a scikit-learn model and get predictions for the test data:",
"_____no_output_____"
]
],
[
[
"y_pred = LogisticRegression(solver='lbfgs').fit(X_train, y_train).predict(X_test)\nlr_acc = accuracy_score(y_test, y_pred)\nprint(lr_acc)",
"0.8373258642293802\n"
]
],
[
[
"We can assess how close the predictions are to equality of odds.\n\n`average_odds_error()` computes the (unweighted) average of the absolute values of the true positive rate (TPR) difference and false positive rate (FPR) difference, i.e.:\n\n$$ \\tfrac{1}{2}\\left(|FPR_{D = \\text{unprivileged}} - FPR_{D = \\text{privileged}}| + |TPR_{D = \\text{unprivileged}} - TPR_{D = \\text{privileged}}|\\right) $$",
"_____no_output_____"
]
],
[
[
"lr_aoe = average_odds_error(y_test, y_pred, prot_attr='sex')\nprint(lr_aoe)",
"0.10043769764182503\n"
]
],
[
[
"### Grid Search",
"_____no_output_____"
],
[
"Choose a base model for the candidate classifiers. Base models should implement a fit method that can take a sample weight as input. For details refer to the docs. ",
"_____no_output_____"
]
],
[
[
"estimator = LogisticRegression(solver='lbfgs')",
"_____no_output_____"
]
],
[
[
"Determine the columns associated with the protected attribute(s). Grid search can handle more then one attribute but it is computationally expensive. A similar method with less computational overhead is exponentiated gradient reduction, detailed at [examples/sklearn/demo_exponentiated_gradient_reduction_sklearn.ipynb](sklearn/demo_exponentiated_gradient_reduction_sklearn.ipynb).",
"_____no_output_____"
]
],
[
[
"prot_attr_cols = [colname for colname in X_train if \"sex\" in colname]",
"_____no_output_____"
]
],
[
[
"Search for the best classifier and observe test accuracy. Other options for `constraints` include \"DemographicParity,\" \"TruePositiveRateDifference\", and \"ErrorRateRatio.\"",
"_____no_output_____"
]
],
[
[
"np.random.seed(0) #need for reproducibility\ngrid_search_red = GridSearchReduction(prot_attr_cols=prot_attr_cols, \n estimator=estimator, \n constraints=\"EqualizedOdds\",\n grid_size=20,\n drop_prot_attr=False)\ngrid_search_red.fit(X_train, y_train)\ngs_acc = grid_search_red.score(X_test, y_test)\nprint(gs_acc)\n\n#Check if accuracy is comparable\nassert abs(lr_acc-gs_acc)<0.03",
"0.8318714527898577\n"
],
[
"gs_aoe = average_odds_error(y_test, grid_search_red.predict(X_test), prot_attr='sex')\nprint(gs_aoe)\n\n#Check if average odds error improved\nassert gs_aoe<lr_aoe",
"0.0551512399603683\n"
]
],
[
[
"Instead of passing in a value for `constraints`, we can also pass a `fairlearn.reductions.moment` object in for `constraints_moment`. You could use a predefined moment as we do below or create a custom moment using the fairlearn library.",
"_____no_output_____"
]
],
[
[
"import fairlearn.reductions as red \n\nnp.random.seed(0) #need for reproducibility\ngrid_search_red = GridSearchReduction(prot_attr_cols=prot_attr_cols, \n estimator=estimator, \n constraints_moment=red.EqualizedOdds(),\n grid_size=20,\n drop_prot_attr=False)\ngrid_search_red.fit(X_train, y_train)\ngrid_search_red.score(X_test, y_test)",
"_____no_output_____"
],
[
"average_odds_error(y_test, grid_search_red.predict(X_test), prot_attr='sex')",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb6a0e78bb467b6ef0db4c3ee2563ee7ada7757e | 122,933 | ipynb | Jupyter Notebook | jsl/demos/kalman_sampling_demo.ipynb | probml/JSL | e494ddf879aad9fc4d3b7739b5d9ac12365fa440 | [
"MIT"
]
| 23 | 2021-12-29T19:45:23.000Z | 2022-03-31T07:21:32.000Z | jsl/demos/kalman_sampling_demo.ipynb | probml/JSL | e494ddf879aad9fc4d3b7739b5d9ac12365fa440 | [
"MIT"
]
| 23 | 2021-12-22T18:23:08.000Z | 2022-03-23T23:05:53.000Z | jsl/demos/kalman_sampling_demo.ipynb | probml/JSL | e494ddf879aad9fc4d3b7739b5d9ac12365fa440 | [
"MIT"
]
| 5 | 2022-03-10T04:26:09.000Z | 2022-03-22T13:23:32.000Z | 256.645094 | 75,701 | 0.876876 | [
[
[
"<a href=\"https://colab.research.google.com/github/probml/JSL/blob/main/jsl/demos/kalman_sampling_demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
]
],
[
[
"!pip install --upgrade git+https://github.com/google/flax.git\n!pip install --upgrade tensorflow-probability\n!pip install git+https://github.com/blackjax-devs/blackjax.git\n!pip install git+https://github.com/deepmind/distrax.git\n\n\n",
"Collecting git+https://github.com/google/flax.git\n Cloning https://github.com/google/flax.git to /tmp/pip-req-build-0hwmt6g7\n Running command git clone -q https://github.com/google/flax.git /tmp/pip-req-build-0hwmt6g7\nRequirement already satisfied: numpy>=1.12 in /usr/local/lib/python3.7/dist-packages (from flax==0.4.1) (1.21.6)\nRequirement already satisfied: jax>=0.3 in /usr/local/lib/python3.7/dist-packages (from flax==0.4.1) (0.3.4)\nRequirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from flax==0.4.1) (3.2.2)\nRequirement already satisfied: msgpack in /usr/local/lib/python3.7/dist-packages (from flax==0.4.1) (1.0.3)\nCollecting optax\n Downloading optax-0.1.2-py3-none-any.whl (140 kB)\n\u001b[K |████████████████████████████████| 140 kB 26.5 MB/s \n\u001b[?25hRequirement already satisfied: typing_extensions>=4.1.1 in /usr/local/lib/python3.7/dist-packages (from flax==0.4.1) (4.1.1)\nRequirement already satisfied: opt-einsum in /usr/local/lib/python3.7/dist-packages (from jax>=0.3->flax==0.4.1) (3.3.0)\nRequirement already satisfied: scipy>=1.2.1 in /usr/local/lib/python3.7/dist-packages (from jax>=0.3->flax==0.4.1) (1.4.1)\nRequirement already satisfied: absl-py in /usr/local/lib/python3.7/dist-packages (from jax>=0.3->flax==0.4.1) (1.0.0)\nRequirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from absl-py->jax>=0.3->flax==0.4.1) (1.15.0)\nRequirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->flax==0.4.1) (2.8.2)\nRequirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->flax==0.4.1) (1.4.2)\nRequirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->flax==0.4.1) (0.11.0)\nRequirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->flax==0.4.1) (3.0.8)\nCollecting chex>=0.0.4\n Downloading chex-0.1.3-py3-none-any.whl (72 kB)\n\u001b[K |████████████████████████████████| 72 kB 652 kB/s \n\u001b[?25hRequirement already satisfied: jaxlib>=0.1.37 in /usr/local/lib/python3.7/dist-packages (from optax->flax==0.4.1) (0.3.2+cuda11.cudnn805)\nRequirement already satisfied: dm-tree>=0.1.5 in /usr/local/lib/python3.7/dist-packages (from chex>=0.0.4->optax->flax==0.4.1) (0.1.7)\nRequirement already satisfied: toolz>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from chex>=0.0.4->optax->flax==0.4.1) (0.11.2)\nRequirement already satisfied: flatbuffers<3.0,>=1.12 in /usr/local/lib/python3.7/dist-packages (from jaxlib>=0.1.37->optax->flax==0.4.1) (2.0)\nBuilding wheels for collected packages: flax\n Building wheel for flax (setup.py) ... \u001b[?25l\u001b[?25hdone\n Created wheel for flax: filename=flax-0.4.1-py3-none-any.whl size=186136 sha256=d5342ce8fc05dd73f0d01481e21ff3a682569ac0590c7d85a087d7e2d9c4b1e0\n Stored in directory: /tmp/pip-ephem-wheel-cache-wxzz5v1l/wheels/3e/9e/df/f792f5b2c0d0ccf00f3c1286bc060dab7cb2a4af5134d1c5b4\nSuccessfully built flax\nInstalling collected packages: chex, optax, flax\nSuccessfully installed chex-0.1.3 flax-0.4.1 optax-0.1.2\nRequirement already satisfied: tensorflow-probability in /usr/local/lib/python3.7/dist-packages (0.16.0)\nRequirement already satisfied: dm-tree in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability) (0.1.7)\nRequirement already satisfied: decorator in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability) (4.4.2)\nRequirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability) (1.21.6)\nRequirement already satisfied: cloudpickle>=1.3 in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability) (1.3.0)\nRequirement already satisfied: absl-py in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability) (1.0.0)\nRequirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability) (1.15.0)\nRequirement already satisfied: gast>=0.3.2 in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability) (0.5.3)\nCollecting git+https://github.com/blackjax-devs/blackjax.git\n Cloning https://github.com/blackjax-devs/blackjax.git to /tmp/pip-req-build-oti4y44s\n Running command git clone -q https://github.com/blackjax-devs/blackjax.git /tmp/pip-req-build-oti4y44s\nRequirement already satisfied: fastprogress>=0.2.0 in /usr/local/lib/python3.7/dist-packages (from blackjax==0.4.0) (1.0.2)\nBuilding wheels for collected packages: blackjax\n Building wheel for blackjax (setup.py) ... \u001b[?25l\u001b[?25hdone\n Created wheel for blackjax: filename=blackjax-0.4.0-py3-none-any.whl size=77597 sha256=4799295243baf5fd17b8c418402030f792e6fa602de320d7853a3c665ed35298\n Stored in directory: /tmp/pip-ephem-wheel-cache-1o74sggy/wheels/8f/53/91/7460390e5f6442104728ae1c475ad03edb990afe2c5924eee7\nSuccessfully built blackjax\nInstalling collected packages: blackjax\nSuccessfully installed blackjax-0.4.0\nCollecting git+https://github.com/deepmind/distrax.git\n Cloning https://github.com/deepmind/distrax.git to /tmp/pip-req-build-rp8u5yfl\n Running command git clone -q https://github.com/deepmind/distrax.git /tmp/pip-req-build-rp8u5yfl\nRequirement already satisfied: absl-py>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from distrax==0.1.2) (1.0.0)\nRequirement already satisfied: chex>=0.0.7 in /usr/local/lib/python3.7/dist-packages (from distrax==0.1.2) (0.1.3)\nRequirement already satisfied: jax>=0.1.55 in /usr/local/lib/python3.7/dist-packages (from distrax==0.1.2) (0.3.4)\nRequirement already satisfied: jaxlib>=0.1.67 in /usr/local/lib/python3.7/dist-packages (from distrax==0.1.2) (0.3.2+cuda11.cudnn805)\nRequirement already satisfied: numpy>=1.18.0 in /usr/local/lib/python3.7/dist-packages (from distrax==0.1.2) (1.21.6)\nRequirement already satisfied: tensorflow-probability>=0.15.0 in /usr/local/lib/python3.7/dist-packages (from distrax==0.1.2) (0.16.0)\nRequirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from absl-py>=0.9.0->distrax==0.1.2) (1.15.0)\nRequirement already satisfied: dm-tree>=0.1.5 in /usr/local/lib/python3.7/dist-packages (from chex>=0.0.7->distrax==0.1.2) (0.1.7)\nRequirement already satisfied: toolz>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from chex>=0.0.7->distrax==0.1.2) (0.11.2)\nRequirement already satisfied: opt-einsum in /usr/local/lib/python3.7/dist-packages (from jax>=0.1.55->distrax==0.1.2) (3.3.0)\nRequirement already satisfied: scipy>=1.2.1 in /usr/local/lib/python3.7/dist-packages (from jax>=0.1.55->distrax==0.1.2) (1.4.1)\nRequirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from jax>=0.1.55->distrax==0.1.2) (4.1.1)\nRequirement already satisfied: flatbuffers<3.0,>=1.12 in /usr/local/lib/python3.7/dist-packages (from jaxlib>=0.1.67->distrax==0.1.2) (2.0)\nRequirement already satisfied: cloudpickle>=1.3 in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability>=0.15.0->distrax==0.1.2) (1.3.0)\nRequirement already satisfied: gast>=0.3.2 in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability>=0.15.0->distrax==0.1.2) (0.5.3)\nRequirement already satisfied: decorator in /usr/local/lib/python3.7/dist-packages (from tensorflow-probability>=0.15.0->distrax==0.1.2) (4.4.2)\nBuilding wheels for collected packages: distrax\n Building wheel for distrax (setup.py) ... \u001b[?25l\u001b[?25hdone\n Created wheel for distrax: filename=distrax-0.1.2-py3-none-any.whl size=285458 sha256=10254e80c4d8163b6ad3fdf771427dcc7a04cf41d822e9932a4f63bd6e1bbad3\n Stored in directory: /tmp/pip-ephem-wheel-cache-ctz_o38h/wheels/34/f4/34/7d0bc13db0a98b0f2da8d8254a04d4d2ff1076bfe495cfb34e\nSuccessfully built distrax\nInstalling collected packages: distrax\nSuccessfully installed distrax-0.1.2\n"
],
[
"!git clone https://github.com/probml/JSL.git\n%cd JSL\n!pip install -e .",
"Cloning into 'JSL'...\nremote: Enumerating objects: 1881, done.\u001b[K\nremote: Counting objects: 0% (1/1881)\u001b[K\rremote: Counting objects: 1% (19/1881)\u001b[K\rremote: Counting objects: 2% (38/1881)\u001b[K\rremote: Counting objects: 3% (57/1881)\u001b[K\rremote: Counting objects: 4% (76/1881)\u001b[K\rremote: Counting objects: 5% (95/1881)\u001b[K\rremote: Counting objects: 6% (113/1881)\u001b[K\rremote: Counting objects: 7% (132/1881)\u001b[K\rremote: Counting objects: 8% (151/1881)\u001b[K\rremote: Counting objects: 9% (170/1881)\u001b[K\rremote: Counting objects: 10% (189/1881)\u001b[K\rremote: Counting objects: 11% (207/1881)\u001b[K\rremote: Counting objects: 12% (226/1881)\u001b[K\rremote: Counting objects: 13% (245/1881)\u001b[K\rremote: Counting objects: 14% (264/1881)\u001b[K\rremote: Counting objects: 15% (283/1881)\u001b[K\rremote: Counting objects: 16% (301/1881)\u001b[K\rremote: Counting objects: 17% (320/1881)\u001b[K\rremote: Counting objects: 18% (339/1881)\u001b[K\rremote: Counting objects: 19% (358/1881)\u001b[K\rremote: Counting objects: 20% (377/1881)\u001b[K\rremote: Counting objects: 21% (396/1881)\u001b[K\rremote: Counting objects: 22% (414/1881)\u001b[K\rremote: Counting objects: 23% (433/1881)\u001b[K\rremote: Counting objects: 24% (452/1881)\u001b[K\rremote: Counting objects: 25% (471/1881)\u001b[K\rremote: Counting objects: 26% (490/1881)\u001b[K\rremote: Counting objects: 27% (508/1881)\u001b[K\rremote: Counting objects: 28% (527/1881)\u001b[K\rremote: Counting objects: 29% (546/1881)\u001b[K\rremote: Counting objects: 30% (565/1881)\u001b[K\rremote: Counting objects: 31% (584/1881)\u001b[K\rremote: Counting objects: 32% (602/1881)\u001b[K\rremote: Counting objects: 33% (621/1881)\u001b[K\rremote: Counting objects: 34% (640/1881)\u001b[K\rremote: Counting objects: 35% (659/1881)\u001b[K\rremote: Counting objects: 36% (678/1881)\u001b[K\rremote: Counting objects: 37% (696/1881)\u001b[K\rremote: Counting objects: 38% (715/1881)\u001b[K\rremote: Counting objects: 39% (734/1881)\u001b[K\rremote: Counting objects: 40% (753/1881)\u001b[K\rremote: Counting objects: 41% (772/1881)\u001b[K\rremote: Counting objects: 42% (791/1881)\u001b[K\rremote: Counting objects: 43% (809/1881)\u001b[K\rremote: Counting objects: 44% (828/1881)\u001b[K\rremote: Counting objects: 45% (847/1881)\u001b[K\rremote: Counting objects: 46% (866/1881)\u001b[K\rremote: Counting objects: 47% (885/1881)\u001b[K\rremote: Counting objects: 48% (903/1881)\u001b[K\rremote: Counting objects: 49% (922/1881)\u001b[K\rremote: Counting objects: 50% (941/1881)\u001b[K\rremote: Counting objects: 51% (960/1881)\u001b[K\rremote: Counting objects: 52% (979/1881)\u001b[K\rremote: Counting objects: 53% (997/1881)\u001b[K\rremote: Counting objects: 54% (1016/1881)\u001b[K\rremote: Counting objects: 55% (1035/1881)\u001b[K\rremote: Counting objects: 56% (1054/1881)\u001b[K\rremote: Counting objects: 57% (1073/1881)\u001b[K\rremote: Counting objects: 58% (1091/1881)\u001b[K\rremote: Counting objects: 59% (1110/1881)\u001b[K\rremote: Counting objects: 60% (1129/1881)\u001b[K\rremote: Counting objects: 61% (1148/1881)\u001b[K\rremote: Counting objects: 62% (1167/1881)\u001b[K\rremote: Counting objects: 63% (1186/1881)\u001b[K\rremote: Counting objects: 64% (1204/1881)\u001b[K\rremote: Counting objects: 65% (1223/1881)\u001b[K\rremote: Counting objects: 66% (1242/1881)\u001b[K\rremote: Counting objects: 67% (1261/1881)\u001b[K\rremote: Counting objects: 68% (1280/1881)\u001b[K\rremote: Counting objects: 69% (1298/1881)\u001b[K\rremote: Counting objects: 70% (1317/1881)\u001b[K\rremote: Counting objects: 71% (1336/1881)\u001b[K\rremote: Counting objects: 72% (1355/1881)\u001b[K\rremote: Counting objects: 73% (1374/1881)\u001b[K\rremote: Counting objects: 74% (1392/1881)\u001b[K\rremote: Counting objects: 75% (1411/1881)\u001b[K\rremote: Counting objects: 76% (1430/1881)\u001b[K\rremote: Counting objects: 77% (1449/1881)\u001b[K\rremote: Counting objects: 78% (1468/1881)\u001b[K\rremote: Counting objects: 79% (1486/1881)\u001b[K\rremote: Counting objects: 80% (1505/1881)\u001b[K\rremote: Counting objects: 81% (1524/1881)\u001b[K\rremote: Counting objects: 82% (1543/1881)\u001b[K\rremote: Counting objects: 83% (1562/1881)\u001b[K\rremote: Counting objects: 84% (1581/1881)\u001b[K\rremote: Counting objects: 85% (1599/1881)\u001b[K\rremote: Counting objects: 86% (1618/1881)\u001b[K\rremote: Counting objects: 87% (1637/1881)\u001b[K\rremote: Counting objects: 88% (1656/1881)\u001b[K\rremote: Counting objects: 89% (1675/1881)\u001b[K\rremote: Counting objects: 90% (1693/1881)\u001b[K\rremote: Counting objects: 91% (1712/1881)\u001b[K\rremote: Counting objects: 92% (1731/1881)\u001b[K\rremote: Counting objects: 93% (1750/1881)\u001b[K\rremote: Counting objects: 94% (1769/1881)\u001b[K\rremote: Counting objects: 95% (1787/1881)\u001b[K\rremote: Counting objects: 96% (1806/1881)\u001b[K\rremote: Counting objects: 97% (1825/1881)\u001b[K\rremote: Counting objects: 98% (1844/1881)\u001b[K\rremote: Counting objects: 99% (1863/1881)\u001b[K\rremote: Counting objects: 100% (1881/1881)\u001b[K\rremote: Counting objects: 100% (1881/1881), done.\u001b[K\nremote: Compressing objects: 100% (609/609), done.\u001b[K\nremote: Total 1881 (delta 1254), reused 1854 (delta 1242), pack-reused 0\u001b[K\nReceiving objects: 100% (1881/1881), 6.57 MiB | 30.72 MiB/s, done.\nResolving deltas: 100% (1254/1254), done.\n/content/JSL\nObtaining file:///content/JSL\nRequirement already satisfied: chex in /usr/local/lib/python3.7/dist-packages (from jsl==0.0.0) (0.1.3)\nCollecting dataclasses\n Downloading dataclasses-0.6-py3-none-any.whl (14 kB)\nRequirement already satisfied: jaxlib in /usr/local/lib/python3.7/dist-packages (from jsl==0.0.0) (0.3.2+cuda11.cudnn805)\nRequirement already satisfied: jax in /usr/local/lib/python3.7/dist-packages (from jsl==0.0.0) (0.3.4)\nRequirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from jsl==0.0.0) (3.2.2)\nRequirement already satisfied: tensorflow_probability in /usr/local/lib/python3.7/dist-packages (from jsl==0.0.0) (0.16.0)\nRequirement already satisfied: absl-py>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from chex->jsl==0.0.0) (1.0.0)\nRequirement already satisfied: toolz>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from chex->jsl==0.0.0) (0.11.2)\nRequirement already satisfied: dm-tree>=0.1.5 in /usr/local/lib/python3.7/dist-packages (from chex->jsl==0.0.0) (0.1.7)\nRequirement already satisfied: numpy>=1.18.0 in /usr/local/lib/python3.7/dist-packages (from chex->jsl==0.0.0) (1.21.6)\nRequirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from absl-py>=0.9.0->chex->jsl==0.0.0) (1.15.0)\nRequirement already satisfied: opt-einsum in /usr/local/lib/python3.7/dist-packages (from jax->jsl==0.0.0) (3.3.0)\nRequirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from jax->jsl==0.0.0) (4.1.1)\nRequirement already satisfied: scipy>=1.2.1 in /usr/local/lib/python3.7/dist-packages (from jax->jsl==0.0.0) (1.4.1)\nRequirement already satisfied: flatbuffers<3.0,>=1.12 in /usr/local/lib/python3.7/dist-packages (from jaxlib->jsl==0.0.0) (2.0)\nRequirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->jsl==0.0.0) (1.4.2)\nRequirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->jsl==0.0.0) (2.8.2)\nRequirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->jsl==0.0.0) (3.0.8)\nRequirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->jsl==0.0.0) (0.11.0)\nRequirement already satisfied: decorator in /usr/local/lib/python3.7/dist-packages (from tensorflow_probability->jsl==0.0.0) (4.4.2)\nRequirement already satisfied: gast>=0.3.2 in /usr/local/lib/python3.7/dist-packages (from tensorflow_probability->jsl==0.0.0) (0.5.3)\nRequirement already satisfied: cloudpickle>=1.3 in /usr/local/lib/python3.7/dist-packages (from tensorflow_probability->jsl==0.0.0) (1.3.0)\nInstalling collected packages: dataclasses, jsl\n Running setup.py develop for jsl\nSuccessfully installed dataclasses-0.6 jsl-0.0.0\n"
],
[
"%run jsl/demos/lds_sampling_demo.py\n",
"WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)\n"
],
[
"\nimport jax \nfrom cProfile import label\nimport jax.numpy as jnp\nfrom jax.random import PRNGKey\nimport tensorflow_probability as tfp\nimport tensorflow as tf\ntfd = tfp.distributions\nimport matplotlib.pyplot as plt\n\nfrom jsl.lds.kalman_filter import LDS, kalman_filter\nfrom jsl.lds.kalman_sampler import smooth_sampler\n",
"_____no_output_____"
],
[
"# tensorflow_probability\nndims = 1\nstep_std = 1.0\nnoise_std = 5.0\nmodel = tfd.LinearGaussianStateSpaceModel(\n num_timesteps=100,\n transition_matrix=tf.linalg.LinearOperatorDiag(jnp.array([1.01])),\n transition_noise=tfd.MultivariateNormalDiag(\n scale_diag=step_std * tf.ones([ndims])),\n observation_matrix=tf.linalg.LinearOperatorIdentity(ndims),\n observation_noise=tfd.MultivariateNormalDiag(\n scale_diag=noise_std * tf.ones([ndims])),\n initial_state_prior=tfd.MultivariateNormalDiag(loc=jnp.array([5.0]),\n scale_diag=tf.ones([ndims])))\n\n# Sample 1 sequence from the prior of the LDS\ny = model.sample(seed=(1,2)) \n\nnsamples = 2000\n\nsmps = model.posterior_sample(y, sample_shape=nsamples)\ns_tf = jnp.array(smps[:,:,0])\n\nmean_tf = jnp.mean(s_tf, axis=0)\n\nprint(s_tf.shape)\nprint(mean_tf.shape)",
"(2000, 100)\n(100,)\n"
],
[
"# Define the same model as an LDS object defined in the kalman_filter file \nA = jnp.eye(1) * 1.01\nC = jnp.eye(1)\nQ = jnp.eye(1)\nR = jnp.eye(1) * 25.0\nmu0 = jnp.array([5.0])\nSigma0 = jnp.eye(1)\nmodel_lds = LDS(A, C, Q, R, mu0, Sigma0)\n# Run the Kalman filter algorithm first\nmu_hist, Sigma_hist, mu_cond_hist, Sigma_cond_hist = kalman_filter(model_lds, jnp.array(y))\n# Sample backwards using the smoothing posterior\nsmooth_sample = smooth_sampler(model_lds, PRNGKey(0), mu_hist, Sigma_hist, n_samples=nsamples)\ns_jax = smooth_sample[:,:,0]\n\nmean_jax = jnp.mean(s_jax, axis=0)\n\nprint(s_jax.shape)\nprint(mean_jax.shape)",
"(2000, 100)\n(100,)\n"
],
[
"\nplt.figure()\nplt.plot(mean_tf, label='tf')\nplt.plot(mean_jax, label='jsl')\nplt.legend()\nplt.show()",
"_____no_output_____"
],
[
"jnp.max(mean_tf - mean_jax)",
"_____no_output_____"
],
[
"mean_tf - mean_jax",
"_____no_output_____"
],
[
"",
"_____no_output_____"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6a1e816c06473edd47c49105af7bdff23b75e6 | 3,538 | ipynb | Jupyter Notebook | examples/custom_types.ipynb | fabricebrito/CWLJNIKernel | c87d9d1ae326bb198c4b8e14836ce934b9841c0d | [
"Apache-2.0"
]
| 4 | 2020-02-28T16:03:26.000Z | 2021-03-28T12:58:25.000Z | examples/custom_types.ipynb | fabricebrito/CWLJNIKernel | c87d9d1ae326bb198c4b8e14836ce934b9841c0d | [
"Apache-2.0"
]
| 1 | 2020-12-09T11:06:42.000Z | 2020-12-09T19:08:23.000Z | examples/custom_types.ipynb | fabricebrito/CWLJNIKernel | c87d9d1ae326bb198c4b8e14836ce934b9841c0d | [
"Apache-2.0"
]
| 3 | 2020-04-10T15:09:11.000Z | 2020-12-09T11:26:24.000Z | 24.915493 | 94 | 0.522046 | [
[
[
"empty"
]
]
]
| [
"empty"
]
| [
[
"empty"
]
]
|
cb6a3ed4fa19797a027008c4be0a849a16b7d665 | 359,317 | ipynb | Jupyter Notebook | _notebooks/2021-08-21-ReverseModeAutoDiff.ipynb | saibaba/fastpages | b2ce8ee66402898ac29d2179951fe9069a7ed0be | [
"Apache-2.0"
]
| null | null | null | _notebooks/2021-08-21-ReverseModeAutoDiff.ipynb | saibaba/fastpages | b2ce8ee66402898ac29d2179951fe9069a7ed0be | [
"Apache-2.0"
]
| 1 | 2021-07-29T20:57:23.000Z | 2021-07-29T20:57:23.000Z | _notebooks/2021-08-21-ReverseModeAutoDiff.ipynb | saibaba/fastpages | b2ce8ee66402898ac29d2179951fe9069a7ed0be | [
"Apache-2.0"
]
| null | null | null | 347.166184 | 57,000 | 0.930031 | [
[
[
"# \"Reverse mode autodiff\"\n> \"Understand how machine learning frameworks implement autodiff\"\n\n- toc:true\n- branch: master\n- badges: true\n- comments: true\n- author: Saibaba Telukunta\n- categories: [autodiff, autograd, gradient, partial-derivative, chain-rule]",
"_____no_output_____"
],
[
"Introduction\n--",
"_____no_output_____"
],
[
"Gradient descent (GD) is the main workhorse of deep neural networks. When you work with higher level machine learning frameworks like Pytorch or Tensorflow, it is hidden under the layers and you do not get to understand or appreciate how it works. The GD itself is implemented using something called reverse mode AD (called autodiff in rest of the doc).\n\nWhen you start using the low level libraries in pytorch or tensorflow you end up using constructs like `forward`, `backward`, `tape` and so on. Following is my attempt to demystify autodiff starting from ground up as well as to gain an understading of these terms.\n\nThis article proceeds as below:\n* Starts from hard-coded gradient calculation for a loss function in estimating a parameter for a model. \n* Add reverse mode autodiff functionality to demonstrate how it can generically calculate the (partial) derivative of a loss function.\n* Pytorch built-in autograd is used to demonstrate the same features.\n* For comparison, the same functionality is implemented using tensorflow.\n",
"_____no_output_____"
],
[
"**Sample problem**\n\nThe problem being tackled is to estimate the exponent of a function $y = f(x) = x^\\theta$ from a set of sample $(x_i, y_i)$.\n\nLet's use the RMSE as the loss function and want to find the $\\theta$ that minimizes it:\n\nRMSE loss = $L(\\theta) = \\sqrt{\\frac{\\sum_{i=1}^n (x_i^\\theta - y_i)^2}{n}}$",
"_____no_output_____"
],
[
"So, its gradient:\n\n$\\frac{\\partial L}{\\partial \\theta} = \\frac{1}{2} \\frac{\\frac{1}{n} \\sum_{i=1}^n 2 (x_i^\\theta - y_i) ln(x_i) x_i^\\theta}{\\sqrt{\\frac{\\sum_{i=1}^n (x_i^\\theta - y_i)^2}{n}}}$\n\nAbove gradient when used in batch gradient descent, we use below equation to update $\\theta$:\n\n$\\theta^{new} = \\theta^{old} - lr * \\frac{\\partial L}{\\partial \\theta}$",
"_____no_output_____"
],
[
"In stochastic gradient descent (SGD), gradient is calculated and the current $\\theta$ is updated for each of the training samples, so it simplifies to:\n\nRMSE loss for sample, i = $L_i(\\theta) = \\sqrt{(x_i^\\theta - y_i)^2}$\n\n$\\frac{\\partial L_i}{\\partial \\theta} = \\frac{1}{2} \\frac{2 (x_i^\\theta - y_i) ln(x_i) x_i^\\theta}{\\sqrt{(x_i^\\theta - y_i)^2}}$\n\n(Let's ignore for now that we really do not need to take square root in this case since there is only one sample).\n\n$\\theta^{new} = \\theta^{old} - lr * \\frac{\\partial L_i}{\\partial \\theta}$",
"_____no_output_____"
],
[
"First let's create some sample data from the actual model.\n",
"_____no_output_____"
]
],
[
[
"import torch\n\ndef sample(count, theta):\n xs = torch.rand(count) * 10\n ys = xs.pow(theta)\n return xs, ys\n\nx_train, y_train = sample(10, 1.5)",
"_____no_output_____"
]
],
[
[
"So the actual value of $\\theta$ is 1.5 and we are going to estimate it from the samples.\n\nFollowing is a utility function to plot losses and exponent discovered in each epoch.",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\n%matplotlib inline\n\ndef plot_loss_and_exponent(loss_history, theta_history):\n fig = plt.figure(figsize=(15, 10))\n\n ax1 = fig.add_subplot(121)\n ax2 = fig.add_subplot(122)\n\n for ax in [ax1, ax2]:\n ax.spines[\"top\"].set_visible(False)\n ax.spines[\"right\"].set_visible(False)\n ax.spines[\"left\"].set_visible(False)\n ax.spines[\"bottom\"].set_visible(False)\n ax.grid(color='b', linestyle='--', linewidth=0.5, alpha=0.3)\n ax.tick_params(direction='out', color='b', width='2')\n \n ax1.set_title('Loss(RMSE)')\n ax2.set_title('Exponent')\n ax1.plot(np.arange(len(loss_history)), loss_history)\n ax2.plot(np.arange(len(theta_history)), theta_history)",
"_____no_output_____"
]
],
[
[
"Naive solution with hand coded gradient descent\n---\n\nFirst we build our own function that calculates gradient descent directly using above formula.",
"_____no_output_____"
]
],
[
[
"def dLoss(x, y, theta_hat):\n n = len(x)\n w = (x.pow(theta_hat) - y) * torch.log(x) * x.pow(theta_hat)\n num = torch.sum(w)/n\n z = (x.pow(theta_hat) - y).pow(2)\n denom = torch.sqrt(sum(z)/n)\n return num/denom",
"_____no_output_____"
]
],
[
[
"**Batch GD**\n\nHere all data is used per update of $\\theta$.",
"_____no_output_____"
]
],
[
[
"import torch\nfrom torch.autograd import Variable\nimport numpy as np\n\ndef rmse(y, y_hat):\n return torch.sqrt(torch.mean((y-y_hat).pow(2)))\n\n# fancy name for function evaluation\ndef forward(x, theta):\n return x.pow(theta.repeat(x.size(0)))\n\n# Calculate gradient of loss w.r.t. \n# Its semantics are not exactly that of pytorch or tensorflow, but keeping this name as it is the closest.\ndef backward(x_train, y_train, theta_hat):\n return dLoss(x_train, y_train, theta_hat)\n\ndef optimizer_step(theta_hat, lr, grad):\n return theta_hat - lr * grad\n\nlr = 5e-6\nn_epoch = 5000\n\ntheta_hat = torch.FloatTensor([4.0])\n\nloss_history = []\ntheta_history = []\n\nfor epoch in range(n_epoch):\n \n y_hat = forward(x_train, theta_hat)\n loss = rmse(y_train, y_hat)\n grad = backward(x_train, y_train, theta_hat)\n \n loss_history.append(loss)\n theta_history.append(theta_hat)\n theta_hat = optimizer_step(theta_hat, lr, grad)\n\nplot_loss_and_exponent(loss_history, theta_history)",
"_____no_output_____"
]
],
[
[
"**Stochastic Gradient Descent(SGD)**\n\nHere only one sample is used per update of $\\theta$.\n",
"_____no_output_____"
]
],
[
[
"# SGD\nimport random\n\ndef rmse(y, y_hat):\n return torch.sqrt((y-y_hat).pow(2))\n\ndef forward(x, theta):\n return x.pow(theta)\n\ndef backward(x_train, y_train, theta_hat):\n return dLoss(x_train, y_train, theta_hat)\n\ndef optimizer_step(theta_hat, lr, grad):\n return theta_hat - lr * grad\n\nlr = 5e-6\nn_epoch = 2000\n\ntheta_hat = torch.FloatTensor([4.0])\n\nloss_history = []\ntheta_history = []\n\nfor epoch in range(n_epoch):\n\n # Ideally we need to shuffle training samples in each epoch to let SGD converge close to global minimum.\n # It dies not matter in our case as they are not sorted in any order.\n # In general, in a classification problem the training examples might be sorted by label and to \n # ensure IID condition we need to shuffle them).\n for xi, yi in zip(x_train, y_train):\n y_hat = forward(xi, theta_hat)\n loss = rmse(torch.tensor([yi]), torch.tensor([y_hat]))\n grad = backward(torch.tensor([xi]), torch.tensor([yi]), theta_hat)\n \n loss_history.append(loss)\n theta_history.append(theta_hat)\n\n theta_hat = optimizer_step(theta_hat, lr, grad)\n\nplot_loss_and_exponent(loss_history, theta_history)",
"_____no_output_____"
]
],
[
[
"Home grown reverse mode autodiff(AD)\n--\n\nAs can be seen from above example, for every kind of loss function, implementing gradient descent by hand is not optimal and error prone and boring. Can it be automated ? Let's walk through an example to see how this can be done using something called reverse mode AD.",
"_____no_output_____"
],
[
"Let's use SGD RMSE loss function from the introduction above:\n\n$L_i(\\theta) = \\sqrt{(x_i^\\theta - y_i)^2}$\n\n$\\frac{\\partial L_i}{\\partial \\theta} = \\frac{1}{2} \\frac{2 (x_i^\\theta - y_i) ln(x_i) x_i^\\theta}{\\sqrt{(x_i^\\theta - y_i)^2}}$",
"_____no_output_____"
],
[
"The goal of autodiff is create a generic mechanism to evaluate gradient of any function without writing code for it for every expression. Reverse mode AD is one way to do it and it depends on partial derivatives and chain rule heavily. Forward mode AD is another mechainsm and we do not talk about it in this article.\n\nTo be able to automatically calculating derivatives of arbitrary expressions, we have to first define some primitive expressions and then build complex ones out of them. There are a lot of function compositions in above RMSE equation. Breaking into simpler functions starting from primitives and using function composition:\n\n$v_0 = \\theta$ constant\n\n$v_1(v_0) = x^{v_0}$\n\n$v_2 = y_i$ constant function\n\n$v_3(v_1, v_2) = v_1 - v_2$\n\n$v_4(v_3) = v_3^2$\n\n$v_5(v_4) = \\sqrt{v_4}$\n\n$L_i = v_5 = L(v_5)$ (for simplifying the expressions below).",
"_____no_output_____"
],
[
"So, if you are calculating the (total) derivative of $L$ w.r.t. $\\theta$ how do you do it by hand? We use chain rule as follows:\n\n\n$\\begin{aligned}\\frac{\\partial L}{\\partial \\theta}\n&= \\frac{\\partial L}{\\partial v_5} \\frac{\\partial v_5}{\\partial \\theta} \\\\ \n&= \\frac{\\partial L}{\\partial v_5} (\\frac{\\partial v_5}{\\partial v_4} \\frac{\\partial v_4}{\\partial \\theta}) \\\\\n&= \\frac{\\partial L}{\\partial v_5} (\\frac{\\partial v_5}{\\partial v_4} (\\frac{\\partial v_4}{\\partial v_3} \\frac{\\partial v_3}{\\partial \\theta} )) \\\\\n&= \\frac{\\partial L}{\\partial v_5} (\\frac{\\partial v_5}{\\partial v_4} (\\frac{\\partial v_4}{\\partial v_3} (\\frac{\\partial v_3}{\\partial v_1} \\frac{\\partial v_1}{\\partial \\theta} + \\frac{\\partial v_3}{\\partial v_2} \\frac{\\partial v_2}{\\partial \\theta}))) \\\\\n&= \\dots \\\\\n\\end{aligned}$\n",
"_____no_output_____"
],
[
"The most important aspect of reverse mode AD is realizing that we can rewrite above as:\n\n$\\begin{aligned}\\frac{\\partial L}{\\partial \\theta}\n&= (((((\\frac{\\partial L}{\\partial v_5}) \\frac{\\partial v_5}{\\partial v_4}) \\frac{\\partial v_4}{\\partial v_3}) \\frac{\\partial v_3}{\\partial v_1} \\frac{\\partial v_1}{\\partial \\theta}) + (((((\\frac{\\partial L}{\\partial v_5}) \\frac{\\partial v_5}{\\partial v_4}) \\frac{\\partial v_4}{\\partial v_3}) \\frac{\\partial v_3}{\\partial v_2} \\frac{\\partial v_2}{\\partial \\theta})\n\\end{aligned}$\n\nExecution happens from the innermost parenthesis and procceds outwards.",
"_____no_output_____"
],
[
"If we imagine that each function ($v_i$) knows how to find the derivative of its output w.r.t to its input, the expansion above shows a pattern that can be leveraged to compute derivative:\n\nImagine that each operation/function is implemented as a class. For example consider $v_i$. It's class implements a function say `backward` that takes in the input $\\frac{\\partial L}{\\partial v_i}$. For each if its inputs, it calculates the derivative of output with respect to that input, multiplies with this input and returns the result. For example, consider $v_5$. The `backward` function takes $\\frac{\\partial L}{\\partial v_5}$ in the input, computes derivative $\\frac{\\partial v_5}{\\partial v_4} = \\frac{1}{2} \\frac{1}{\\sqrt{v_4}}$ and returns the product $\\frac{\\partial L}{\\partial v_4} = \\frac{\\partial L}{\\partial v_5} * \\frac{\\partial v_5}{\\partial v_4}$.\n",
"_____no_output_____"
],
[
"If a function like $v_3$ takes 2 inputs, it computes partial derivative w.r.t. each of the inputs and returns the list of updated derivatives.\n\nFor example, consider $v_3$.\nIt takes $\\frac{\\partial L}{\\partial v_3}$ and returns (1) $\\frac{\\partial L}{\\partial v_1}$ and (2) $\\frac{\\partial L}{\\partial v_2}$.\n\nNow we need a driver function, say `backprop` that orchestrates this sequence of `backward` calls starting from the target ($L = v_5$) and does a BFS on the expression to propagate down the derivatives until leaves are reached ($v_0$ in above example). Also, when it receives multiple outputs on calling a function (like `backward` on $v_3$ above), it correctly propagates the derivatives to the corresponding input variables (like to $v_1$ and $v_2$ respectively).",
"_____no_output_____"
]
],
[
[
"import json\nimport torch\n\n# Instead of creating a separate Expr class for each operation,\n# we leverage python operator overloading and create only one class Var. The downside is that now we have only\n# one class but with different derivative calculation based on the operation performed. So, we store the\n# derivative calculation as a lambda function in derivatives variable.\n\n# Note that I have intentially not abstracted too much in Var class - I do not want to hide the necessary \n# aspects needed to use reverse mode autodiff, but rather expose them so as to understand it better.\n\nclass Var:\n def __init__(self, name, value):\n self.value = value\n self.name = name\n self.derivatives = []\n self.grad_value = None\n self.is_leaf = False\n self.is_const = False\n \n def __str__(self):\n return \"name=\" + self.name + \"; value = \" + str(self.value)\n\n def __mul__(self, v2):\n v1 = self\n v = Var(v1.name + \"*\" + v2.name, v1.value * v2.value)\n v.derivatives.append( (v1, lambda og : og * v2.value) )\n v.derivatives.append ( (v2, lambda og : og * v1.value) ) \n return v\n\n def __add__(self, v2):\n v1 = self\n v = Var(v1.name + \"+\" + v2.name, v1.value + v2.value)\n v.derivatives.append ( (v1, lambda og : og ) )\n v.derivatives.append ( (v2, lambda og : og ) )\n return v\n\n def __sub__(self, v2):\n v1 = self\n v = Var(v1.name + \"-\" + v2.name, v1.value - v2.value)\n v.derivatives.append ( (v1, lambda og : og ) )\n v.derivatives.append ( (v2, lambda og : -og ) )\n return v\n\n def __pow__(self, v2):\n v1 = self\n v = Var(v1.name + \"-\" + v2.name, v1.value ** v2.value) \n v.derivatives.append( (v1, lambda og : og * v2.value * (v1.value ** (v2.value-1))))\n v.derivatives.append ( (v2, lambda og : og * v.value * torch.log(torch.tensor([v1.value]))) ) \n return v\n \n def backward(self, output_gradient = None):\n \n if output_gradient is None:\n output_gradient = 1.0\n\n if self.is_const:\n self.grad_value = 0\n return self\n\n if not self.is_leaf:\n return [(var, fn(output_gradient)) for var, fn in self.derivatives]\n else:\n if self.grad_value is None:\n self.grad_value = output_gradient\n else:\n self.grad_value += output_gradient\n return self\n \ndef sin(v):\n r = Var(\"sin(\" + v.name + \")\", torch.sin(torch.tensor([v.value])))\n r.derivatives.append ((v, lambda og : og*torch.cos(torch.tensor([v.value]))))\n return r\n\ndef sqrt(v):\n r = Var(\"sqrt(\" + v.name + \")\", torch.sqrt(torch.tensor([v.value])))\n r.derivatives.append ((v, lambda og : og*0.5/r.value))\n return r\n\ndef dx1(x1, x2):\n return x2 + torch.cos(torch.tensor([x1]))\n\ndef dx2(x1, x2):\n return x1\n\n# logic of backprop could be hosted in the Var.backward\ndef backprop(loss):\n gradients = loss.backward()\n q = [g for g in gradients]\n\n while len(q) > 0:\n var, input_gradient = q.pop()\n gradients = var.backward(input_gradient)\n if not var.is_leaf:\n for g in gradients:\n q.append(g)",
"_____no_output_____"
]
],
[
[
"**Some example exeuctions to check correct working**",
"_____no_output_____"
]
],
[
[
"x1 = Var(\"x1\", 0.50)\nx1.is_leaf = True\nx2 = Var(\"x2\", 4.2)\nx2.is_leaf = True\n\ny = (x1 * x2) + sin(x1)\n\nprint('Expected dx1 should be', dx1(x1.value, x2.value))\nprint('Expected dx2 should be', dx2(x1.value, x2.value))\n\nbackprop(y)\nprint(x1.grad_value)\nprint(x2.grad_value)",
"Expected dx1 should be tensor([5.0776])\nExpected dx2 should be 0.5\ntensor([5.0776])\n0.5\n"
],
[
"x = Var(\"x\", 3.0)\none = Var(\"1\", 1.0)\nx.is_leaf = True\none.is_leaf = True\none.is_const = True\n\ny = (x * x * x) + (x * x) + one\nbackprop(y)\nprint(x.grad_value)\nprint(one.grad_value)",
"33.0\n0\n"
],
[
"theta = Var(\"theta\", 4.0)\ntheta.is_leaf = True\nx = Var(\"x\", 3.0)\nx.is_leaf = True\nx.is_const = True\n\ny = x ** theta\nbackprop(y)\nprint(theta.grad_value)\n# verify with: https://www.wolframalpha.com/input/?i=derivative+of+3%5Ex+where+x+%3D4",
"tensor([88.9876])\n"
],
[
"x = Var(\"x\", 4.0)\nx.is_leaf = True\n\ny = sqrt(x)\nbackprop(y)\nprint(x.grad_value)",
"tensor([0.2500])\n"
],
[
"theta = Var(\"theta\", 4.0)\ntheta.is_leaf = True\ntwo = Var(\"two\", 2.0)\ntwo.is_leaf = True\ntwo.is_const = True\n\ndef rmse(y, y_hat):\n return sqrt((y-y_hat) ** two)\n\ndef forward(x, theta):\n return x ** theta\n\ny = Var(\"y\", 2.828)\ny_hat = Var(\"y_hat\", 2.3)\n\nprint(rmse(y, y_hat))",
"name=sqrt(y-y_hat-two); value = tensor([0.5280])\n"
]
],
[
[
"Finally, let's apply this to the SGD of our exponent estimator:",
"_____no_output_____"
]
],
[
[
"import random\n\ntwo = Var(\"two\", 2.0)\ntwo.is_leaf = True\ntwo.is_const = True\n\n\ndef loss(y, y_hat):\n return sqrt((y-y_hat) ** two)\n\ndef forward(x, theta):\n return x ** theta\n\ndef backward(err):\n backprop(err)\n return\n\ndef optimizer_step(theta, lr, grad):\n return theta - lr * grad\n\nlr = Var(\"lr\", 5e-6)\nlr.is_leaf = True\nlr.is_const = True\n\ntheta = Var(\"theta\", 4.0)\ntheta.is_leaf = True\n\n\nn_epoch = 5000\nloss_history = []\ntheta_history = []\n\nfor epoch in range(n_epoch):\n \n temp = list(zip(x_train, y_train))\n random.shuffle(temp)\n a, b = zip(*temp)\n\n for xi, yi in zip(a, b):\n var_xi = Var(\"xi\", xi)\n var_xi.is_leaf = True\n var_xi.is_const = True\n y_hat = forward(var_xi, theta)\n var_yi = Var(\"yi\", yi)\n var_yi.is_leaf = True\n var_yi.is_const = True\n \n err = loss(var_yi, y_hat)\n backward(err)\n \n loss_history.append(err.value)\n theta_history.append(theta.value)\n\n var_grad = Var(\"grad\", theta.grad_value)\n var_grad.is_leaf = True\n var_grad.is_const = True\n theta = optimizer_step(theta, lr, var_grad)\n theta.name = \"theta\"\n theta.is_leaf = True\n\n",
"_____no_output_____"
],
[
"plot_loss_and_exponent(loss_history, theta_history)",
"_____no_output_____"
]
],
[
[
"Not bad for a demo version of the code!",
"_____no_output_____"
],
[
"Plain Pytorch autograd for autodiff\n--\n\nLet's use pytorch's autograd directly for a comparison.",
"_____no_output_____"
]
],
[
[
"import torch\nfrom torch.autograd import Variable\nimport numpy as np\n\ndef rmse(y, y_hat):\n return torch.sqrt(torch.mean((y - y_hat).pow(2)))\n\ndef forward(x, e):\n return x.pow(e.repeat(x.size(0)))\n\nlearning_rate = 5e-6\nn_epoch = 5000\n\nx = Variable(x_train, requires_grad=False)\ny = Variable(y_train, requires_grad=False)\n\ntheta_hat = Variable(torch.FloatTensor([4]), requires_grad=True)\n\nloss_history = []\ntheta_history = []\n\nfor epoch in range(n_epoch):\n \n y_hat = forward(x, theta_hat)\n \n loss = rmse(y, y_hat)\n \n loss_history.append(loss.data.item())\n theta_history.append(theta_hat.data.item())\n \n # compute dLoss/dx for every parameter x with requires_grad=True\n loss.backward()\n\n theta_hat.data -= learning_rate * theta_hat.grad.data\n theta_hat.grad.data.zero_()\n\nplot_loss_and_exponent(loss_history, theta_history)",
"_____no_output_____"
]
],
[
[
"Pytorch with built-in optimizer\n---\n\nInstead of hand writing code to update the parameters, we can use built-in optimizers (with additional features like momentum that are not used in this article).",
"_____no_output_____"
]
],
[
[
"import torch\nfrom torch.autograd import Variable\nimport numpy as np\n\ndef rmse(y, y_hat):\n return torch.sqrt(torch.mean((y - y_hat).pow(2)))\n\ndef forward(x, e):\n return x.pow(e.repeat(x.size(0)))\n\nlearning_rate = 5e-6\nn_epoch = 5000\n\nx = Variable(x_train, requires_grad=False)\ny = Variable(y_train, requires_grad=False)\n\ntheta_hat = Variable(torch.FloatTensor([4]), requires_grad=True)\n\n# Using momentum = 0 to compare results identically\nopt = torch.optim.SGD([theta_hat], lr=learning_rate, momentum=0)\n\nloss_history = []\ntheta_history = []\n\nfor i in range(n_epoch):\n opt.zero_grad()\n \n y_hat = forward(x, theta_hat)\n \n loss = rmse(y, y_hat)\n \n loss_history.append(loss.data.item())\n theta_history.append(theta_hat.data.item())\n \n loss.backward()\n \n # Updates the value of theta using the gradient theta.grad\n opt.step()\n\nplot_loss_and_exponent(loss_history, theta_history)",
"_____no_output_____"
]
],
[
[
"Tensorflow\n---\n\nNow let's try the same using tensorflow autograd functions for comparison sake.",
"_____no_output_____"
]
],
[
[
"import tensorflow as tf\n\ndef rmse(y, y_hat):\n return tf.sqrt(tf.reduce_mean(tf.square((y - y_hat))))\n\ndef forward(x, e):\n return tf.pow(x, e)\n\nn_epoch = 5000\nlearning_rate = 5e-6\n\nx = tf.Variable(x_train)\ny = tf.Variable(y_train)\n\ntheta_hat = tf.Variable(4.0, name='theta_hat')\nopt = tf.keras.optimizers.SGD(learning_rate, momentum=0.0)\n\nloss_history = []\ntheta_history = []\n\nfor i in range(n_epoch): \n \n with tf.GradientTape() as tape:\n y_hat = forward(x, theta_hat) \n loss = rmse(y, y_hat)\n\n grads = tape.gradient(loss, [theta_hat])\n opt.apply_gradients(zip(grads, [theta_hat]))\n\n loss_history.append(loss)\n theta_history.append(theta_hat.numpy())\n\nplot_loss_and_exponent(loss_history, theta_history)",
"_____no_output_____"
]
],
[
[
"References\n--\n\n* https://jmlr.org/papers/v18/17-468.html\n* https://rufflewind.com/2016-12-30/reverse-mode-automatic-differentiation\n* http://neuralnetworksanddeeplearning.com/chap2.html\n* The exponent estimator problem is taken from this: https://towardsdatascience.com/pytorch-vs-tensorflow-spotting-the-difference-25c75777377b",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
]
]
|
cb6a3f274d5220ce1d37bbe8e03bdfde948c0305 | 2,585 | ipynb | Jupyter Notebook | 14_Keras/keras_Pooling.ipynb | faisalshahbaz/computer-vision-nanodegree | 92075f13cfbc823f41185a9ac225c155e02cd9c4 | [
"MIT"
]
| 7 | 2020-03-16T04:49:04.000Z | 2021-09-06T15:38:49.000Z | 14_Keras/keras_Pooling.ipynb | amitbcp/ComputerVisionDegree | ad2a704ace9fc063bc1d942fdd0bda1408c517e5 | [
"MIT"
]
| 79 | 2020-01-28T22:53:46.000Z | 2022-03-12T00:51:25.000Z | 14_Keras/keras_Pooling.ipynb | amitbcp/ComputerVisionDegree | ad2a704ace9fc063bc1d942fdd0bda1408c517e5 | [
"MIT"
]
| 6 | 2019-01-23T08:32:49.000Z | 2020-01-13T13:13:29.000Z | 22.675439 | 82 | 0.558221 | [
[
[
"import pickle\nimport numpy as np\nimport tensorflow as tf\n\n# Load pickled data\nwith open('small_train_traffic.p', mode='rb') as f:\n data = pickle.load(f)",
"_____no_output_____"
],
[
"# split the data\nX_train, y_train = data['features'], data['labels']",
"_____no_output_____"
],
[
"# Setup Keras\nfrom keras.models import Sequential\nfrom keras.layers.core import Dense, Activation, Flatten\nfrom keras.layers.convolutional import Conv2D\nfrom keras.layers.pooling import MaxPooling2D",
"_____no_output_____"
],
[
"# TODO: Build Convolutional Neural Network in Keras Here",
"_____no_output_____"
],
[
"# Preprocess data\nX_normalized = np.array(X_train / 255.0 - 0.5 )\n\nfrom sklearn.preprocessing import LabelBinarizer\nlabel_binarizer = LabelBinarizer()\ny_one_hot = label_binarizer.fit_transform(y_train)",
"_____no_output_____"
],
[
"# compile and fit model\nmodel.compile('adam', 'categorical_crossentropy', ['accuracy'])\nhistory = model.fit(X_normalized, y_one_hot, epochs=3, validation_split=0.2)",
"_____no_output_____"
],
[
"### DON'T MODIFY ANYTHING BELOW ###\n### Be sure to run all cells above before running this cell ###\nimport grader\n\ntry:\n grader.run_grader(model, history)\nexcept Exception as err:\n print(str(err))",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6a5a038207798b7fac575faf86962250b79452 | 4,991 | ipynb | Jupyter Notebook | Notebook/utils.ipynb | AdeBC/COVID-19.ZhuXueMST | 33d5e676ea395895fa55d4f289754047c31c24bf | [
"MIT"
]
| null | null | null | Notebook/utils.ipynb | AdeBC/COVID-19.ZhuXueMST | 33d5e676ea395895fa55d4f289754047c31c24bf | [
"MIT"
]
| null | null | null | Notebook/utils.ipynb | AdeBC/COVID-19.ZhuXueMST | 33d5e676ea395895fa55d4f289754047c31c24bf | [
"MIT"
]
| null | null | null | 29.886228 | 107 | 0.516129 | [
[
[
"import pandas as pd\nimport numpy as np",
"_____no_output_____"
],
[
"def load_datasets():\n file = '../Data-files/1352S_101F.xlsx'\n sheets = ['整数-101F', 'top5F', 'top3F', '3F']\n tables = {name: pd.read_excel(file, sheet_name=name) for name in sheets}\n for i in tables.values():\n i.index += 1\n \n return tables",
"_____no_output_____"
],
[
"def to_otus(raw_tables):\n for name, table in raw_tables.items():\n table = table.drop(columns='Status')\n table.index = table['SampleID']\n table = table.drop(columns='SampleID')\n \n # negative values treated as zeros\n raw_tables[name] = table.applymap(lambda x: x if x >=0 else 0)\n return raw_tables",
"_____no_output_____"
],
[
"def make_meta(otus_with_status):\n sources_ix = np.random.rand(1352) < 0.9\n sinks_ix = ~sources_ix\n meta = pd.DataFrame(data={'Env': otus_with_status['Status'].tolist(), \n 'SourceSink': 'Source'}, \n index=otus_with_status['SampleID'])\n meta.iloc[sinks_ix, 1] = 'Sink'\n meta['id'] = 0\n meta[meta['SourceSink'] == 'Sink'].loc[:, 2] = range(1, sum(sinks_ix) + 1)\n return meta",
"_____no_output_____"
],
[
"def plot_roc(series):\n #...\n return None",
"_____no_output_____"
],
[
"# Define functions\ndef FEAST_post_proc(df):\n # df = pd.read_csv('../tmp/F3_source_contributions_matrix.txt', sep='\\t').T\n df = df.T\n df['GroupID'] = df.index.to_series().apply(lambda x: x.split('_')[1] if x != 'Unknown' else x)\n df = df.groupby(by='GroupID').sum().T\n df['Env'] = df.index.to_series().apply(lambda x: x.split('_')[1])\n df['SampleID'] = df.index.tolist()\n return df\n\ndef JSD_post_proc(df, meta):\n # probas = softmax(1-distance) for each sample\n df = 1 - df.T\n df['Env'] = meta.loc[meta['SourceSink']=='Source', 'Env'].tolist()\n softmax = lambda x: np.exp(x) / np.exp(x).sum()\n df = df.groupby(by='Env').mean().apply(softmax, axis=0)\n df = df.T\n df.rename(mapper={'Env': '1', 'died': 'died', 'survived': 'survived'}, axis=1, inplace=True)\n df['Env'] = meta.loc[meta['SourceSink']=='Sink', 'Env'].tolist()\n df['SampleID'] = df.index.tolist()\n return df",
"_____no_output_____"
]
],
[
[
"# Prepare\nnames = [\"F5_top\", \"F3_top\", \"F101\", \"F3\"]\nmeta = pd.read_csv('../tmp/meta.csv')\nres_JSD = {name: '../Tmp/'+name+'.jsd.distance.csv' for name in names}\nres_FEAST = {name: '../Tmp/'+name+'_source_contributions_matrix.txt' for name in names}\npred_JSD = {name: '../DLMER-Bio/'+name+'.JSD.predictions.csv' for name in names}\npred_FEAST = {name: '../DLMER-Bio/'+name+'.FEAST.predictions.csv' for name in names}\nDLMER_in_JSD = {name: '../DLMER-Bio/'+name+'.JSD.DLMER.in.txt' for name in names}\nDLMER_in_FEAST = {name: '../DLMER-Bio/'+name+'.FEAST.DLMER.in.txt' for name in names}\n\n# Read res\nres_JSD_dfs = {name: pd.read_csv(f, index_col=0) for name, f in res_JSD.items()}\nres_FEAST_dfs = {name: pd.read_csv(f, sep='\\t') for name, f in res_FEAST.items()}",
"_____no_output_____"
],
[
"JSD_post_proc(res_JSD_dfs['F101'], meta)",
"_____no_output_____"
]
]
]
| [
"code",
"markdown"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
]
]
|
cb6a6974e1eb6084737b0b70421c189d106756f3 | 12,543 | ipynb | Jupyter Notebook | Finished/TicTacToe03.ipynb | thomasthaddeus/probable-bassoon | 7bd75ef931d8a6517b764e9011d5d8fb0e3876d3 | [
"MIT"
]
| null | null | null | Finished/TicTacToe03.ipynb | thomasthaddeus/probable-bassoon | 7bd75ef931d8a6517b764e9011d5d8fb0e3876d3 | [
"MIT"
]
| 2 | 2022-02-12T09:28:35.000Z | 2022-03-11T12:00:47.000Z | Finished/TicTacToe03.ipynb | thomasthaddeus/probable-bassoon | 7bd75ef931d8a6517b764e9011d5d8fb0e3876d3 | [
"MIT"
]
| null | null | null | 29.582547 | 740 | 0.444949 | [
[
[
"# TicTacToe\n### Main File\nNOTE:Add in Sections as they are completed\n### Completed Sections\n1. TODO:\n\n2. TODO:\n\n3. TODO:\n\n4. TODO:\n\n5. Complete\n\n6. TODO:\n\n7. TODO:\n\n8. TODO:",
"_____no_output_____"
],
[
"## Sections\n1. Selection of the first player. (e.g. Would you like to play first?)\n2. Assignment of \"O\" or \"X\" for a user. (e.g. Please choose 'O' or 'X' for your turn.)\n3. Computer selects a position based on either random position. \n4. If computer can select a position based on an algorithm (e.g. MiniMax algorithm or rule-based) approach, you will earn 20 extra points.\n5. At each run, the program should display the board (3x3) as shown below. Placement is made based on the pre-assigned positional number.\n6. Your program prints appropriate message if there is a winner and then exits.\n7. Your program saves all the moves between players in a file called tictactoe.txt (X:5 O:2 X:1 O:9 etc...)\n8. Your program should handle incorrect inputs (e.g. input validation) and continue to play without an error.",
"_____no_output_____"
]
],
[
[
"# place all imports at the top of the file here\nimport re, logging",
"_____no_output_____"
],
[
"# Random integer in place of \n# the minimax algorithm unless\n# minimax works\n\nboard = [1,2,3,4,5,6,7,8,9]\n\n#2 Logging for python file\nlogging.basicConfig(filename='ttt_game_log.txt', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')\n\nclass TicTacToe:\n '''Super Class for playing tic tac toe'''\n\n def __init__(self, player, computer):\n '''defines the player and their choice of X || O'''\n \n self.player = player\n self.computer = computer\n print()\n \n\n def spaceIsFree(pos):\n '''Check if space is free on the board'''\n if(board[pos] == ' '):\n return True\n else:\n return False\n\n def checkTie():\n '''Checks board for a Tie'''\n for key in board.keys():\n if board[key] == ' ':\n return False\n else:\n return True\n\n def checkWin(board, player):\n '''Checks for winner using the board'''\n i, mark = board, player\n return(\n (i[0] == i[1] == i[2] == mark) or # 1. top_horizon\n (i[4] == i[5] == i[6] == mark) or # 2. mid_horizon\n (i[1] == i[4] == i[7] == mark) or # 3. bottom_horizon\n (i[2] == i[5] == i[8] == mark) or # 4. left_vertical\n (i[3] == i[6] == i[9] == mark) or # 5. middle_vertical\n (i[3] == i[6] == i[9] == mark) or # 6. right_vertical\n (i[1] == i[5] == i[9] == mark) or # 7. tl_br\n (i[3] == i[5] == i[7] == mark)) # 8. tr_bl\n \n def minimax(self, board, isMaximizing, computer ):\n '''criteria for Minimax class'''\n\n self.computer = computer\n self.player = player\n \n if TicTacToe.checkWin(mark):\n return -100\n elif TicTacToe.checkWin(player):\n return 100\n elif TicTacToe.checkTie():\n return 0\n \n if isMaximizing:\n bestScore = -100\n for key in board.keys():\n if (board[key] == ' '):\n board[key] = computer\n score = (board, 0, False)\n board[key] = ' '\n if (score > bestScore):\n bestScore = score \n return bestScore\n\n else:\n bestScore = 100\n for key in board.keys():\n if (board[key] == ' '):\n board[key] = self.player\n score = self(board, 0, True)\n if (score < bestScore):\n bestScore = score\n return bestScore",
"_____no_output_____"
]
],
[
[
"### Part 1\n- Player Selection",
"_____no_output_____"
]
],
[
[
"# TODO who goes first\n# TODO: write coin flip to decide who goes first\nprint('''Welcome to Tic Tac Toe.\\n \n Our Version by Steph & Thad\\n\n To Play Please Select either X's or O's.\\n\n For X's press 1\\n \n For O's press 2''')",
"Welcome to Tic Tac Toe.\n \n Our Version by Steph & Thad\n\n To Play Please Select either X's or O's.\n\n For X's press 1\n \n For O's press 2\n"
]
],
[
[
"### Part 2\n- Piece Selection",
"_____no_output_____"
]
],
[
[
"import random\nheads = 0\nfor i in range(1, 1001):\n if random.randint(0, 1) == 1:\n heads = heads + 1\n if i == 500:\n print('Halfway done!')\n# TODO: This\nprint(input(), 'X', input(), 'O')",
"x X o O\n"
]
],
[
[
"### Part 3\n- Computer selects randomly ",
"_____no_output_____"
]
],
[
[
"# TODO: This\n# should be a Minimax or randomized\nimport random\ndef comp_move(jam, n):\n '''Computes the computers turn'''\n random.shuffle(jam)\n jam = [1,2,3,4,5,6,7,8,9]\n result = []\n for i in range(0, len(jam), n):\n result.append(jam[i:i + n])\n return result\n",
"6\n5\n6\n4\n4\n7\n4\n8\n5\n7\n5\n"
]
],
[
[
"### Part 4\n- Minimax\n**(optional)**",
"_____no_output_____"
]
],
[
[
"def Minimax(self, board, isMaximizing):\n '''criteria for Minimax class'''\n \n self.computer = computer\n self.player = player\n TicTacToe.board = board\n \n if checkWin(computer):\n return -100\n elif checkWin(player):\n return 100\n elif checkTie:\n return 0\n \n if isMaximizing:\n bestScore = -100\n for key in board.keys():\n if (board[key] == ' '):\n board[key] = computer\n score = (board, 0, False)\n board[key] = ' '\n if (score > bestScore):\n bestScore = score \n return bestScore\n\n else:\n bestScore = 100\n for key in board.keys():\n if (board[key] == ' '):\n board[key] = self.player\n score = self(board, 0, True)\n if (score < bestScore):\n bestScore = score\n return bestScore",
"_____no_output_____"
]
],
[
[
"### Part 5 - Complete\n- Display Board \n- Must Display every turn",
"_____no_output_____"
]
],
[
[
"#prints the board\n# Finished\n# 5,1,3,7,9,2,4,6,8\ndef getBoard(board):\n '''Displays board with index starting in top left and finishing in bottom right [0:8]'''\n \n board['a1':'1', 'b1':'2', 'c1':'3',\n 'a2':'4', 'b2':'5', 'c2':'6',\n 'a3':'7', 'b3':'8', 'c3':'9']=(\n \"\"\"'A' 'B' 'C' \n ____________________\n | | | |\n | {a1} | {b1} | {c1} | '1'\n |______|______|______|\n | | | |\n | {a2} | {b2} | {c2} | '2'\n |______|______|______|\n | | | |\n | {a3} | {b3} | {c3} | '3'\n |______|______|______|\"\"\"\n ) \n return board",
"_____no_output_____"
]
],
[
[
"### Part 7\n\n- Program Logs All Files\n- Logs all moves in file(tictactoe.txt)",
"_____no_output_____"
],
[
"### Part 8\n- Handle input error and continue",
"_____no_output_____"
]
],
[
[
"print('t') # TODO: check\nraise Exception('Doesnt work')\n ",
"t\n"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
]
]
|
cb6a6f423a75a0b94d702e4038b74504de914ff8 | 12,620 | ipynb | Jupyter Notebook | training/06.distributed-cntk-with-custom-docker/06.distributed-cntk-with-custom-docker.ipynb | maryxavier2002/AutomatedML | e7ce245674010fafdcd65ba3148229027193958b | [
"MIT"
]
| 1 | 2019-04-10T16:50:58.000Z | 2019-04-10T16:50:58.000Z | training/06.distributed-cntk-with-custom-docker/06.distributed-cntk-with-custom-docker.ipynb | maryxavier2002/AutomatedML | e7ce245674010fafdcd65ba3148229027193958b | [
"MIT"
]
| null | null | null | training/06.distributed-cntk-with-custom-docker/06.distributed-cntk-with-custom-docker.ipynb | maryxavier2002/AutomatedML | e7ce245674010fafdcd65ba3148229027193958b | [
"MIT"
]
| null | null | null | 32.358974 | 538 | 0.616323 | [
[
[
"Copyright (c) Microsoft Corporation. All rights reserved.\n\nLicensed under the MIT License.",
"_____no_output_____"
],
[
"# 06. Distributed CNTK using custom docker images\nIn this tutorial, you will train a CNTK model on the [MNIST](http://yann.lecun.com/exdb/mnist/) dataset using a custom docker image and distributed training.",
"_____no_output_____"
],
[
"## Prerequisites\n* Understand the [architecture and terms](https://docs.microsoft.com/azure/machine-learning/service/concept-azure-machine-learning-architecture) introduced by Azure Machine Learning\n* Go through the [00.configuration.ipynb]() notebook to:\n * install the AML SDK\n * create a workspace and its configuration file (`config.json`)",
"_____no_output_____"
]
],
[
[
"# Check core SDK version number\nimport azureml.core\n\nprint(\"SDK version:\", azureml.core.VERSION)",
"_____no_output_____"
]
],
[
[
"## Diagnostics\nOpt-in diagnostics for better experience, quality, and security of future releases.",
"_____no_output_____"
]
],
[
[
"from azureml.telemetry import set_diagnostics_collection\nset_diagnostics_collection(send_diagnostics = True)",
"_____no_output_____"
]
],
[
[
"## Initialize workspace\n\nInitialize a [Workspace](https://review.docs.microsoft.com/en-us/azure/machine-learning/service/concept-azure-machine-learning-architecture?branch=release-ignite-aml#workspace) object from the existing workspace you created in the Prerequisites step. `Workspace.from_config()` creates a workspace object from the details stored in `config.json`.",
"_____no_output_____"
]
],
[
[
"from azureml.core.workspace import Workspace\n\nws = Workspace.from_config()\nprint('Workspace name: ' + ws.name, \n 'Azure region: ' + ws.location, \n 'Subscription id: ' + ws.subscription_id, \n 'Resource group: ' + ws.resource_group, sep = '\\n')",
"_____no_output_____"
]
],
[
[
"## Create a remote compute target\nYou will need to create a [compute target](https://docs.microsoft.com/azure/machine-learning/service/concept-azure-machine-learning-architecture#compute-target) to execute your training script on. In this tutorial, you create an [Azure Batch AI](https://docs.microsoft.com/azure/batch-ai/overview) cluster as your training compute resource. This code creates a cluster for you if it does not already exist in your workspace.\n\n**Creation of the cluster takes approximately 5 minutes.** If the cluster is already in your workspace this code will skip the cluster creation process.",
"_____no_output_____"
]
],
[
[
"from azureml.core.compute import ComputeTarget, AmlCompute\nfrom azureml.core.compute_target import ComputeTargetException\n\n# choose a name for your cluster\ncluster_name = \"gpucluster\"\n\ntry:\n compute_target = ComputeTarget(workspace=ws, name=cluster_name)\n print('Found existing compute target.')\nexcept ComputeTargetException:\n print('Creating a new compute target...')\n compute_config = AmlCompute.provisioning_configuration(vm_size='STANDARD_NC6', \n max_nodes=6)\n\n # create the cluster\n compute_target = ComputeTarget.create(ws, cluster_name, compute_config)\n\ncompute_target.wait_for_completion(show_output=True)\n\n# Use the 'status' property to get a detailed status for the current cluster. \nprint(compute_target.status.serialize())",
"_____no_output_____"
]
],
[
[
"## Upload training data\nFor this tutorial, we will be using the MNIST dataset.\n\nFirst, let's download the dataset. We've included the `install_mnist.py` script to download the data and convert it to a CNTK-supported format. Our data files will get written to a directory named `'mnist'`.",
"_____no_output_____"
]
],
[
[
"import install_mnist\n\ninstall_mnist.main('mnist')",
"_____no_output_____"
]
],
[
[
"To make the data accessible for remote training, you will need to upload the data from your local machine to the cloud. AML provides a convenient way to do so via a [Datastore](https://docs.microsoft.com/azure/machine-learning/service/how-to-access-data). The datastore provides a mechanism for you to upload/download data, and interact with it from your remote compute targets. \n\nEach workspace is associated with a default datastore. In this tutorial, we will upload the training data to this default datastore, which we will then mount on the remote compute for training in the next section.",
"_____no_output_____"
]
],
[
[
"ds = ws.get_default_datastore()\nprint(ds.datastore_type, ds.account_name, ds.container_name)",
"_____no_output_____"
]
],
[
[
"The following code will upload the training data to the path `./mnist` on the default datastore.",
"_____no_output_____"
]
],
[
[
"ds.upload(src_dir='./mnist', target_path='./mnist')",
"_____no_output_____"
]
],
[
[
"Now let's get a reference to the path on the datastore with the training data. We can do so using the `path` method. In the next section, we can then pass this reference to our training script's `--data_dir` argument. ",
"_____no_output_____"
]
],
[
[
"path_on_datastore = 'mnist'\nds_data = ds.path(path_on_datastore)\nprint(ds_data)",
"_____no_output_____"
]
],
[
[
"## Train model on the remote compute\nNow that we have the cluster ready to go, let's run our distributed training job.",
"_____no_output_____"
],
[
"### Create a project directory\nCreate a directory that will contain all the necessary code from your local machine that you will need access to on the remote resource. This includes the training script, and any additional files your training script depends on.",
"_____no_output_____"
]
],
[
[
"import os\n\nproject_folder = './cntk-distr'\nos.makedirs(project_folder, exist_ok=True)",
"_____no_output_____"
]
],
[
[
"Copy the training script `cntk_distr_mnist.py` into this project directory.",
"_____no_output_____"
]
],
[
[
"import shutil\nshutil.copy('cntk_distr_mnist.py', project_folder)",
"_____no_output_____"
]
],
[
[
"### Create an experiment\nCreate an [experiment](https://docs.microsoft.com/azure/machine-learning/service/concept-azure-machine-learning-architecture#experiment) to track all the runs in your workspace for this distributed CNTK tutorial. ",
"_____no_output_____"
]
],
[
[
"from azureml.core import Experiment\n\nexperiment_name = 'cntk-distr'\nexperiment = Experiment(ws, name=experiment_name)",
"_____no_output_____"
]
],
[
[
"### Create an Estimator\nThe AML SDK's base Estimator enables you to easily submit custom scripts for both single-node and distributed runs. You should this generic estimator for training code using frameworks such as sklearn or CNTK that don't have corresponding custom estimators. For more information on using the generic estimator, refer [here](https://docs.microsoft.com/azure/machine-learning/service/how-to-train-ml-models).",
"_____no_output_____"
]
],
[
[
"from azureml.train.estimator import *\n\nscript_params = {\n '--num_epochs': 20,\n '--data_dir': ds_data.as_mount(),\n '--output_dir': './outputs'\n}\n\nestimator = Estimator(source_directory=project_folder,\n compute_target=compute_target,\n entry_script='cntk_distr_mnist.py',\n script_params=script_params,\n node_count=2,\n process_count_per_node=1,\n distributed_backend='mpi', \n pip_packages=['cntk-gpu==2.6'],\n custom_docker_base_image='microsoft/mmlspark:gpu-0.12',\n use_gpu=True)",
"_____no_output_____"
]
],
[
[
"We would like to train our model using a [pre-built Docker container](https://hub.docker.com/r/microsoft/mmlspark/). To do so, specify the name of the docker image to the argument `custom_docker_base_image`. You can only provide images available in public docker repositories such as Docker Hub using this argument. To use an image from a private docker repository, use the constructor's `environment_definition` parameter instead. Finally, we provide the `cntk` package to `pip_packages` to install CNTK 2.6 on our custom image.\n\nThe above code specifies that we will run our training script on `2` nodes, with one worker per node. In order to run distributed CNTK, which uses MPI, you must provide the argument `distributed_backend='mpi'`.",
"_____no_output_____"
],
[
"### Submit job\nRun your experiment by submitting your estimator object. Note that this call is asynchronous.",
"_____no_output_____"
]
],
[
[
"run = experiment.submit(estimator)\nprint(run.get_details())",
"_____no_output_____"
]
],
[
[
"### Monitor your run\nYou can monitor the progress of the run with a Jupyter widget. Like the run submission, the widget is asynchronous and provides live updates every 10-15 seconds until the job completes.",
"_____no_output_____"
]
],
[
[
"from azureml.widgets import RunDetails\nRunDetails(run).show()",
"_____no_output_____"
]
],
[
[
"Alternatively, you can block until the script has completed training before running more code.",
"_____no_output_____"
]
],
[
[
"run.wait_for_completion(show_output=True)",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb6a7946099a3adffeb9e36295d58133a7125fa7 | 3,151 | ipynb | Jupyter Notebook | src/Linear Algebra/Lecture33.ipynb | JeraKrs/linear-algebra-notes | 31a2627d2187fd61f537c035ae84ff0e1bb794e5 | [
"Apache-2.0"
]
| 4 | 2018-06-24T14:33:15.000Z | 2021-05-26T06:35:52.000Z | src/Linear Algebra/Lecture33.ipynb | JeraKrs/linear-algebra-notes | 31a2627d2187fd61f537c035ae84ff0e1bb794e5 | [
"Apache-2.0"
]
| null | null | null | src/Linear Algebra/Lecture33.ipynb | JeraKrs/linear-algebra-notes | 31a2627d2187fd61f537c035ae84ff0e1bb794e5 | [
"Apache-2.0"
]
| 1 | 2018-07-06T16:14:02.000Z | 2018-07-06T16:14:02.000Z | 30.892157 | 248 | 0.475722 | [
[
[
"# 第三十三讲 单元检测3复习\n\n**问题1**:求解 $\\frac{du}{dt} = Au = \\begin{bmatrix}0 & -1 & 0 \\\\ 1 & 0 & -1 \\\\ 0 & 1 & 0 \\end{bmatrix}u$,其中 $u(t) = c_1e^{\\lambda_1t}x_1 + c_2e^{\\lambda_2t}x_2 + c_3e^{\\lambda_3t}x_3$。\n\n*解答*:求解矩阵 $A$ 的特征值,有 $\\lambda_1 = 0, \\lambda_2 = \\sqrt{2}i, \\lambda_3 = -\\sqrt{2}i$,所以有 $u(t) = c_1x_1 + c_2e^{\\sqrt{2}it}x_2 + c_3e^{-\\sqrt{2}it}x_3$。考虑 $u(t)$ 的周期性,有 $\\sqrt{2}iT = 2\\pi i \\Rightarrow T = \\sqrt{2} \\pi$。\n\n如果矩阵可以对角化,即 $A = S\\Lambda S^{-1}$,则有 $e^{At} = Se^{\\Lambda t}S^{-1}$。",
"_____no_output_____"
],
[
"**问题2**:给定矩阵 $A$ 的特征为 $\\lambda_1 = 0, \\lambda_2 = c, \\lambda_3 = 2$,和特征向量 $x_1 = \\begin{bmatrix}1 \\\\ 1 \\\\ 1\\end{bmatrix}, x_2 = \\begin{bmatrix}1 \\\\ -1 \\\\ 0\\end{bmatrix}, x_3 = \\begin{bmatrix}1 \\\\ 1 \\\\ -2\\end{bmatrix}$。\n\n1. $c$ 为何值时,矩阵 $A$ 可以被对角化?\n2. $c$ 为何值时,矩阵 $A$ 为对称矩阵?\n3. $c$ 为何值时,矩阵 $A$ 具有正定性?\n4. $c$ 为何值时,矩阵 $A$ 为马尔科夫矩阵?\n5. $c$ 为何值时,矩阵 $\\frac{A}{2}$ 为投影矩阵?\n\n\n*解答*:\n1. $c$ 取任意值,矩阵 $A$ 均可以被对角化,因为矩阵有三个正交的特征向量。\n2. 任意实数的 $c$。\n3. 不存在 $c$ 使得矩阵具有正定性,矩阵已经有一个为零的特征值。但是,当 $c \\geq 0$ 时,矩阵具有半正定性。\n4. 不存在,因为马尔科夫矩阵要求有一个为一的特征值,且其他特征值均小于一。\n5. $c = 0$ 或 $c = 2$ 时,因为投影矩阵需满足 $P^2 = P \\Rightarrow \\lambda^2 = \\lambda$。",
"_____no_output_____"
],
[
"**问题3**:矩阵的奇异值分解,$A = U\\Sigma V^T$。\n\n*解答*:\n* 矩阵 $V$ 的每一列均为矩阵 $A^TA$ 的特征向量。\n* 矩阵 $U$ 的每一列均为矩阵 $AA^T$ 的特征向量。\n* 矩阵 $\\Sigma$ 的对角线元素的平方为矩阵 $A^TA$ 和 $AA^T$ 的特征向量。",
"_____no_output_____"
],
[
"**问题4**:给定矩阵 $A$ 具有对称性和正交性。\n1. 特征值有什么特点?\n2. 矩阵 $A$ 是否具有正定性?\n3. 矩阵 $A$ 的特征值有没有重复吗?\n4. 矩阵 $A$ 可否被对角化?\n5. 矩阵 $A$ 是非奇异矩阵吗?\n6. 证明 $P=\\frac{1}{2}(A+I)$ 是投影矩阵?\n\n*解答*:\n1. 首先特征值均为实数,因为矩阵具有对称性,其次,特征值为 $1$ 或 $-1$,因为**正交矩阵不会改变向量长度**,所以有 $||Qx|| = ||\\lambda x|| \\Rightarrow ||x|| = ||\\lambda|| \\times ||x||$。\n2. 不一定,因为矩阵 $A$ 的特征值可以取负一。\n3. 不是的,因为矩阵的特征值只能取正负一,当矩阵的阶数大于 $2$ 时,特征值一定重复。\n4. 任何矩阵均可以被对角化。\n5. 是的,因为矩阵 $A$ 具有正交性,所以特征值均为不为零。\n6. 因为投影矩阵有 $P^2 = P$,所以有\n\n$$\\frac{1}{4}(A = I)^2 = \\frac{1}{2}(A + I)$$\n$$\\Rightarrow \\frac{1}{2}(A^2 + 2A + I^2 = A + I$$\n$$\\Rightarrow \\frac{1}{2}(I + 2A + I) = A + I$$\n$$\\Rightarrow A + I = A + I$$\n\n得证。",
"_____no_output_____"
]
]
]
| [
"markdown"
]
| [
[
"markdown",
"markdown",
"markdown",
"markdown"
]
]
|
cb6a86c72a32445de84bca39bdbfaec567494e06 | 1,140 | ipynb | Jupyter Notebook | The Battle of Neighborhoods Week 1.ipynb | Razdeep/Coursera-Applied-Data-Science-Capstone-Project | 9a4590dab153e44e9d4a5978d86c31d172e9475e | [
"MIT"
]
| 1 | 2019-07-28T14:49:50.000Z | 2019-07-28T14:49:50.000Z | The Battle of Neighborhoods Week 1.ipynb | Razdeep/Coursera-Applied-Data-Science-Capstone-Project | 9a4590dab153e44e9d4a5978d86c31d172e9475e | [
"MIT"
]
| null | null | null | The Battle of Neighborhoods Week 1.ipynb | Razdeep/Coursera-Applied-Data-Science-Capstone-Project | 9a4590dab153e44e9d4a5978d86c31d172e9475e | [
"MIT"
]
| null | null | null | 17.014925 | 46 | 0.507018 | [
[
[
"# Coursera Applied Data Science Capstone",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport numpy as np",
"_____no_output_____"
],
[
"print('Hello Capstone Project Course!')",
"Hello Capstone Project Course!\n"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code"
]
]
|
cb6a92605eec7d869f052bf30d31a42b2ae1bc52 | 30,240 | ipynb | Jupyter Notebook | notebooks/notebook.ipynb | lpd2/titanic | 55c5cfd5fb2d009737554f32fc24c43b636d8511 | [
"MIT"
]
| null | null | null | notebooks/notebook.ipynb | lpd2/titanic | 55c5cfd5fb2d009737554f32fc24c43b636d8511 | [
"MIT"
]
| null | null | null | notebooks/notebook.ipynb | lpd2/titanic | 55c5cfd5fb2d009737554f32fc24c43b636d8511 | [
"MIT"
]
| null | null | null | 52.048193 | 251 | 0.628373 | [
[
[
"from time import time\nfrom importlib import reload\n\nimport pandas as pd\nimport sklearn\nimport numpy as np\nimport matplotlib.pyplot as plt",
"_____no_output_____"
],
[
"from sklearn.linear_model import LinearRegression, ElasticNet, LogisticRegression\nfrom sklearn.ensemble import ExtraTreesClassifier, ExtraTreesRegressor, GradientBoostingClassifier, AdaBoostClassifier, BaggingClassifier\nfrom sklearn.cross_decomposition import PLSRegression\nfrom sklearn.model_selection import train_test_split, cross_val_score, GridSearchCV, RandomizedSearchCV\nfrom sklearn.metrics import mean_squared_error, accuracy_score\n\nimport xgboost as xgb",
"_____no_output_____"
],
[
"import titanic.preprocess\nreload(titanic.preprocess)\npreprocess = titanic.preprocess",
"_____no_output_____"
],
[
"test = pd.read_csv(\"C:\\\\Data\\\\kaggle\\\\titanic\\\\test.csv\")\ntrain = pd.read_csv(\"C:\\\\Data\\\\kaggle\\\\titanic\\\\train.csv\")",
"_____no_output_____"
],
[
"all_df = pd.concat([train, test], axis=0, sort=False)\n##### Estimate Age\nall_df['Surname'] = preprocess.get_surnames(all_df)\nall_df['Title'] = preprocess.get_titles(all_df)\n\n# Get families\nfamilies = preprocess._get_families(all_df)\n#all_df['mean_fare'] = preprocess.mean_family_fare(all_df, families)\n\n# get Class, sex and title dummies.\nall_df = pd.get_dummies(all_df, columns=['Pclass', 'Sex', 'Title', 'Embarked'])\n\n#all_df[\"Fare\"] = all_df[\"Fare\"].fillna(np.nanmean(all_df['Fare']))\nall_df['AgeUnknown'] = np.where(all_df['Age'] != all_df['Age'], 1, 0)\nall_df['CabinUnknown'] = np.where(all_df['Cabin'] != all_df['Cabin'], 1, 0)\nall_df['CabinKnown'] = np.where(all_df['Cabin'] == all_df['Cabin'], 1, 0)\nall_df['FamilySize'] = all_df['Parch'] + all_df['SibSp'] + 1\n\nall_df['Alone'] = np.where(all_df['FamilySize'] == 1, 1, 0)\nall_df['Couple'] = np.where(all_df['FamilySize'] == 2, 1, 0)\nall_df['SmallFamily'] = np.where(all_df['FamilySize'].isin((3,4)), 1, 0)\nall_df['Family'] = np.where(all_df['FamilySize'] > 4, 1, 0)",
"_____no_output_____"
],
[
"# split df into two for those where age is known and unknown\n# known will be training/testing, unknown will be predicts\nknown, unknown = preprocess.age_split(all_df)\n\ncolumns = ['Pclass_1', 'Pclass_2','Pclass_3', 'Sex_female', 'Sex_male', 'Title_Master',\n 'Title_Miss', 'Title_Mr', 'Title_Mrs', 'Title_Rev', 'Parch', 'SibSp']\n\nX = known[columns]\ny = known['Age']\n\ntrain_X, test_X, train_y, test_y = train_test_split(X, y, test_size=0.2)\n\nclf = ExtraTreesRegressor(bootstrap=False, criterion='mse', max_depth=None,\n max_features=12, min_samples_split=30, n_estimators=1000)\n\nclf.fit(train_X, train_y)\nunknown['Age'] = clf.predict(unknown[columns]).astype(int)\n\nall_df = pd.concat([known, unknown], axis=0, sort=False)\n",
"C:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\ipykernel_launcher.py:17: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame.\nTry using .loc[row_indexer,col_indexer] = value instead\n\nSee the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n"
],
[
"all_df.head(40)",
"_____no_output_____"
],
[
"adult_died, adult_unknown, adult_survived, child_died, child_unknown, child_survived = preprocess.rs(all_df, families)",
"_____no_output_____"
],
[
"all_df['AdultDied'] = np.where(adult_died, 1, 0)\nall_df['AdultUnknown'] = np.where(adult_unknown, 1, 0)\nall_df['AdultSurvived'] = np.where(adult_survived, 1, 0)\nall_df['ChildDied'] = np.where(child_died, 1, 0)\nall_df['ChildUnknown'] = np.where(child_unknown, 1, 0)\nall_df['ChildSurvived'] = np.where(child_survived, 1, 0)\n\ntrain = all_df[all_df['Survived'].isin((0,1))]\ntest = all_df[all_df['Survived'] != all_df['Survived']]",
"_____no_output_____"
],
[
"columns = ['Age', 'SibSp', 'Parch', 'Pclass_1', 'Pclass_2', 'Pclass_3', 'Sex_male', 'Sex_female', 'AdultDied', 'AdultSurvived', 'ChildDied', 'ChildSurvived', 'Embarked_C',\n'Embarked_Q', 'Embarked_S', 'AgeUnknown', 'ChildUnknown', 'Alone', 'Couple', 'SmallFamily', 'Family', 'CabinKnown', 'CabinUnknown']\n\nX = train[columns]\ny = train['Survived']\n \nfor clf in [LogisticRegression, GradientBoostingClassifier, AdaBoostClassifier, ExtraTreesClassifier, BaggingClassifier]:\n scores = []\n for i in range(25):\n X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)\n clfi = clf()\n clfi.fit(X_train, y_train)\n y_pred = clfi.predict(X_test)\n scores.append(accuracy_score(y_pred, y_test))\n print(sum(scores) / 25)\n",
"C:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\nC:\\Users\\LDudley\\AppData\\Local\\Continuum\\anaconda3\\envs\\titanic\\lib\\site-packages\\sklearn\\linear_model\\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.\n FutureWarning)\n"
],
[
"def report(results, n_top=3):\n for i in range(1, n_top + 1):\n candidates = np.flatnonzero(results['rank_test_score'] == i)\n for candidate in candidates:\n print(\"Model with rank: {0}\".format(i))\n print(\"Mean validation score: {0:.3f} (std: {1:.3f})\".format(\n results['mean_test_score'][candidate],\n results['std_test_score'][candidate]))\n print(\"Parameters: {0}\".format(results['params'][candidate]))\n print(\"\")\n \n \nclf = GradientBoostingClassifier()\n \nparam_grid = {'loss' : ['deviance'],\n 'learning_rate' : [0.01, 0.1],\n 'n_estimators' : [100, 300, 500],\n 'subsample' : [0.4, 0.5, 0.6],\n 'max_depth':[None],\n 'max_features':[None],\n 'min_samples_split':[10,30]}\n\ngrid_search = GridSearchCV(clf, param_grid=param_grid, cv=5, iid=False, verbose=1, n_jobs=-1)\ngrid_search.fit(X, y)\nreport(grid_search.cv_results_)",
"Fitting 5 folds for each of 36 candidates, totalling 180 fits\n"
],
[
"clf = LogisticRegression(solver='newton-cg', penalty='l2')\n\nclf.fit(X_train, y_train)\ny_pred = clf.predict(X_test)\nprint(accuracy_score(y_pred, y_test))\nfor col, coef in zip(columns, *clf.coef_):\n print(col, coef)",
"0.7932960893854749\nAge -0.043436526495684954\nSibSp -0.12589881731345512\nParch 0.08629253144146151\nPclass_1 0.7491357203677307\nPclass_2 -0.054156323820075486\nPclass_3 -0.6949739076357214\nSex_male -1.5773489129134124\nSex_female 1.57735440182535\nAdultDied -2.0719509192279695\nAdultSurvived 0.9735287120175737\nChildDied -2.4427793959348554\nChildSurvived 1.341223275987253\nEmbarked_C 0.12828726189042297\nEmbarked_Q -0.07493088150950282\nEmbarked_S -0.2290877421622701\nAgeUnknown -0.15260455580710838\nChildUnknown -0.38577562182698505\nAlone -0.2479514331902424\nCouple -0.21043288882229474\nSmallFamily 0.5735432777639443\nFamily -0.1151534668394744\nCabinKnown 0.3951140519548193\nCabinUnknown -0.39510856304288106\n"
],
[
"# Create the parameter grid: gbm_param_grid \ngbm_param_grid = {\n 'n_estimators': range(8, 500),\n 'max_depth': range(1, 20),\n 'learning_rate': [.3, .4, .45, .5, .55, .6],\n 'colsample_bytree': [.8, .9, 1]\n}\n\n# Instantiate the regressor: gbm\ngbm = xgb.XGBClassifier(n_estimators=10)\n\n# Perform random search: grid_mse\nxgb_random = RandomizedSearchCV(param_distributions=gbm_param_grid, \n estimator = gbm, scoring = \"accuracy\", \n verbose = 1, n_iter = 50, cv = 5, n_jobs=-1)\n\n\n\n# Fit randomized_mse to the data\nxgb_random.fit(X, y)\n\n# Print the best parameters and lowest RMSE\nprint(\"Best parameters found: \", xgb_random.best_params_)\nprint(\"Best accuracy found: \", xgb_random.best_score_)\nreport(xgb_random.cv_results_)\n\n",
"Fitting 5 folds for each of 50 candidates, totalling 250 fits\n"
],
[
"xgb_random.coef_",
"_____no_output_____"
],
[
"# Create submission\n\nparams = {'learning_rate': 0.01,\n 'loss': 'deviance',\n 'max_depth': None,\n 'max_features': None,\n 'min_samples_split': 30,\n 'n_estimators': 300,\n 'subsample': 0.4\n\nclf = GradientBoostingClassifier(**params)\nclf.fit(X, y)\n\nPassengerId = test['PassengerId']\n\ntest = scaler.transform(test[columns])\n\ngdb_prediction = clf.predict(test)\n\noutput = pd.DataFrame({ 'PassengerId' : PassengerId, 'Survived': gdb_prediction })\noutput.to_csv('GDB3.csv', index=False)",
"_____no_output_____"
],
[
"X.columns",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6abd6c642bb5ccd7b6afd27fed60ed07e2c797 | 426,310 | ipynb | Jupyter Notebook | examples/example.ipynb | skojaku/cidre | 5b582b77537407f7b975f80ffbebfa248f967611 | [
"Apache-2.0"
]
| 1 | 2021-10-21T14:05:08.000Z | 2021-10-21T14:05:08.000Z | examples/example.ipynb | skojaku/cidre | 5b582b77537407f7b975f80ffbebfa248f967611 | [
"Apache-2.0"
]
| 2 | 2021-07-08T15:07:03.000Z | 2021-07-22T02:45:48.000Z | examples/example.ipynb | skojaku/cidre | 5b582b77537407f7b975f80ffbebfa248f967611 | [
"Apache-2.0"
]
| null | null | null | 485.546697 | 148,510 | 0.935967 | [
[
[
"<a href=\"https://colab.research.google.com/github/skojaku/cidre/blob/second-edit/examples/example.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
],
[
"# About this notebook\n\nIn this notebook, we apply CIDRE to a network with communities and demonstrate how to use CIDRE and visualize the detected groups.",
"_____no_output_____"
],
[
"## Preparation",
"_____no_output_____"
],
[
"### Install CIDRE package\n\nFirst, we install `cidre` package with `pip`:",
"_____no_output_____"
]
],
[
[
"!pip install cidre",
"Collecting cidre\n Downloading cidre-0.0.1-py3-none-any.whl (16 kB)\nCollecting matplotlib==3.1.3\n Downloading matplotlib-3.1.3-cp37-cp37m-manylinux1_x86_64.whl (13.1 MB)\n\u001b[K |████████████████████████████████| 13.1 MB 85 kB/s \n\u001b[?25hCollecting scipy>=1.5.2\n Downloading scipy-1.7.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (28.5 MB)\n\u001b[K |████████████████████████████████| 28.5 MB 46 kB/s \n\u001b[?25hCollecting tqdm>=4.49.0\n Downloading tqdm-4.62.0-py2.py3-none-any.whl (76 kB)\n\u001b[K |████████████████████████████████| 76 kB 3.6 MB/s \n\u001b[?25hRequirement already satisfied: seaborn==0.11.1 in /usr/local/lib/python3.7/dist-packages (from cidre) (0.11.1)\nRequirement already satisfied: pandas>=1.1.0 in /usr/local/lib/python3.7/dist-packages (from cidre) (1.1.5)\nRequirement already satisfied: numpy>=1.16.5 in /usr/local/lib/python3.7/dist-packages (from cidre) (1.19.5)\nRequirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from cidre) (2.5.1)\nRequirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib==3.1.3->cidre) (1.3.1)\nRequirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib==3.1.3->cidre) (0.10.0)\nRequirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib==3.1.3->cidre) (2.4.7)\nRequirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib==3.1.3->cidre) (2.8.1)\nRequirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from cycler>=0.10->matplotlib==3.1.3->cidre) (1.15.0)\nRequirement already satisfied: decorator<5,>=4.3 in /usr/local/lib/python3.7/dist-packages (from networkx>=2.0->cidre) (4.4.2)\nRequirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas>=1.1.0->cidre) (2018.9)\nInstalling collected packages: scipy, matplotlib, tqdm, cidre\n Attempting uninstall: scipy\n Found existing installation: scipy 1.4.1\n Uninstalling scipy-1.4.1:\n Successfully uninstalled scipy-1.4.1\n Attempting uninstall: matplotlib\n Found existing installation: matplotlib 3.2.2\n Uninstalling matplotlib-3.2.2:\n Successfully uninstalled matplotlib-3.2.2\n Attempting uninstall: tqdm\n Found existing installation: tqdm 4.41.1\n Uninstalling tqdm-4.41.1:\n Successfully uninstalled tqdm-4.41.1\n\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\nalbumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you have imgaug 0.2.9 which is incompatible.\u001b[0m\nSuccessfully installed cidre-0.0.1 matplotlib-3.1.3 scipy-1.7.1 tqdm-4.62.0\n"
]
],
[
[
"\n### Loading libraries\n\nNext, we load some libraries",
"_____no_output_____"
]
],
[
[
"import sys\nimport numpy as np\nfrom scipy import sparse\nimport pandas as pd\nimport cidre\nimport networkx as nx",
"_____no_output_____"
]
],
[
[
"# Example 1\n\nWe first present an example of a small artificial network, which can be loaded by",
"_____no_output_____"
]
],
[
[
"# Data path\nedge_file = \"https://raw.githubusercontent.com/skojaku/cidre/main/data/synthe/edge-table.csv\"\nnode_file = \"https://raw.githubusercontent.com/skojaku/cidre/main/data/synthe/node-table.csv\"\n\n# Load\nnode_table = pd.read_csv(node_file)\nA, node_labels = cidre.utils.read_edge_list(edge_file)\n\n# Visualization\nnx.draw(nx.from_scipy_sparse_matrix(A), linewidths = 1, edge_color=\"#8d8d8d\", edgecolors=\"b\")",
"_____no_output_____"
]
],
[
[
"## About this network\n\nWe constructed this synthetic network by generating a network using a stochastic block model (SBM) composed of two blocks and then adding excessive citation edges among uniformly randomly selected pairs of nodes. Each block corresponds to a community, i.e., a group of nodes that are densely connected with each other within it but sparsely connected with those in the opposite group. Such communities overshadow anomalous groups in networks. ",
"_____no_output_____"
],
[
"## Community detection with graph-tool",
"_____no_output_____"
],
[
"Let's pretend that we do not know that the network is composed of two communities plus additional edges. To run CIDRE, we first need to find the communities. We use [graph-tool package](https://graph-tool.skewed.de/) to do this, which can be installed by \n\n```bash\nconda install -c conda-forge graph-tool\n```\n\nor in `Colaboratory` platform:",
"_____no_output_____"
]
],
[
[
"%%capture\n!echo \"deb http://downloads.skewed.de/apt bionic main\" >> /etc/apt/sources.list\n!apt-key adv --keyserver keys.openpgp.org --recv-key 612DEFB798507F25\n!apt-get update\n!apt-get install python3-graph-tool python3-cairo python3-matplotlib",
"_____no_output_____"
]
],
[
[
"Now, let's detect communities by fitting the degree-corrected stochastic block model (dcSBM) to the network and consider each detected block as a community.",
"_____no_output_____"
]
],
[
[
"import graph_tool.all as gt\n\ndef detect_community(A, K = None, **params):\n \"\"\"Detect communities using the graph-tool package\n\n :param A: adjacency matrix\n :type A: scipy.csr_sparse_matrix\n :param K: Maximum number of communities. If K = None, the number of communities is automatically determined by graph-tool.\n :type K: int or None\n :param params: parameters passed to graph_tool.gt.minimize_blockmodel_dl\n \"\"\"\n def to_graph_tool_format(adj, membership=None):\n g = gt.Graph(directed=True)\n r, c, v = sparse.find(adj)\n nedges = v.size\n edge_weights = g.new_edge_property(\"double\")\n g.edge_properties[\"weight\"] = edge_weights\n g.add_edge_list(\n np.hstack([np.transpose((r, c)), np.reshape(v, (nedges, 1))]),\n eprops=[edge_weights],\n )\n return g\n G = to_graph_tool_format(A)\n\n states = gt.minimize_blockmodel_dl(\n G,\n state_args=dict(eweight=G.ep.weight),\n multilevel_mcmc_args = {\"B_max\": A.shape[0] if K is None else K },\n **params\n )\n b = states.get_blocks()\n return np.unique(np.array(b.a), return_inverse = True)[1]",
"/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py:32: RuntimeWarning: Error importing cairo. Graph drawing will not work.\n warnings.warn(msg, RuntimeWarning)\n/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py:32: RuntimeWarning: Error importing cairo. Graph drawing will not work.\n warnings.warn(msg, RuntimeWarning)\n/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py:32: RuntimeWarning: Error importing cairo. Graph drawing will not work.\n warnings.warn(msg, RuntimeWarning)\n/usr/lib/python3/dist-packages/graph_tool/all.py:39: RuntimeWarning: Error importing draw module, proceeding nevertheless: No module named 'cairo._cairo'\n warnings.warn(msg, RuntimeWarning)\n"
],
[
"group_membership = detect_community(A)",
"_____no_output_____"
]
],
[
[
"## Detecting anomalous groups in the network\n\nNow, we feed the network and its community structure to CIDRE. To to this, we create a `cidre.Cidre` object and input `group_membership` along with some key parameters to `cidre.Cidre`.",
"_____no_output_____"
]
],
[
[
"alg = cidre.Cidre(group_membership = group_membership, alpha = 0.05, min_edge_weight = 1)",
"_____no_output_____"
]
],
[
[
"- `alpha` (default 0.01) is the statistical significance level.\n- `min_edge_weight` is the threshold of the edge weight, i.e., the edges with weight less than this value will be removed.\n\nThen, we input the network to `cidre.Cidre.detect`.",
"_____no_output_____"
]
],
[
[
"groups = alg.detect(A, threshold=0.15)",
"_____no_output_____"
]
],
[
[
"`groups` is a list of `Group` instances. A `Group` instance represents a group of nodes detected by CIDRE and contains information about the type of each member node (i.e., donor and recipient). We can get the donor nodes of a group, for example `groups[0]`, by",
"_____no_output_____"
]
],
[
[
"groups[0].donors",
"_____no_output_____"
]
],
[
[
"The keys and values of this dict object are the IDs of the nodes and their donor scores, respectively. The recipients and their recipient scores can be obtained by",
"_____no_output_____"
]
],
[
[
"groups[0].recipients",
"_____no_output_____"
]
],
[
[
"## Visualization\n\n`cidre` package provides an API to visualize small groups. To use this API, we first need to import some additional libraries.",
"_____no_output_____"
]
],
[
[
"import seaborn as sns\nimport matplotlib.pyplot as plt",
"_____no_output_____"
]
],
[
[
"Then, plot the group by",
"_____no_output_____"
]
],
[
[
"# The following three lines are purely for visual enhancement, i.e., changing the saturation of the colors and font size.\nsns.set_style(\"white\")\nsns.set(font_scale=1.2)\nsns.set_style(\"ticks\")\n\n# Set the figure size\nwidth, height = 5,5\nfig, ax = plt.subplots(figsize=(width, height))\n\n# Plot a citation group\ncidre.DrawGroup().draw(groups[0], ax = ax)",
"_____no_output_____"
]
],
[
[
"\n# Example 2\n\nLet's apply CIDRE to a much larger empirical citation network, i.e., the citation network of journals in 2013.",
"_____no_output_____"
]
],
[
[
"# Data path\nedge_file = \"https://raw.githubusercontent.com/skojaku/cidre/main/data/journal-citation/edge-table-2013.csv\"\nnode_file = \"https://raw.githubusercontent.com/skojaku/cidre/main/data/journal-citation/community-label.csv\"\n\n# Load\nnode_table = pd.read_csv(node_file)\nA, node_labels = cidre.utils.read_edge_list(edge_file)",
"_____no_output_____"
]
],
[
[
"## About this network\n\nThis network is a citation network of journals in 2013 constructed from Microsoft Academic Graph.\nEach edge is weighted by the number of citations made to the papers in the prior two years.\nThe following are basic statistics of this network.",
"_____no_output_____"
]
],
[
[
"print(\"Number of nodes: %d\" % A.shape[0])\nprint(\"Number of edges: %d\" % A.sum())\nprint(\"Average degree: %.2f\" % (A.sum()/A.shape[0]))\nprint(\"Max in-degree: %d\" % np.max(A.sum(axis = 0)))\nprint(\"Max out-degree: %d\" % np.max(A.sum(axis = 1)))\nprint(\"Maximum edge weight: %d\" % A.max())\nprint(\"Minimum edge weight: %d\" % np.min(A.data))",
"Number of nodes: 31385\nNumber of edges: 8038733\nAverage degree: 256.13\nMax in-degree: 143633\nMax out-degree: 228866\nMaximum edge weight: 19792\nMinimum edge weight: 1\n"
]
],
[
[
"## Communities\n\n[In our paper](https://www.nature.com/articles/s41598-021-93572-3), we identified the communities of journals using [graph-tool](https://graph-tool.skewed.de/). `node_table` contains the community membership of each journal, from which we prepare `group_membership` array as follows.",
"_____no_output_____"
]
],
[
[
"# Get the group membership\nnode2com = dict(zip(node_table[\"journal_id\"], node_table[\"community_id\"]))\ngroup_membership = [node2com[node_labels[i]] for i in range(A.shape[0])]",
"_____no_output_____"
]
],
[
[
"## Detecting anomalous groups in the network",
"_____no_output_____"
],
[
"As is demonstrated in the first example, we detect the anomalous groups in the network by",
"_____no_output_____"
]
],
[
[
"alg = cidre.Cidre(group_membership = group_membership, alpha = 0.01, min_edge_weight = 10)\ngroups = alg.detect(A, threshold=0.15)",
"_____no_output_____"
],
[
"print(\"The number of journals in the largest group: %d\" % np.max([group.size() for group in groups]))\nprint(\"Number of groups detected: %d\" % len(groups))",
"The number of journals in the largest group: 16\nNumber of groups detected: 129\n"
]
],
[
[
"[In our paper](https://www.nature.com/articles/s41598-021-93572-3), we omitted the groups that have within-group citations less than 50 because we expect that anomalous citation groups contain sufficiently many within-group citations, i.e., ",
"_____no_output_____"
]
],
[
[
"groups = [group for group in groups if group.get_num_edges()>=50]",
"_____no_output_____"
]
],
[
[
"where `group.get.num_edges()` gives the sum of the weights of the non-self-loop edges within the group.",
"_____no_output_____"
],
[
"## Visualization",
"_____no_output_____"
],
[
"Let us visualize the groups detected by CIDRE. For expository purposes, we sample three groups to visualize uniformly at random.",
"_____no_output_____"
]
],
[
[
"groups_sampled = [groups[i] for i in np.random.choice(len(groups), 3, replace = False)]",
"_____no_output_____"
],
[
"import seaborn as sns\nimport matplotlib.pyplot as plt\nsns.set_style(\"white\")\nsns.set(font_scale=1.2)\nsns.set_style(\"ticks\")\n\nfig, axes = plt.subplots(ncols = 3, figsize=(6 * 3, 5))\n\nfor i in range(3):\n cidre.DrawGroup().draw(groups_sampled[i], ax = axes.flat[i])",
"_____no_output_____"
]
],
[
[
"The numbers beside the nodes are the IDs of the journals in the network. To show the journals' names, we do the following. \n\n\nFirst, we load node lables and make a dictionary that maps the ID of each node to the label:",
"_____no_output_____"
]
],
[
[
"df = pd.read_csv(\"https://raw.githubusercontent.com/skojaku/cidre/main/data/journal-citation/journal_names.csv\")\njournalid2label = dict(zip(df.journal_id.values, df.name.values)) # Dictionary from MAG journal ID to the journal name\n\nid2label = {k:journalid2label[v] for k, v in node_labels.items()} # This is a dictionary from ID to label, i.e., {ID:journal_name}",
"_____no_output_____"
]
],
[
[
"Then, give `id2label` to `cidre.DrawGroup.draw`, i.e., ",
"_____no_output_____"
]
],
[
[
"sns.set_style(\"white\")\nsns.set(font_scale=1.2)\nsns.set_style(\"ticks\")\n\nfig, axes = plt.subplots(ncols = 3, figsize=(9 * 3, 5))\n\nfor i in range(3):\n plotter = cidre.DrawGroup()\n plotter.font_size = 12 # Font size\n plotter.label_node_margin = 0.7 # Margin between labels and node\n plotter.draw(groups_sampled[i], node_labels = id2label, ax = axes.flat[i])",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb6ad1ee29296ce8afae31826e4a193270d80c2b | 15,336 | ipynb | Jupyter Notebook | 07_train/01_Train_Reviews_BERT_Transformers_TensorFlow_AdHoc.ipynb | nitish-raj/data-science-on-aws | b760805d28f8375094ce83aee849de8b9d3382a2 | [
"Apache-2.0"
]
| 163 | 2021-11-29T17:33:08.000Z | 2022-02-24T14:44:08.000Z | 07_train/01_Train_Reviews_BERT_Transformers_TensorFlow_AdHoc.ipynb | nitish-raj/data-science-on-aws | b760805d28f8375094ce83aee849de8b9d3382a2 | [
"Apache-2.0"
]
| 6 | 2021-12-08T01:36:04.000Z | 2022-02-11T10:18:42.000Z | 07_train/01_Train_Reviews_BERT_Transformers_TensorFlow_AdHoc.ipynb | nitish-raj/data-science-on-aws | b760805d28f8375094ce83aee849de8b9d3382a2 | [
"Apache-2.0"
]
| 57 | 2021-11-26T12:46:42.000Z | 2022-02-23T14:46:26.000Z | 29.435701 | 308 | 0.573683 | [
[
[
"# Fine-Tuning a BERT Model and Create a Text Classifier\n\nIn the previous section, we've already performed the Feature Engineering to create BERT embeddings from the `reviews_body` text using the pre-trained BERT model, and split the dataset into train, validation and test files. To optimize for Tensorflow training, we saved the files in TFRecord format. \n\nNow, let’s fine-tune the BERT model to our Customer Reviews Dataset and add a new classification layer to predict the `star_rating` for a given `review_body`.\n\n\n\nAs mentioned earlier, BERT’s attention mechanism is called a Transformer. This is, not coincidentally, the name of the popular BERT Python library, “Transformers,” maintained by a company called HuggingFace. \n\nWe will use a variant of BERT called [**DistilBert**](https://arxiv.org/pdf/1910.01108.pdf) which requires less memory and compute, but maintains very good accuracy on our dataset.",
"_____no_output_____"
]
],
[
[
"import time\nimport random\nimport pandas as pd\nfrom glob import glob\nimport argparse\nimport json\nimport subprocess\nimport sys\nimport os\nimport tensorflow as tf\nfrom transformers import DistilBertTokenizer\nfrom transformers import TFDistilBertForSequenceClassification\nfrom transformers import DistilBertConfig",
"_____no_output_____"
],
[
"%store -r max_seq_length",
"_____no_output_____"
],
[
"try:\n max_seq_length\nexcept NameError:\n print(\"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\")\n print(\"[ERROR] Please run the notebooks in the PREPARE section before you continue.\")\n print(\"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\")",
"_____no_output_____"
],
[
"print(max_seq_length)",
"_____no_output_____"
],
[
"def select_data_and_label_from_record(record):\n x = {\n \"input_ids\": record[\"input_ids\"],\n \"input_mask\": record[\"input_mask\"],\n # 'segment_ids': record['segment_ids']\n }\n y = record[\"label_ids\"]\n\n return (x, y)",
"_____no_output_____"
],
[
"def file_based_input_dataset_builder(channel, input_filenames, pipe_mode, is_training, drop_remainder):\n\n # For training, we want a lot of parallel reading and shuffling.\n # For eval, we want no shuffling and parallel reading doesn't matter.\n\n if pipe_mode:\n print(\"***** Using pipe_mode with channel {}\".format(channel))\n from sagemaker_tensorflow import PipeModeDataset\n\n dataset = PipeModeDataset(channel=channel, record_format=\"TFRecord\")\n else:\n print(\"***** Using input_filenames {}\".format(input_filenames))\n dataset = tf.data.TFRecordDataset(input_filenames)\n\n dataset = dataset.repeat(100)\n dataset = dataset.prefetch(tf.data.experimental.AUTOTUNE)\n\n name_to_features = {\n \"input_ids\": tf.io.FixedLenFeature([max_seq_length], tf.int64),\n \"input_mask\": tf.io.FixedLenFeature([max_seq_length], tf.int64),\n # \"segment_ids\": tf.io.FixedLenFeature([max_seq_length], tf.int64),\n \"label_ids\": tf.io.FixedLenFeature([], tf.int64),\n }\n\n def _decode_record(record, name_to_features):\n \"\"\"Decodes a record to a TensorFlow example.\"\"\"\n return tf.io.parse_single_example(record, name_to_features)\n\n dataset = dataset.apply(\n tf.data.experimental.map_and_batch(\n lambda record: _decode_record(record, name_to_features),\n batch_size=8,\n drop_remainder=drop_remainder,\n num_parallel_calls=tf.data.experimental.AUTOTUNE,\n )\n )\n\n dataset.cache()\n\n if is_training:\n dataset = dataset.shuffle(seed=42, buffer_size=10, reshuffle_each_iteration=True)\n\n return dataset",
"_____no_output_____"
],
[
"train_data = \"./data-tfrecord/bert-train\"\ntrain_data_filenames = glob(\"{}/*.tfrecord\".format(train_data))\nprint(\"train_data_filenames {}\".format(train_data_filenames))\n\ntrain_dataset = file_based_input_dataset_builder(\n channel=\"train\", input_filenames=train_data_filenames, pipe_mode=False, is_training=True, drop_remainder=False\n).map(select_data_and_label_from_record)",
"_____no_output_____"
],
[
"validation_data = \"./data-tfrecord/bert-validation\"\nvalidation_data_filenames = glob(\"{}/*.tfrecord\".format(validation_data))\nprint(\"validation_data_filenames {}\".format(validation_data_filenames))\n\nvalidation_dataset = file_based_input_dataset_builder(\n channel=\"validation\",\n input_filenames=validation_data_filenames,\n pipe_mode=False,\n is_training=False,\n drop_remainder=False,\n).map(select_data_and_label_from_record)",
"_____no_output_____"
],
[
"test_data = \"./data-tfrecord/bert-test\"\ntest_data_filenames = glob(\"{}/*.tfrecord\".format(test_data))\nprint(test_data_filenames)\n\ntest_dataset = file_based_input_dataset_builder(\n channel=\"test\", input_filenames=test_data_filenames, pipe_mode=False, is_training=False, drop_remainder=False\n).map(select_data_and_label_from_record)",
"_____no_output_____"
]
],
[
[
"# Specify Manual Hyper-Parameters",
"_____no_output_____"
]
],
[
[
"epochs = 1\nsteps_per_epoch = 10\nvalidation_steps = 10\ntest_steps = 10\nfreeze_bert_layer = True\nlearning_rate = 3e-5\nepsilon = 1e-08",
"_____no_output_____"
]
],
[
[
"# Load Pretrained BERT Model \nhttps://huggingface.co/transformers/pretrained_models.html ",
"_____no_output_____"
]
],
[
[
"CLASSES = [1, 2, 3, 4, 5]\n\nconfig = DistilBertConfig.from_pretrained(\n \"distilbert-base-uncased\",\n num_labels=len(CLASSES),\n id2label={0: 1, 1: 2, 2: 3, 3: 4, 4: 5},\n label2id={1: 0, 2: 1, 3: 2, 4: 3, 5: 4},\n)\nprint(config)",
"_____no_output_____"
],
[
"transformer_model = TFDistilBertForSequenceClassification.from_pretrained(\"distilbert-base-uncased\", config=config)\n\ninput_ids = tf.keras.layers.Input(shape=(max_seq_length,), name=\"input_ids\", dtype=\"int32\")\ninput_mask = tf.keras.layers.Input(shape=(max_seq_length,), name=\"input_mask\", dtype=\"int32\")\n\nembedding_layer = transformer_model.distilbert(input_ids, attention_mask=input_mask)[0]\nX = tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(50, return_sequences=True, dropout=0.1, recurrent_dropout=0.1))(\n embedding_layer\n)\nX = tf.keras.layers.GlobalMaxPool1D()(X)\nX = tf.keras.layers.Dense(50, activation=\"relu\")(X)\nX = tf.keras.layers.Dropout(0.2)(X)\nX = tf.keras.layers.Dense(len(CLASSES), activation=\"softmax\")(X)\n\nmodel = tf.keras.Model(inputs=[input_ids, input_mask], outputs=X)\n\nfor layer in model.layers[:3]:\n layer.trainable = not freeze_bert_layer",
"_____no_output_____"
]
],
[
[
"# Setup the Custom Classifier Model Here",
"_____no_output_____"
]
],
[
[
"loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)\n\nmetric = tf.keras.metrics.SparseCategoricalAccuracy(\"accuracy\")\n\noptimizer = tf.keras.optimizers.Adam(learning_rate=learning_rate, epsilon=epsilon)\n\nmodel.compile(optimizer=optimizer, loss=loss, metrics=[metric])\n\nmodel.summary()",
"_____no_output_____"
],
[
"callbacks = []\n\nlog_dir = \"./tmp/tensorboard/\"\ntensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir)\ncallbacks.append(tensorboard_callback)",
"_____no_output_____"
],
[
"history = model.fit(\n train_dataset,\n shuffle=True,\n epochs=epochs,\n steps_per_epoch=steps_per_epoch,\n validation_data=validation_dataset,\n validation_steps=validation_steps,\n callbacks=callbacks,\n)",
"_____no_output_____"
],
[
"print(\"Trained model {}\".format(model))",
"_____no_output_____"
]
],
[
[
"# Evaluate on Holdout Test Dataset",
"_____no_output_____"
]
],
[
[
"test_history = model.evaluate(test_dataset, steps=test_steps, callbacks=callbacks)\nprint(test_history)",
"_____no_output_____"
]
],
[
[
"# Save the Model",
"_____no_output_____"
]
],
[
[
"tensorflow_model_dir = \"./tmp/tensorflow/\"",
"_____no_output_____"
],
[
"!mkdir -p $tensorflow_model_dir",
"_____no_output_____"
],
[
"model.save(tensorflow_model_dir, include_optimizer=False, overwrite=True)",
"_____no_output_____"
],
[
"!ls -al $tensorflow_model_dir",
"_____no_output_____"
],
[
"!saved_model_cli show --all --dir $tensorflow_model_dir",
"_____no_output_____"
],
[
"# !saved_model_cli run --dir $tensorflow_model_dir --tag_set serve --signature_def serving_default \\\n# --input_exprs 'input_ids=np.zeros((1,64));input_mask=np.zeros((1,64))'",
"_____no_output_____"
]
],
[
[
"# Predict with Model",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport numpy as np\n\nfrom transformers import DistilBertTokenizer\n\ntokenizer = DistilBertTokenizer.from_pretrained(\"distilbert-base-uncased\")\n\nsample_review_body = \"This product is terrible.\"\n\nencode_plus_tokens = tokenizer.encode_plus(\n sample_review_body, padding='max_length', max_length=max_seq_length, truncation=True, return_tensors=\"tf\"\n)\n\n# The id from the pre-trained BERT vocabulary that represents the token. (Padding of 0 will be used if the # of tokens is less than `max_seq_length`)\ninput_ids = encode_plus_tokens[\"input_ids\"]\n\n# Specifies which tokens BERT should pay attention to (0 or 1). Padded `input_ids` will have 0 in each of these vector elements.\ninput_mask = encode_plus_tokens[\"attention_mask\"]\n\noutputs = model.predict(x=(input_ids, input_mask))\n\nprediction = [{\"label\": config.id2label[item.argmax()], \"score\": item.max().item()} for item in outputs]\n\nprint(\"\")\nprint('Predicted star_rating \"{}\" for review_body \"{}\"'.format(prediction[0][\"label\"], sample_review_body))",
"_____no_output_____"
]
],
[
[
"# Release Resources",
"_____no_output_____"
]
],
[
[
"%%html\n\n<p><b>Shutting down your kernel for this notebook to release resources.</b></p>\n<button class=\"sm-command-button\" data-commandlinker-command=\"kernelmenu:shutdown\" style=\"display:none;\">Shutdown Kernel</button>\n \n<script>\ntry {\n els = document.getElementsByClassName(\"sm-command-button\");\n els[0].click();\n}\ncatch(err) {\n // NoOp\n} \n</script>",
"_____no_output_____"
],
[
"%%javascript\n\ntry {\n Jupyter.notebook.save_checkpoint();\n Jupyter.notebook.session.delete();\n}\ncatch(err) {\n // NoOp\n}",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb6ad7dfa2b6d5021aa1737a5f4b3623cc8d3215 | 6,798 | ipynb | Jupyter Notebook | storytelling-with-data-insights.ipynb | PryskaS/storytelling-data-practice | b8703a86982f1de3ed49f4d61f049f4276c0bea4 | [
"MIT"
]
| null | null | null | storytelling-with-data-insights.ipynb | PryskaS/storytelling-data-practice | b8703a86982f1de3ed49f4d61f049f4276c0bea4 | [
"MIT"
]
| null | null | null | storytelling-with-data-insights.ipynb | PryskaS/storytelling-data-practice | b8703a86982f1de3ed49f4d61f049f4276c0bea4 | [
"MIT"
]
| null | null | null | 26.97619 | 220 | 0.468667 | [
[
[
"# bibliotecas built-in\nimport datetime\nimport time\nimport warnings\n\n# biblioteca para enconding dos arquivos\nimport chardet\n\n# bibliotecas para análise gerais\nimport pandas as pd\nimport numpy as np\n\n# bibliotecas usadas para visualização\nimport matplotlib.pyplot as plt\n# https://blog.quantinsti.com/python-matplotlib-tutorial/?source=google&medium=cpc&campaign=dsa_other_topnations&gclid=Cj0KCQjw0PWRBhDKARIsAPKHFGi7sbP6zcTPTiR0wm9Rhdq-r0VDVqRrjqmHLhaBpW_TZUN73dcsJ_waArYTEALw_wcB\nimport seaborn as sns\nimport missingno as msno\n# https://github.com/ResidentMario/missingno\n\nimport plotly.express as px\nimport plotly.graph_objects as go\n\n%matplotlib inline\n\n# https://github.com/empathy87/storytelling-with-data",
"_____no_output_____"
],
[
"# Importa os dados\ndados = 'C:/Users/prisc/Documents/Projetos/6_repositories/storytelling-data-practice/marketing_campaign.csv'\n\ndf = pd.read_table(dados)\ndf.sample()",
"_____no_output_____"
],
[
"''' \nDados quantitativos com perídos determinados (meses, anos, etc) que precisam ser agrupados em montantes,\nsão melhores visualizados em linhas.\n'''\n\n# Dt_Customer",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code"
]
]
|
cb6ae2654fd9b3ebd022c8af0205d05d0309818a | 689,955 | ipynb | Jupyter Notebook | StatisticsForDecisionMaking/DQ/Coffee Survey Data Analysis.ipynb | vkgpt11/GreatLakesAssignments | 14daf30c617f79ab43df51ac8d82ef0afb9c9bf8 | [
"Apache-2.0"
]
| null | null | null | StatisticsForDecisionMaking/DQ/Coffee Survey Data Analysis.ipynb | vkgpt11/GreatLakesAssignments | 14daf30c617f79ab43df51ac8d82ef0afb9c9bf8 | [
"Apache-2.0"
]
| null | null | null | StatisticsForDecisionMaking/DQ/Coffee Survey Data Analysis.ipynb | vkgpt11/GreatLakesAssignments | 14daf30c617f79ab43df51ac8d82ef0afb9c9bf8 | [
"Apache-2.0"
]
| null | null | null | 450.95098 | 69,512 | 0.922844 | [
[
[
"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n%matplotlib inline",
"_____no_output_____"
]
],
[
[
"### Loading Data",
"_____no_output_____"
]
],
[
[
"data = pd.read_csv('Coffee.csv')",
"_____no_output_____"
]
],
[
[
"### Finding out the any missing values across columns\n\n**We can see there are no missing values**",
"_____no_output_____"
]
],
[
[
"pd.isnull(data).sum()",
"_____no_output_____"
]
],
[
[
"### Looking at some part of data",
"_____no_output_____"
]
],
[
[
"data.head()",
"_____no_output_____"
],
[
"data['No_of_Packet'] =data['No_of_Packet'].astype('category').cat.rename_categories(['one packet',\n 'two packets','three or more packets'])\n\n",
"_____no_output_____"
]
],
[
[
"### Note: We can see that all of our categorical features are numeric \n### Let's make it as categorical and assign proper categories to features, \n#### I am mapping categories form the word file given to us ",
"_____no_output_____"
]
],
[
[
"data['Price_per_Packet'] =data['Price_per_Packet'].astype('category').cat.rename_categories(['less than 6,50 DM',\n '6,50 DM to 8,50 DM','more than 8,50 DM'])\n\ndata['Brand'] =data['Brand'].astype('category').cat.rename_categories(['Jacobs Krönung',\n 'Jacobs other',\n 'Aldi',\n 'Aldi other', \n 'Eduscho Gala', \n 'Eduscho other', \n 'Tchibo Feine Milde',\n 'Tchibo other',\n 'Andere Kaffeemarken'])\n\ndata['Age'] =data['Age'].astype('category').cat.rename_categories(['less than 24 years',\n '25 to 39 years',\n '40 to 49 years',\n '50 to 59 years',\n '60 years or more'])\n\ndata['SEC'] =data['SEC'].astype('category').cat.rename_categories(['upper class',\n 'upper middle class',\n 'middle class',\n 'lower middle class',\n 'lower class'])\n\ndata['Income'] =data['Income'].astype('category').cat.rename_categories(['less than 1499 DM',\n '1500 to 2499 DM',\n '2500 to 3499 DM',\n '3500 DM or more'])\n\ndata['Price_Conscious'] =data['Price_Conscious'].astype('category').cat.rename_categories(['not at all',\n 'a little',\n 'price-conscious',\n 'distinctly price-conscious'])\ndata['Education'] =data['Education'].astype('category').cat.rename_categories(['nine-year elementary school',\n 'intermediate high school',\n 'high-school / university'])\ndata['Loyalty'] =data['Loyalty'].astype('category').cat.rename_categories(['Loyal',\n 'Not Loyal'])",
"_____no_output_____"
],
[
"data['IDNo'].value_counts().plot(kind='kde',color='red',)",
"_____no_output_____"
]
],
[
[
"## Data points are right skewed and has positive kurtosis",
"_____no_output_____"
]
],
[
[
"cat=data.dtypes[data.dtypes==\"category\"].index\n\ndata[cat].describe()",
"_____no_output_____"
]
],
[
[
"-------------------------------------------------\n#### Q1. Which brands of coffee are more popular? Given a brand, are all variants equally preferred?\n\n <font color='green'>**We can see from below graph and summary statistics that *Andere Kaffeemarken* is more popular brand. All brands are not equally preffered.** </font>\n\n-------------------------------------------------",
"_____no_output_____"
]
],
[
[
"brand_plot = data['Brand'].value_counts().plot.bar(grid=True,alpha = 0.3,rot=80,\n title=\"Popularity of brand\")\nbrand_plot.set_xlabel(\"Brands\")\nbrand_plot.set_ylabel(\"Counts\")",
"_____no_output_____"
],
[
"data['Brand'].value_counts()",
"_____no_output_____"
]
],
[
[
"-------------------------------------------------\n#### Q2. What are the prices of different brands of coffee?\n\n<font color='green'>**We can see from below graph and summary statistics that:** </font>\n* <font color='Blue'>*Aldi other* </font> is more cheaper brand. \n* <font color='Blue'>*Eduscho other* </font> is more costlier brand., because propotionally it is dominating over <font color='Blue'>*Tchibo other* </font>\n* <font color='Blue'>*Andere Kaffeemarken* </font> is neither cheap nor costly because its most of the data points has price per packet = **6,50 DM to 8,50 DM**\n\n<font color='Red'>**Inference:**<font color='Gray'> *Andere Kaffeemarken* is a more economical brand hance popular one\n\n-------------------------------------------------",
"_____no_output_____"
]
],
[
[
"df2 = data.groupby(['Brand', 'Price_per_Packet'])['Brand'].count().unstack('Price_per_Packet')\nprice_plot = df2.plot(kind='bar', stacked=False, grid=True,alpha = 0.7,rot=80,\n title=\"Prices of different Brands\")\nprice_plot.set_xlabel(\"Brands\")\nprice_plot.set_ylabel(\"Counts\")",
"_____no_output_____"
],
[
"pd.DataFrame(data.groupby(['Brand', 'Price_per_Packet'])['Brand'].count().unstack('Price_per_Packet'))",
"_____no_output_____"
]
],
[
[
"-------------------------------------------------\n#### Q3. How frequently does a household buy coffee? How many packets of coffee are bought at a time?\n\n-------------------------------------------------",
"_____no_output_____"
]
],
[
[
"data['Days_between_Purchase'].describe()",
"_____no_output_____"
]
],
[
[
"#### you can see from the above summary that max is 741 , min is 1, mean=15 Hence \n*Days_between_Purchase* has outliers, Lets find them & treat them ",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(10,4))\nplt.subplot(121)\ndata['Days_between_Purchase'].plot(kind='box')\nplt.title('Box plot for \\n Days between purchase(Outliers)')\nplt.subplot(122)\ndata['Days_between_Purchase'].plot(kind='kde')\nplt.title('Frequency Distribution of \\n days between purchase(Outliers)')",
"_____no_output_____"
],
[
"q75, q25 = np.percentile(data['Days_between_Purchase'], [75 ,25])\niqr = q75 - q25\n\nmin = q25 - (iqr*1.5)\nmax = q75 + (iqr*1.5)\nprint(min)\nprint(max)",
"-10.5\n33.5\n"
]
],
[
[
"#### We have outliers for max value not min value so lets forget about min value",
"_____no_output_____"
]
],
[
[
"print(\"Number of outliers:\",data[data['Days_between_Purchase']>max].shape[0])",
"Number of outliers: 11299\n"
],
[
"plt.figure(figsize=(10,4))\nplt.subplot(121)\ndata['Days_between_Purchase'][data.Days_between_Purchase<max].plot(kind='box')\nplt.title('Box plot for \\n Days between purchase(WithOut Outliers)')\n\nplt.subplot(122)\ndata['Days_between_Purchase'][data.Days_between_Purchase<max].plot(kind='kde')\nplt.title('Frequency Distribution of \\n days between purchase(WithOut Outliers)')",
"_____no_output_____"
],
[
"data['Days_between_Purchase'][data.Days_between_Purchase<max].describe()",
"_____no_output_____"
],
[
"plt.figure(figsize=(10,5))\nplt.subplot(121)\ndata[data.Days_between_Purchase>35]['Income'].value_counts().plot(kind='bar',alpha=.7,color=\"Green\",rot=100)\nplt.ylabel('Counts')\nplt.xlabel(\"Income\")\n\n\nplt.subplot(122)\ndata[data.Days_between_Purchase<35]['Income'].value_counts().plot(kind='bar',alpha=.7,color=\"Green\",rot=100)\nplt.ylabel('Counts')\nplt.xlabel(\"Income\")",
"_____no_output_____"
]
],
[
[
"#### Q4.a How frequently does a household buy coffee? \nBuying pattern is varying a lot but 30 % of the households are buying coffee within 5-7 days. followed 25% of households are buying within 9-13 days ",
"_____no_output_____"
],
[
"#### Q4.b How many packets of coffee are bought at a time?\nMostly households have purchased one packet of coffee",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(16,5))\nplt.subplot(121)\npd.qcut(data['Days_between_Purchase'][data.Days_between_Purchase<max], 6).value_counts().plot(kind='bar',alpha=.7,color=\"Green\",rot=360)\nplt.ylabel('Counts')\nplt.xlabel(\"Days Interval\")\nplt.title('Frequency of buying Coffee in Days')\nplt.subplot(122)\ndata['No_of_Packet'].value_counts().plot(kind='bar',alpha=.6,color=\"Orange\",rot=360)\nplt.ylabel('Counts')\nplt.xlabel(\"No Of Packets\")\nplt.title('Frequency of buying Coffee Packets')",
"_____no_output_____"
]
],
[
[
"-----------------------",
"_____no_output_____"
],
[
"### What are the factors that have an impact on a household’s coffee purchase pattern? Does brand preference depend on household size? Does purchase depend on a person’s income or education level?",
"_____no_output_____"
],
[
"#### Does brand preference depend on household size?\nNo, Famous and more economic is demanded more for all size of households",
"_____no_output_____"
]
],
[
[
"#plt.figure(figsize=(50,21))\ndf2 = data.groupby(['Brand', 'Household_Sz']).size().unstack('Household_Sz').sort_index()\ndf2.plot(kind='bar', stacked=False,alpha=.9,colormap='RdYlBu_r',rot=100, title='Brand Preference on Household Size')\nplt.xlabel('Brands')\nplt.ylabel('Counts')\n",
"_____no_output_____"
]
],
[
[
"#### Does purchase depend on a person’s income or education level?\nNot much",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(16,5))\nplt.subplot(121)\ndata['Education'].value_counts().plot(kind='bar',alpha=0.5,color=\"Red\",rot=300) #no\nplt.xlabel(\"Education\")\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Education\")\nplt.subplot(122)\ndata['Income'].value_counts().plot(kind='bar',alpha=.6,color='pink',rot=300) #no \nplt.xlabel(\"Income\")\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Income\")\n",
"_____no_output_____"
]
],
[
[
"#### What are the factors that have an impact on a household’s coffee purchase pattern?\n** Impact is in Decreasing order**\n* Age\n* Price_Conscious\n* SEC\n* Loyalty\n* Price_per_Packet",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(16,5))\nplt.subplot(131)\ndata['SEC'].value_counts().plot(kind='bar', color='gray',alpha=.7,rot=300) #yes\nplt.xlabel(\"Socio Economic Level\")\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Socio Economic Level\")\n\nplt.subplot(132)\ndata['Price_Conscious'].value_counts().plot(kind='bar', color='Green',alpha=.7,rot=300) #yes\nplt.xlabel(\"Price Consciousness\")\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Price Consciousness\")\n\n\nplt.subplot(133)\ndata['Loyalty'].value_counts().plot(kind='bar',color='Lime',alpha=.7,rot=300) #yes\nplt.xlabel(\"Loyalty\")\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Loyalty\")",
"_____no_output_____"
],
[
"plt.figure(figsize=(16,5))\nplt.subplot(131)\ndata['Age'].value_counts().plot(kind='bar', color='Orange',alpha=.7,rot=300) #yes\nplt.xlabel(\"Age\")\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Price Consciousness\")\n\nplt.subplot(132)\ndata['Price_per_Packet'].value_counts().plot(kind='bar', color='Purple',alpha=.7,rot=300) #yes\nplt.xlabel(\"Price Per Packet\")\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Price Per Packet\")\n\nplt.subplot(133)",
"_____no_output_____"
]
],
[
[
"### Are there any variables/columns you think will be eventually irrelevant for the study? Why?\n* Identification number of household, its a unique number assigned to a house hold",
"_____no_output_____"
],
[
"### Can you possibly identify some outliers?\n* As we saw previously, Days_between_Purchase has outliers",
"_____no_output_____"
],
[
"### For better analysis do you think a few brand variants needs to be clubbed together?\nyes, it will be usefull for coffee makers for better decision making",
"_____no_output_____"
],
[
"### Can you do some probability estimates- Say what is the probability that a randomly chosen household belongs to the top two social levels? What is the probability that households belonging to the top two social levels buy more expensive coffee?",
"_____no_output_____"
],
[
"0.34,.89",
"_____no_output_____"
],
[
"### You are also expected to identify a few (between 2 and 4) relevant business questions, aligning data against each question or pointing out if any relevant data is not available. ",
"_____no_output_____"
],
[
"### How does loyalty play a part in determining coffee purchasing patterns? Can the group take a shot at analysing how loyalty is reflected in various socio-economic classes and/or educational backgrounds?",
"_____no_output_____"
]
],
[
[
"data.groupby(['Loyalty','SEC']).size().unstack('Loyalty').plot(kind='bar', stacked=False,alpha=.7,rot=300)\nplt.xlabel(\"Socio Economic Level\")\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Socio Economic Level with Loyalty\")\n\n\ndata.groupby(['Loyalty','Education']).count().unstack('Education')['No_of_Packet'].plot(kind='bar', stacked=False,alpha=.7,rot=360)\nplt.legend(loc=1, fontsize = 'x-small',title='Education')\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Education with Loyalty\")",
"_____no_output_____"
],
[
"data.groupby(['Loyalty','Brand']).count().unstack('Brand')['No_of_Packet'].T.apply(lambda x: x / float(x.sum())).plot(kind='bar', stacked=False,alpha=.7)\nplt.legend(bbox_to_anchor=(2,1))\nplt.legend(loc=2, fontsize = 'x-small',title='Loyalty')\nplt.ylabel(\"Counts\")\nplt.title(\"Buying Frequency by Education with Loyalty\")",
"_____no_output_____"
],
[
"data.groupby(['Loyalty','Education']).count().unstack('Loyalty')['No_of_Packet'].apply(lambda x: x / float(x.sum()))",
"_____no_output_____"
],
[
"data.dtypes",
"_____no_output_____"
]
],
[
[
"# Lets Model the Data",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import train_test_split\nfrom sklearn.cluster import KMeans",
"_____no_output_____"
],
[
"# Remove all the data points having days between purchase \ndataForModeling = data[data.Days_between_Purchase>35]",
"_____no_output_____"
],
[
"features = ['No_of_Packet','Price_per_Packet','Days_between_Purchase', \n 'Age','SEC','Income','Household_Sz',\n 'Price_Conscious','Education','Loyalty','Brand'] ",
"_____no_output_____"
],
[
"estimators = [('k_means_8', KMeans(n_clusters=8)),\n ('k_means_3', KMeans(n_clusters=3)),\n ('k_means_bad_init', KMeans(n_clusters=3, n_init=1,\n init='random'))]",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
]
]
|
cb6ae29e1f92d635183ba60ef9de2358ffd37a42 | 49,990 | ipynb | Jupyter Notebook | Codemix_sentiment_classification/notebooks/transformer.ipynb | victor7246/Competition-Solutions | 0f9d440abd7523f33662b0da371705673ca82e60 | [
"MIT"
]
| 1 | 2020-04-13T13:48:23.000Z | 2020-04-13T13:48:23.000Z | Codemix_sentiment_classification/notebooks/transformer.ipynb | victor7246/Competition-Solutions | 0f9d440abd7523f33662b0da371705673ca82e60 | [
"MIT"
]
| null | null | null | Codemix_sentiment_classification/notebooks/transformer.ipynb | victor7246/Competition-Solutions | 0f9d440abd7523f33662b0da371705673ca82e60 | [
"MIT"
]
| null | null | null | 31.639241 | 789 | 0.483157 | [
[
[
"import pandas as pd\nimport numpy as np\nfrom tqdm import tqdm\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport re\n\nfrom nltk.corpus import stopwords\nstop = list(set(stopwords.words('english')))",
"_____no_output_____"
],
[
"f_train = open('../data/train_14k_split_conll.txt','r',encoding='utf8')\nline_train = f_train.readlines()\n\nf_val = open('../data/dev_3k_split_conll.txt','r',encoding='utf8')\nline_val = f_val.readlines()\n\nf_test = open('../data/Hindi_test_unalbelled_conll_updated.txt','r',encoding='utf8')\nline_test = f_test.readlines()",
"_____no_output_____"
],
[
"def get_data(lines):\n doc_count = 0\n i = 0\n #global train_word, train_word_type, train_doc_sentiment, train_uid, train_doc_id\n train_word = []\n train_word_type = []\n train_doc_sentiment = []\n train_uid = []\n train_doc_id = []\n\n while i < len(lines):\n '''\n if i < len(lines) and lines[i].split('\\t')[0] in ['http','https']:\n i += 1\n while i < len(lines) and lines[i].split('\\t')[0] != '/':\n i += 1\n \n i += 1 \n ''' \n\n if i < len(lines) and lines[i].split('\\t')[0] in ['@']:\n i += 2\n\n if i < len(lines):\n line = lines[i]\n line = line.replace('\\n','').strip().lower()\n if line.split('\\t')[0] == 'meta':\n doc_count += 1\n uid = int(line.split('\\t')[1])\n sentiment = line.split('\\t')[2]\n #if doc_count == 1575:\n # print (uid)\n i += 1\n\n elif len(line.split('\\t')) >= 2:\n if line.split('\\t')[0] not in stop:\n train_uid.append(uid)\n train_doc_sentiment.append(sentiment)\n train_word.append(line.split('\\t')[0])\n train_word_type.append(line.split('\\t')[1])\n train_doc_id.append(doc_count)\n\n i += 1\n\n else:\n i += 1\n\n train_df = pd.DataFrame()\n train_df['doc_id'] = train_doc_id\n train_df['word'] = train_word\n train_df['word_type'] = train_word_type\n train_df['uid'] = train_uid\n train_df['sentiment'] = train_doc_sentiment\n \n return train_df",
"_____no_output_____"
],
[
"def get_data_test(lines):\n doc_count = 0\n i = 0\n #global train_word, train_word_type, train_doc_sentiment, train_uid, train_doc_id\n train_word = []\n train_word_type = []\n train_uid = []\n train_doc_id = []\n\n while i < len(lines):\n '''\n if i < len(lines) and lines[i].split('\\t')[0] in ['http','https']:\n i += 1\n while i < len(lines) and lines[i].split('\\t')[0] != '/':\n i += 1\n \n i += 1 \n ''' \n\n if i < len(lines) and lines[i].split('\\t')[0] in ['@']:\n i += 2\n\n if i < len(lines):\n line = lines[i]\n line = line.replace('\\n','').strip().lower()\n if line.split('\\t')[0] == 'meta':\n doc_count += 1\n uid = int(line.split('\\t')[1])\n #if doc_count == 1575:\n # print (uid)\n i += 1\n\n elif len(line.split('\\t')) >= 2:\n if line.split('\\t')[0] not in stop:\n train_uid.append(uid)\n train_word.append(line.split('\\t')[0])\n train_word_type.append(line.split('\\t')[1])\n train_doc_id.append(doc_count)\n\n i += 1\n\n else:\n i += 1\n\n train_df = pd.DataFrame()\n train_df['doc_id'] = train_doc_id\n train_df['word'] = train_word\n train_df['word_type'] = train_word_type\n train_df['uid'] = train_uid\n \n return train_df",
"_____no_output_____"
],
[
"train_df = get_data(line_train)\nval_df = get_data(line_val)\ntest_df = get_data_test(line_test)",
"_____no_output_____"
],
[
"train_df.shape, val_df.shape, test_df.shape",
"_____no_output_____"
],
[
"train_df.uid.nunique(), val_df.uid.nunique(), test_df.uid.nunique()",
"_____no_output_____"
],
[
"train_df = train_df[train_df.word != 'http']\ntrain_df = train_df[train_df.word != 'https']\ntrain_df = train_df[train_df.word_type != 'o']\nprint (train_df.shape)\n\nval_df = val_df[val_df.word != 'http']\nval_df = val_df[val_df.word != 'https']\nval_df = val_df[val_df.word_type != 'o']\nprint (val_df.shape)\n\ntest_df = test_df[test_df.word != 'http']\ntest_df = test_df[test_df.word != 'https']\ntest_df = test_df[test_df.word_type != 'o']\nprint (test_df.shape)",
"(223215, 5)\n(48339, 5)\n(47683, 4)\n"
],
[
"train_df.word = train_df.word.apply(lambda x: re.sub(\"[^a-zA-Z0-9]\", \"\",x))\ntrain_df = train_df[train_df.word.str.len() >= 3]\nprint (train_df.shape)\n\nval_df.word = val_df.word.apply(lambda x: re.sub(\"[^a-zA-Z0-9]\", \"\",x))\nval_df = val_df[val_df.word.str.len() >= 3]\nprint (val_df.shape)\n\ntest_df.word = test_df.word.apply(lambda x: re.sub(\"[^a-zA-Z0-9]\", \"\",x))\ntest_df = test_df[test_df.word.str.len() >= 3]\nprint (test_df.shape)",
"(175903, 5)\n(38082, 5)\n(37583, 4)\n"
],
[
"all_words = set(pd.concat([train_df[['word']],val_df[['word']],test_df[['word']]], axis=0).word)\nprint (\"Total number of words {}\".format(len(all_words)))",
"Total number of words 51515\n"
],
[
"all_words = pd.concat([train_df[['word']],val_df[['word']],test_df[['word']]], axis=0)\nall_words = all_words.word.value_counts().reset_index()\nall_words.columns = ['word','tot_count']\ntop_words = all_words[all_words.tot_count >= 2]\nprint (top_words.shape)\nprint (top_words.head(5))",
"(16771, 2)\n word tot_count\n0 hai 5902\n1 nahi 3744\n2 bhi 1965\n3 aur 1799\n4 modi 1415\n"
],
[
"all_bert_words = pd.DataFrame(['[PAD]','[UNK]','[CLS]','[SEP]'],columns=['word'])\nall_bert_words = pd.concat([all_bert_words,top_words[['word']].drop_duplicates().reset_index(drop=True)],axis=0)\nall_bert_words.to_csv(\"../bert_vocab.txt\",index=False,header=False)",
"_____no_output_____"
],
[
"train_texts = train_df.groupby(['uid'],sort=True)['word'].apply(lambda x: \" \".join(x)).reset_index()\ntrain_texts = pd.merge(train_texts,train_df[['uid','sentiment']],how='left').drop_duplicates().reset_index(drop=True)\ntrain_texts.columns = ['uid','text','sentiment']\n#train_texts.text = train_texts.text.apply(lambda x: '[CLS] ' + x + ' [SEP]')\n\nval_texts = val_df.groupby(['uid'],sort=True)['word'].apply(lambda x: \" \".join(x)).reset_index().reset_index(drop=True)\nval_texts = pd.merge(val_texts,val_df[['uid','sentiment']],how='left').drop_duplicates()\nval_texts.columns = ['uid','text','sentiment']\n#val_texts.text = val_texts.text.apply(lambda x: '[CLS] ' + x + ' [SEP]')\n\ntest_texts = test_df.groupby(['uid'],sort=True)['word'].apply(lambda x: \" \".join(x)).reset_index().reset_index(drop=True)\ntest_texts.columns = ['uid','text']\n#test_texts.text = test_texts.text.apply(lambda x: '[CLS] ' + x + ' [SEP]')\n",
"_____no_output_____"
],
[
"train_texts.head(5)",
"_____no_output_____"
],
[
"test_texts.head(5)",
"_____no_output_____"
],
[
"all_texts = pd.concat([train_texts[['uid','text','sentiment']],val_texts[['uid','text','sentiment']]],axis=0)\nall_texts.sentiment.value_counts()",
"_____no_output_____"
],
[
"from transformers import BertTokenizer, BertConfig, BertModel\nimport torch\nimport math\nimport torch.nn as nn\nimport torch.nn.functional as F\nfrom keras.preprocessing.sequence import pad_sequences\nfrom keras.utils import to_categorical",
"I0226 21:23:37.660035 4645359040 file_utils.py:38] PyTorch version 1.2.0 available.\nUsing TensorFlow backend.\n"
],
[
"tokenizer = BertTokenizer.from_pretrained('../bert_vocab.txt')",
"I0226 21:23:49.973178 4645359040 tokenization_utils.py:335] Model name '../bert_vocab.txt' not found in model shortcut name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese, bert-base-german-cased, bert-large-uncased-whole-word-masking, bert-large-cased-whole-word-masking, bert-large-uncased-whole-word-masking-finetuned-squad, bert-large-cased-whole-word-masking-finetuned-squad, bert-base-cased-finetuned-mrpc, bert-base-german-dbmdz-cased, bert-base-german-dbmdz-uncased, bert-base-finnish-cased-v1, bert-base-finnish-uncased-v1, bert-base-dutch-cased). Assuming '../bert_vocab.txt' is a path, a model identifier, or url to a directory containing tokenizer files.\nW0226 21:23:49.974266 4645359040 tokenization_utils.py:347] Calling BertTokenizer.from_pretrained() with the path to a single file or url is deprecated\nI0226 21:23:49.975219 4645359040 tokenization_utils.py:416] loading file ../bert_vocab.txt\n"
],
[
"max_len = 20",
"_____no_output_____"
],
[
"n_output = all_texts.sentiment.nunique() #number of possible outputs\nsenti_dict = {'negative':0,'neutral':1,'positive':2}\nin_senti_dict = {0:'negative',1:'neutral',2:'positive'}\nall_texts.sentiment = all_texts.sentiment.apply(lambda x: senti_dict[x])",
"_____no_output_____"
],
[
"train_tokens = []\nfor text in tqdm(all_texts.text.values.tolist()):\n train_tokens += [tokenizer.encode(text,add_special_tokens=False)]",
"100%|██████████| 17000/17000 [00:04<00:00, 3798.18it/s]\n"
],
[
"test_tokens = []\nfor text in tqdm(test_texts.text.values.tolist()):\n test_tokens += [tokenizer.encode(text,add_special_tokens=False)]",
"100%|██████████| 3000/3000 [00:00<00:00, 3306.15it/s]\n"
],
[
"train_tokens_padded = []\ntrain_attention_mask = []\ntrain_seg_ids = []\n\nfor tokens in tqdm(train_tokens):\n tokens = tokens[:max_len]\n token_len = len(tokens)\n one_mask = [1]*token_len\n zero_mask = [0]*(max_len-token_len)\n padded_input = tokens + zero_mask\n attention_mask = one_mask + zero_mask\n \n segments = []\n first_sep = True\n current_segment_id = 0\n for token in tokens:\n segments.append(current_segment_id)\n if token == 3:\n current_segment_id = 1\n segments = segments + [0] * (max_len - len(tokens))\n \n train_tokens_padded += [padded_input]\n train_attention_mask += [attention_mask]\n train_seg_ids += [segments]",
"100%|██████████| 17000/17000 [00:00<00:00, 191819.56it/s]\n"
],
[
"test_tokens_padded = []\ntest_attention_mask = []\ntest_seg_ids = []\n\nfor tokens in tqdm(test_tokens):\n tokens = tokens[:max_len]\n token_len = len(tokens)\n one_mask = [1]*token_len\n zero_mask = [0]*(max_len-token_len)\n padded_input = tokens + zero_mask\n attention_mask = one_mask + zero_mask\n \n segments = []\n first_sep = True\n current_segment_id = 0\n for token in tokens:\n segments.append(current_segment_id)\n if token == 102:\n current_segment_id = 1\n segments = segments + [0] * (max_len - len(tokens))\n \n test_tokens_padded += [padded_input]\n test_attention_mask += [attention_mask]\n test_seg_ids += [segments]",
"100%|██████████| 3000/3000 [00:00<00:00, 192431.63it/s]\n"
],
[
"print (train_tokens_padded[0], train_attention_mask[0], train_seg_ids[0])",
"[13, 865, 17, 1, 2223, 2737, 2918, 9642, 8725, 3591, 86, 1, 9033, 2145, 1, 1, 0, 0, 0, 0] [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"
],
[
"train_output = torch.LongTensor(to_categorical(all_texts.sentiment))",
"_____no_output_____"
],
[
"train_tokens_padded = torch.LongTensor(np.asarray(train_tokens_padded))\ntrain_attention_mask = torch.LongTensor(np.asarray(train_attention_mask))\ntrain_seg_ids = torch.LongTensor(np.asarray(train_seg_ids))\ntest_tokens_padded = torch.LongTensor(np.asarray(test_tokens_padded))\ntest_attention_mask = torch.LongTensor(np.asarray(test_attention_mask))\ntest_seg_ids = torch.LongTensor(np.asarray(test_seg_ids))",
"_____no_output_____"
],
[
"print (train_tokens_padded.shape, train_attention_mask.shape, train_seg_ids.shape, test_tokens_padded.shape, test_attention_mask.shape, test_seg_ids.shape)\n",
"torch.Size([17000, 20]) torch.Size([17000, 20]) torch.Size([17000, 20]) torch.Size([3000, 20]) torch.Size([3000, 20]) torch.Size([3000, 20])\n"
],
[
"dev_tokens_padded = train_tokens_padded[train_texts.shape[0]:]\ntrain_tokens_padded = train_tokens_padded[:train_texts.shape[0]]\n\ndev_attention_mask = train_attention_mask[train_texts.shape[0]:]\ntrain_attention_mask = train_attention_mask[:train_texts.shape[0]]\n\ndev_seg_ids = train_seg_ids[train_texts.shape[0]:]\ntrain_seg_ids = train_seg_ids[:train_texts.shape[0]]\n\ndev_output = train_output[train_texts.shape[0]:]\ntrain_output = train_output[:train_texts.shape[0]]",
"_____no_output_____"
],
[
"from torch.utils.data import DataLoader, TensorDataset\nfrom sklearn.metrics import f1_score, accuracy_score",
"_____no_output_____"
],
[
"batch_size = 128",
"_____no_output_____"
],
[
"train_data = TensorDataset(train_tokens_padded, train_output)\nval_data = TensorDataset(dev_tokens_padded, dev_output)\n\n#dataloader\ntrain_loader = DataLoader(train_data, batch_size=batch_size, shuffle=True)\nval_loader = DataLoader(val_data, batch_size=batch_size, shuffle=True)",
"_____no_output_____"
],
[
"class TransformerModel(nn.Module):\n\n def __init__(self, ntoken, ninp, nhead, nhid, nlayers, nout, dropout=0.5):\n super(TransformerModel, self).__init__()\n from torch.nn import TransformerEncoder, TransformerEncoderLayer\n self.model_type = 'Transformer'\n self.src_mask = None\n self.pos_encoder = PositionalEncoding(ninp, dropout)\n encoder_layers = TransformerEncoderLayer(ninp, nhead, nhid, dropout)\n self.transformer_encoder = TransformerEncoder(encoder_layers, nlayers)\n self.encoder = nn.Embedding(ntoken, ninp)\n self.ninp = ninp\n self.decoder = nn.Linear(ninp, nout)\n\n self.init_weights()\n\n def _generate_square_subsequent_mask(self, sz):\n mask = (torch.triu(torch.ones(sz, sz)) == 1).transpose(0, 1)\n mask = mask.float().masked_fill(mask == 0, float('-inf')).masked_fill(mask == 1, float(0.0))\n return mask\n\n def init_weights(self):\n initrange = 0.1\n self.encoder.weight.data.uniform_(-initrange, initrange)\n self.decoder.bias.data.zero_()\n self.decoder.weight.data.uniform_(-initrange, initrange)\n\n def forward(self, src):\n if self.src_mask is None or self.src_mask.size(0) != len(src):\n device = src.device\n mask = self._generate_square_subsequent_mask(len(src)).to(device)\n self.src_mask = mask\n\n src = self.encoder(src) * math.sqrt(self.ninp)\n #print (src.shape)\n src = self.pos_encoder(src)\n output = self.transformer_encoder(src, self.src_mask)\n output = self.decoder(torch.mean(output,1))\n return output\n \nclass PositionalEncoding(nn.Module):\n\n def __init__(self, d_model, dropout=0.1, max_len=max_len):\n super(PositionalEncoding, self).__init__()\n self.dropout = nn.Dropout(p=dropout)\n\n pe = torch.zeros(max_len, d_model)\n position = torch.arange(0, max_len, dtype=torch.float).unsqueeze(1)\n div_term = torch.exp(torch.arange(0, d_model, 2).float() * (-math.log(10000.0) / d_model))\n pe[:, 0::2] = torch.sin(position * div_term)\n pe[:, 1::2] = torch.cos(position * div_term)\n pe = pe.unsqueeze(0) #.transpose(0, 1)\n self.register_buffer('pe', pe)\n\n def forward(self, x):\n #print (self.pe.shape)\n x = x + self.pe\n return self.dropout(x)",
"_____no_output_____"
],
[
"device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\nntokens = tokenizer.vocab_size # the size of vocabulary\nemsize = 200 # embedding dimension\nnhid = 200 # the dimension of the feedforward network model in nn.TransformerEncoder\nnlayers = 4 # the number of nn.TransformerEncoderLayer in nn.TransformerEncoder\nnhead = 8 # the number of heads in the multiheadattention models\ndropout = 0.2 # the dropout value\nnout = all_texts.sentiment.nunique()\nmodel = TransformerModel(ntokens, emsize, nhead, nhid, nlayers, nout, dropout)\nepochs = 20",
"_____no_output_____"
],
[
"model",
"_____no_output_____"
],
[
"print (\"Total number of parameters to learn {}\".format(sum(p.numel() for p in model.parameters() if p.requires_grad)))",
"Total number of parameters to learn 4323603\n"
],
[
"optimizer = torch.optim.Adam(model.parameters(),lr=.001)\ncriterion = torch.nn.CrossEntropyLoss()\n\nmodel = model.to(device)\ncriterion = criterion.to(device)",
"_____no_output_____"
],
[
"def binary_accuracy(preds, y):\n \"\"\"\n Returns accuracy per batch, i.e. if you get 8/10 right, this returns 0.8, NOT 8\n \"\"\"\n\n #round predictions to the closest integer\n if device == 'cpu':\n rounded_preds = preds.detach().numpy().argmax(1)\n rounded_correct = y.detach().numpy().argmax(1)\n else:\n rounded_preds = preds.detach().cpu().numpy().argmax(1)\n rounded_correct = y.detach().cpu().numpy().argmax(1)\n \n return accuracy_score(rounded_correct,rounded_preds)",
"_____no_output_____"
],
[
"def f1_torch(preds, y):\n \"\"\"\n Returns accuracy per batch, i.e. if you get 8/10 right, this returns 0.8, NOT 8\n \"\"\"\n\n #round predictions to the closest integer\n if device == 'cpu':\n rounded_preds = preds.detach().numpy().argmax(1)\n rounded_correct = y.detach().numpy().argmax(1)\n else:\n rounded_preds = preds.detach().cpu().numpy().argmax(1)\n rounded_correct = y.detach().cpu().numpy().argmax(1)\n \n return f1_score(rounded_correct,rounded_preds,average='macro')",
"_____no_output_____"
],
[
"def train(model, train_loader, optimizer, criterion):\n global predictions, labels, loss\n \n epoch_loss = 0\n epoch_acc = 0\n f1_scores = 0\n \n model.train()\n \n counter = 0\n for tokens, labels in tqdm(train_loader):\n \n counter += 1\n \n optimizer.zero_grad()\n \n predictions = model(tokens) #.squeeze(1)\n predictions = torch.softmax(predictions,dim=-1)\n \n #loss = criterion(predictions, labels)\n loss = criterion(predictions, torch.max(labels, 1)[1])\n \n acc = binary_accuracy(predictions, labels)\n f1_score_batch = f1_torch(predictions, labels)\n \n loss.backward()\n \n optimizer.step()\n \n epoch_loss += loss.item()\n epoch_acc += acc\n f1_scores += f1_score_batch\n \n return epoch_loss / counter, epoch_acc / counter, f1_scores/counter",
"_____no_output_____"
],
[
"def evaluate(model, val_loader, criterion):\n \n epoch_loss = 0\n epoch_acc = 0\n f1_scores = 0\n \n model.eval()\n \n counter = 0\n with torch.no_grad():\n for tokens, labels in tqdm(val_loader):\n\n counter += 1\n\n\n predictions = model(tokens) #.squeeze(1)\n predictions = torch.softmax(predictions,dim=-1)\n \n #loss = criterion(predictions, labels)\n loss = criterion(predictions, torch.max(labels, 1)[1])\n\n acc = binary_accuracy(predictions, labels)\n f1_score_batch = f1_torch(predictions, labels)\n \n epoch_loss += loss.item()\n epoch_acc += acc\n f1_scores += f1_score_batch\n \n return epoch_loss / counter, epoch_acc / counter, f1_scores/counter",
"_____no_output_____"
],
[
"import time\n\ndef epoch_time(start_time, end_time):\n elapsed_time = end_time - start_time\n elapsed_mins = int(elapsed_time / 60)\n elapsed_secs = int(elapsed_time - (elapsed_mins * 60))\n return elapsed_mins, elapsed_secs",
"_____no_output_____"
],
[
"best_valid_loss = 999\n\nfor epoch in range(epochs):\n \n start_time = time.time()\n \n train_loss, train_acc, train_f1 = train(model, train_loader, optimizer, criterion)\n valid_loss, valid_acc, valid_f1 = evaluate(model, val_loader, criterion)\n \n end_time = time.time()\n \n epoch_mins, epoch_secs = epoch_time(start_time, end_time)\n \n if valid_loss < best_valid_loss:\n best_valid_loss = valid_loss\n torch.save(model.state_dict(), '../models/model_transformer.pt')\n \n print(f'Epoch: {epoch+1:02} | Epoch Time: {epoch_mins}m {epoch_secs}s')\n print(f'\\tTrain Loss: {train_loss:.3f} | Train Acc: {train_acc*100:.2f}% | Train F1: {train_f1*100:.2f}%')\n print(f'\\t Val. Loss: {valid_loss:.3f} | Val. Acc: {valid_acc*100:.2f}% | Val F1: {valid_f1*100:.2f}%')",
"100%|██████████| 110/110 [01:23<00:00, 1.31it/s]\n100%|██████████| 24/24 [00:03<00:00, 7.66it/s]\n 0%| | 0/110 [00:00<?, ?it/s]"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6aeccb3b7e9d96fa026e4236ddf1ff4f4bfd12 | 423,700 | ipynb | Jupyter Notebook | NETWORK INTRUSION DETECTION SYSTEM/NIDS.ipynb | fireman0865/BIG-DATA | 0600098f2c6545a3830181023246b906984b4c62 | [
"Apache-2.0"
]
| null | null | null | NETWORK INTRUSION DETECTION SYSTEM/NIDS.ipynb | fireman0865/BIG-DATA | 0600098f2c6545a3830181023246b906984b4c62 | [
"Apache-2.0"
]
| null | null | null | NETWORK INTRUSION DETECTION SYSTEM/NIDS.ipynb | fireman0865/BIG-DATA | 0600098f2c6545a3830181023246b906984b4c62 | [
"Apache-2.0"
]
| null | null | null | 56.148953 | 6,016 | 0.293996 | [
[
[
"import pyspark ",
"_____no_output_____"
],
[
"import pandas as pd",
"_____no_output_____"
],
[
"import csv",
"_____no_output_____"
],
[
"from pyspark.ml.feature import ChiSqSelector\nfrom pyspark.ml.linalg import Vectors",
"_____no_output_____"
],
[
"from pyspark import SparkContext ,SparkConf",
"_____no_output_____"
],
[
"from pyspark.ml import Pipeline",
"_____no_output_____"
],
[
"from pyspark.ml.feature import OneHotEncoder, StringIndexer",
"_____no_output_____"
],
[
"from pyspark import SQLContext as sql",
"_____no_output_____"
],
[
"from pyspark.ml.feature import StringIndexer,HashingTF, IDF, Tokenizer",
"_____no_output_____"
],
[
"import matplotlib.pyplot as plt",
"_____no_output_____"
],
[
"conf=SparkConf()",
"_____no_output_____"
],
[
"context=SparkContext(conf=conf)",
"_____no_output_____"
],
[
"sql_context=sql(context)",
"_____no_output_____"
],
[
"from pyspark.ml.linalg import Vectors",
"_____no_output_____"
],
[
"from pyspark.ml.feature import OneHotEncoderEstimator, StringIndexer, VectorAssembler",
"_____no_output_____"
],
[
"from pyspark.ml.feature import VectorAssembler,Normalizer",
"_____no_output_____"
],
[
"from pyspark.ml.classification import LinearSVC",
"_____no_output_____"
],
[
"col_names = [\"duration\",\"protocol_type\",\"service\",\"flag\",\"src_bytes\",\n \"dst_bytes\",\"land\",\"wrong_fragment\",\"urgent\",\"hot\",\"num_failed_logins\",\n \"logged_in\",\"num_compromised\",\"root_shell\",\"su_attempted\",\"num_root\",\n \"num_file_creations\",\"num_shells\",\"num_access_files\",\"num_outbound_cmds\",\n \"is_host_login\",\"is_guest_login\",\"count\",\"srv_count\",\"serror_rate\",\n \"srv_serror_rate\",\"rerror_rate\",\"srv_rerror_rate\",\"same_srv_rate\",\n \"diff_srv_rate\",\"srv_diff_host_rate\",\"dst_host_count\",\"dst_host_srv_count\",\n \"dst_host_same_srv_rate\",\"dst_host_diff_srv_rate\",\"dst_host_same_src_port_rate\",\n \"dst_host_srv_diff_host_rate\",\"dst_host_serror_rate\",\"dst_host_srv_serror_rate\",\n \"dst_host_rerror_rate\",\"dst_host_srv_rerror_rate\",\"label\"]\n",
"_____no_output_____"
],
[
"pdd=pd.read_csv(\"/home/salman/Documents/KDDTrain.csv\",names=col_names)",
"_____no_output_____"
],
[
"pdd",
"_____no_output_____"
],
[
"df=sql_context.createDataFrame(pdd)",
"_____no_output_____"
],
[
"from pyspark.mllib.regression import LabeledPoint\nfrom pyspark.ml.classification import OneVsRest\n ",
"_____no_output_____"
],
[
"from pyspark.ml.classification import DecisionTreeClassifier\nfrom pyspark.ml.feature import StringIndexer, VectorIndexer",
"_____no_output_____"
],
[
"for col_name in pdd.columns:\n if pdd[col_name].dtypes == 'object' :\n unique_cat = len(pdd[col_name].unique())\n print(\"Feature '{col_name}' has {unique_cat} categories\".format(col_name=col_name, unique_cat=unique_cat))",
"Feature 'duration' has 3 categories\nFeature 'protocol_type' has 68 categories\nFeature 'service' has 11 categories\nFeature 'dst_host_srv_rerror_rate' has 23 categories\n"
],
[
"categorical_columns=['protocol_type', 'service', 'duration','dst_host_srv_rerror_rate','label']",
"_____no_output_____"
],
[
"df_categorical_values = df[categorical_columns]",
"_____no_output_____"
],
[
"#labelencoder",
"_____no_output_____"
],
[
"stringIndexer = StringIndexer(inputCol=\"dst_host_srv_rerror_rate\", outputCol=\"labeled\")",
"_____no_output_____"
],
[
"model_string=stringIndexer.fit(df_categorical_values)",
"_____no_output_____"
],
[
"indexed=model_string.transform(df_categorical_values)",
"_____no_output_____"
],
[
"indexed.show(3000)",
"+-------------+-------+--------+------------------------+-----+-------+\n|protocol_type|service|duration|dst_host_srv_rerror_rate|label|labeled|\n+-------------+-------+--------+------------------------+-----+-------+\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| other| SF| udp| normal| 15.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| remote_job| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 15.0| 8.0|\n| name| S0| tcp| neptune| 19.0| 1.0|\n| netbios_ns| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| mtp| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| mtp| S0| tcp| neptune| 19.0| 1.0|\n| telnet| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| portsweep| 20.0| 4.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| SF| udp| normal| 19.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| supdup| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| S0| tcp| neptune| 19.0| 1.0|\n| Z39_50| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| csnet_ns| S0| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| teardrop| 16.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 12.0| 8.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 17.0| 6.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| finger| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| satan| 18.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| netbios_dgm| RSTR| tcp| portsweep| 14.0| 4.0|\n| http| S0| tcp| neptune| 19.0| 1.0|\n| netbios_dgm| REJ| tcp| neptune| 20.0| 1.0|\n| supdup| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| urp_i| SF| icmp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| auth| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| REJ| tcp| neptune| 19.0| 1.0|\n| domain| S0| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| S0| tcp| neptune| 19.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| csnet_ns| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| teardrop| 16.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| Z39_50| REJ| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| REJ| tcp| neptune| 19.0| 1.0|\n| bgp| REJ| tcp| neptune| 19.0| 1.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| bgp| S0| tcp| neptune| 18.0| 1.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| ftp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ldap| REJ| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| supdup| S0| tcp| neptune| 18.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| bgp| REJ| tcp| neptune| 18.0| 1.0|\n| netbios_dgm| REJ| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| gopher| SH| tcp| nmap| 18.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 11.0| 8.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| vmnet| S0| tcp| neptune| 20.0| 1.0|\n| systat| S0| tcp| neptune| 18.0| 1.0|\n| http_443| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| efs| S0| tcp| neptune| 19.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| whois| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 17.0| 0.0|\n| remote_job| S0| tcp| neptune| 21.0| 1.0|\n| other| RSTR| tcp| portsweep| 15.0| 4.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| gopher| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| imap4| REJ| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| whois| S0| tcp| neptune| 18.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| other| REJ| tcp| satan| 18.0| 2.0|\n| other| SF| udp| satan| 20.0| 2.0|\n| iso_tsap| S0| tcp| neptune| 19.0| 1.0|\n| ecr_i| SF| icmp| normal| 16.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| warezclient| 2.0| 8.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| echo| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| portsweep| 18.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| klogin| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netbios_ns| S0| tcp| neptune| 20.0| 1.0|\n| private| REJ| tcp| satan| 18.0| 2.0|\n| ecr_i| SF| icmp| pod| 14.0| 10.0|\n| iso_tsap| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| link| S0| tcp| neptune| 18.0| 1.0|\n| sunrpc| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| login| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| warezclient| 12.0| 8.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| kshell| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| urp_i| SF| icmp| normal| 18.0| 0.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp| RSTO| tcp| neptune| 20.0| 1.0|\n| auth| S0| tcp| neptune| 20.0| 1.0|\n| kshell| S0| tcp| neptune| 21.0| 1.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| vmnet| S0| tcp| neptune| 18.0| 1.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| telnet| SF| tcp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| RSTR| tcp| portsweep| 15.0| 4.0|\n| sql_net| SH| tcp| nmap| 19.0| 6.0|\n| ecr_i| SF| icmp| smurf| 17.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| vmnet| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| mtp| REJ| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| auth| REJ| tcp| neptune| 19.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| vmnet| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| telnet| SF| tcp| normal| 11.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| bgp| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| ftp| S0| tcp| neptune| 18.0| 1.0|\n| time| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| ftp| RSTO| tcp| normal| 13.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| sql_net| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| hostnames| REJ| tcp| neptune| 19.0| 1.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| warezclient| 12.0| 8.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| smtp| S0| tcp| normal| 17.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| time| RSTR| tcp| portsweep| 14.0| 4.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| uucp| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| exec| RSTO| tcp| neptune| 18.0| 1.0|\n| netbios_dgm| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| private| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| Z39_50| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 19.0| 0.0|\n| http_443| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| REJ| tcp| portsweep| 18.0| 4.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ntp_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| bgp| S0| tcp| neptune| 20.0| 1.0|\n| urp_i| SF| icmp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| discard| S0| tcp| neptune| 20.0| 1.0|\n| private| REJ| tcp| ipsweep| 16.0| 3.0|\n| private| REJ| tcp| portsweep| 18.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| supdup| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| REJ| tcp| satan| 18.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| REJ| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| sql_net| S0| tcp| neptune| 21.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| SF| tcp| back| 13.0| 7.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| nntp| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| courier| S0| tcp| neptune| 18.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 20.0| 0.0|\n| ftp| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| time| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| telnet| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| exec| RSTO| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| login| S0| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| normal| 18.0| 0.0|\n| http| REJ| tcp| normal| 20.0| 0.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp| RSTO| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| satan| 17.0| 2.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| telnet| SF| tcp| normal| 19.0| 0.0|\n| private| REJ| tcp| ipsweep| 17.0| 3.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| login| RSTO| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 18.0| 1.0|\n| ctf| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| vmnet| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| urp_i| SF| icmp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| link| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| login| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| ssh| S0| tcp| neptune| 20.0| 1.0|\n| time| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| REJ| tcp| satan| 17.0| 2.0|\n| domain| S0| tcp| neptune| 19.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| SF| udp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| login| S0| tcp| neptune| 20.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| ftp| SF| tcp| warezclient| 15.0| 8.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| normal| 19.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| exec| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| mtp| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp| SF| tcp| normal| 20.0| 0.0|\n| uucp_path| S0| tcp| neptune| 20.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| Z39_50| REJ| tcp| neptune| 20.0| 1.0|\n| private| SF| udp| satan| 17.0| 2.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| smtp| RSTO| tcp| normal| 17.0| 0.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| S0| tcp| neptune| 12.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| daytime| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ldap| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| ftp_data| SF| tcp| warezclient| 14.0| 8.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| Z39_50| S0| tcp| neptune| 18.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 17.0| 0.0|\n| private| REJ| tcp| ipsweep| 17.0| 3.0|\n| bgp| S0| tcp| neptune| 18.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| time| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| time| RSTO| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| netbios_dgm| S0| tcp| neptune| 19.0| 1.0|\n| ftp| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| warezclient| 12.0| 8.0|\n| whois| REJ| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| telnet| SF| tcp| normal| 18.0| 0.0|\n| other| SF| tcp| normal| 20.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| remote_job| RSTR| tcp| portsweep| 15.0| 4.0|\n| discard| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 19.0| 1.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| shell| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| RSTR| tcp| portsweep| 15.0| 4.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| back| 12.0| 7.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netbios_ns| REJ| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| systat| REJ| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| supdup| S0| tcp| neptune| 20.0| 1.0|\n| private| REJ| tcp| ipsweep| 15.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 16.0| 4.0|\n| private| REJ| tcp| portsweep| 20.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| kshell| S0| tcp| neptune| 19.0| 1.0|\n| hostnames| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp| RSTO| tcp| neptune| 18.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| csnet_ns| REJ| tcp| portsweep| 16.0| 4.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| echo| S0| tcp| neptune| 19.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| klogin| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| ftp| S0| tcp| neptune| 19.0| 1.0|\n| ctf| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ssh| S0| tcp| portsweep| 20.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| supdup| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| other| REJ| tcp| satan| 20.0| 2.0|\n| other| SF| udp| satan| 19.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| teardrop| 17.0| 9.0|\n| iso_tsap| REJ| tcp| neptune| 18.0| 1.0|\n| ftp| SF| tcp| normal| 19.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netbios_ns| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| ldap| REJ| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| back| 10.0| 7.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| urp_i| SF| icmp| normal| 19.0| 0.0|\n| auth| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| telnet| RSTO| tcp| guess_passwd| 13.0| 11.0|\n| auth| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| normal| 19.0| 0.0|\n| nntp| S0| tcp| neptune| 18.0| 1.0|\n| http| S1| tcp| normal| 18.0| 0.0|\n| private| REJ| tcp| portsweep| 20.0| 4.0|\n| imap4| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| teardrop| 18.0| 9.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| shell| SF| tcp| normal| 13.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| private| REJ| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 13.0| 8.0|\n| domain| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netstat| REJ| tcp| neptune| 20.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| uucp| S0| tcp| neptune| 19.0| 1.0|\n| pop_3| SF| tcp| normal| 20.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| vmnet| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| nnsp| S0| tcp| neptune| 19.0| 1.0|\n| name| S0| tcp| neptune| 19.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 19.0| 1.0|\n| netbios_dgm| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| gopher| REJ| tcp| neptune| 20.0| 1.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| ftp_data| S0| tcp| neptune| 17.0| 1.0|\n| ssh| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| iso_tsap| REJ| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain| S0| tcp| neptune| 20.0| 1.0|\n| ftp| RSTO| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 12.0| 8.0|\n| Z39_50| S0| tcp| neptune| 18.0| 1.0|\n| discard| S0| tcp| neptune| 20.0| 1.0|\n| auth| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| other| RSTR| tcp| portsweep| 15.0| 4.0|\n| ftp_data| SF| tcp| warezclient| 11.0| 8.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| ftp| SF| tcp| normal| 20.0| 0.0|\n| hostnames| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ecr_i| SF| icmp| smurf| 17.0| 5.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| exec| S0| tcp| neptune| 20.0| 1.0|\n| link| S0| tcp| neptune| 18.0| 1.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| netstat| S0| tcp| neptune| 18.0| 1.0|\n| echo| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| hostnames| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| other| SF| tcp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 19.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| Z39_50| REJ| tcp| portsweep| 18.0| 4.0|\n| iso_tsap| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| other| SF| udp| normal| 17.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| gopher| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| portsweep| 18.0| 4.0|\n| name| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| normal| 21.0| 0.0|\n| ftp_data| REJ| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| hostnames| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| IRC| S1| tcp| normal| 17.0| 0.0|\n| private| RSTR| tcp| portsweep| 14.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| daytime| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| imap4| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| private| SF| udp| satan| 11.0| 2.0|\n| exec| S0| tcp| neptune| 18.0| 1.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| iso_tsap| S0| tcp| neptune| 20.0| 1.0|\n| mtp| S0| tcp| neptune| 18.0| 1.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| http| REJ| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| klogin| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 20.0| 1.0|\n| bgp| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| bgp| S0| tcp| neptune| 20.0| 1.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| gopher| S0| tcp| neptune| 18.0| 1.0|\n| bgp| S0| tcp| neptune| 19.0| 1.0|\n| private| REJ| tcp| neptune| 18.0| 1.0|\n| private| REJ| tcp| satan| 14.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 16.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| eco_i| SF| icmp| nmap| 17.0| 6.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| uucp| S0| tcp| neptune| 19.0| 1.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 21.0| 4.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ftp| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| portsweep| 20.0| 4.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| discard| S0| tcp| neptune| 19.0| 1.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| nmap| 18.0| 6.0|\n| echo| S0| tcp| neptune| 18.0| 1.0|\n| supdup| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| REJ| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| pop_2| S0| tcp| neptune| 21.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| supdup| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| efs| REJ| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| S1| tcp| normal| 18.0| 0.0|\n| netbios_ns| REJ| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp| RSTO| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| finger| RSTO| tcp| neptune| 20.0| 1.0|\n| courier| REJ| tcp| neptune| 20.0| 1.0|\n| ldap| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| ftp_data| SF| tcp| normal| 12.0| 0.0|\n| efs| REJ| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| other| S0| tcp| satan| 21.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| printer| RSTO| tcp| neptune| 21.0| 1.0|\n| nntp| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| IRC| RSTR| tcp| normal| 21.0| 0.0|\n| telnet| SF| tcp| normal| 9.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| normal| 19.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| time| S0| tcp| neptune| 20.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ctf| S0| tcp| neptune| 19.0| 1.0|\n| other| RSTR| tcp| portsweep| 15.0| 4.0|\n| echo| S0| tcp| neptune| 20.0| 1.0|\n| sunrpc| S0| tcp| neptune| 20.0| 1.0|\n| telnet| RSTR| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| gopher| S0| tcp| neptune| 21.0| 1.0|\n| other| SF| udp| normal| 17.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| imap4| S0| tcp| neptune| 18.0| 1.0|\n| private| REJ| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 19.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| iso_tsap| S0| tcp| neptune| 21.0| 1.0|\n| auth| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| daytime| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| time| RSTR| tcp| portsweep| 14.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| auth| S0| tcp| neptune| 20.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| private| REJ| tcp| satan| 18.0| 2.0|\n| ftp_data| SF| tcp| warezclient| 10.0| 8.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| private| RSTOS0| tcp| portsweep| 20.0| 4.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| discard| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| REJ| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| RSTOS0| tcp| portsweep| 9.0| 4.0|\n| smtp| SF| tcp| satan| 2.0| 2.0|\n| telnet| RSTO| tcp| normal| 8.0| 0.0|\n| time| RSTO| tcp| neptune| 19.0| 1.0|\n| klogin| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 17.0| 0.0|\n| hostnames| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 19.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 17.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| ftp| SF| tcp| warezclient| 2.0| 8.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| systat| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| hostnames| S0| tcp| neptune| 20.0| 1.0|\n| klogin| S0| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| discard| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| ipsweep| 16.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| time| SF| tcp| normal| 20.0| 0.0|\n| gopher| REJ| tcp| neptune| 20.0| 1.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| other| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| time| S0| tcp| neptune| 19.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| RSTO| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| finger| S0| tcp| neptune| 18.0| 1.0|\n| smtp| S0| tcp| normal| 16.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| RSTO| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| warezclient| 13.0| 8.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| nmap| 13.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| iso_tsap| S0| tcp| neptune| 19.0| 1.0|\n| tim_i| SF| icmp| pod| 7.0| 10.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| link| S0| tcp| neptune| 19.0| 1.0|\n| discard| S0| tcp| neptune| 20.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| name| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| exec| S0| tcp| neptune| 19.0| 1.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| domain| S0| tcp| neptune| 20.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| iso_tsap| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| auth| SF| tcp| normal| 20.0| 0.0|\n| whois| S0| tcp| neptune| 19.0| 1.0|\n| eco_i| SF| icmp| nmap| 16.0| 6.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| urp_i| SF| icmp| normal| 19.0| 0.0|\n| private| SF| udp| normal| 20.0| 0.0|\n| private| SF| udp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| IRC| RSTR| tcp| normal| 17.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| bgp| REJ| tcp| neptune| 20.0| 1.0|\n| ftp| S0| tcp| neptune| 18.0| 1.0|\n| pop_3| S0| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| remote_job| REJ| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| RSTO| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| echo| S0| tcp| neptune| 19.0| 1.0|\n| private| REJ| tcp| satan| 17.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| REJ| tcp| portsweep| 18.0| 4.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| efs| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| private| SF| udp| satan| 18.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| neptune| 20.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| Z39_50| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| neptune| 19.0| 1.0|\n| private| SH| tcp| nmap| 18.0| 6.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 19.0| 0.0|\n| netstat| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| ecr_i| SF| icmp| pod| 18.0| 10.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| teardrop| 18.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| S0| tcp| neptune| 20.0| 1.0|\n| uucp| RSTO| tcp| neptune| 20.0| 1.0|\n| uucp_path| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 16.0| 6.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 8.0| 8.0|\n| nnsp| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| eco_i| SF| icmp| nmap| 17.0| 6.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| private| SF| udp| normal| 19.0| 0.0|\n| other| SF| udp| satan| 13.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| normal| 18.0| 0.0|\n| uucp_path| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| exec| S0| tcp| neptune| 20.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| telnet| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| ecr_i| SF| icmp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| nmap| 12.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| pop_3| RSTO| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| imap4| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| other| REJ| tcp| satan| 18.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| nnsp| S0| tcp| neptune| 20.0| 1.0|\n| uucp_path| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ctf| S0| tcp| neptune| 20.0| 1.0|\n| echo| S0| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| uucp| RSTO| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| nnsp| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| csnet_ns| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| domain| S0| tcp| neptune| 18.0| 1.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| netbios_ns| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| pm_dump| SF| tcp| satan| 3.0| 2.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| uucp_path| REJ| tcp| neptune| 20.0| 1.0|\n| iso_tsap| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| normal| 17.0| 0.0|\n| link| REJ| tcp| ipsweep| 15.0| 3.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| ftp| SF| tcp| warezclient| 8.0| 8.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| efs| S0| tcp| neptune| 20.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| nnsp| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 16.0| 6.0|\n| finger| SF| tcp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| SF| udp| satan| 18.0| 2.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| name| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| systat| RSTOS0| tcp| portsweep| 20.0| 4.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| exec| S0| tcp| neptune| 20.0| 1.0|\n| domain| S0| tcp| neptune| 18.0| 1.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http_443| REJ| tcp| neptune| 18.0| 1.0|\n| private| REJ| tcp| ipsweep| 15.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 18.0| 1.0|\n| other| REJ| tcp| satan| 17.0| 2.0|\n| ssh| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| exec| REJ| tcp| satan| 20.0| 2.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| warezclient| 15.0| 8.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| satan| 18.0| 2.0|\n| supdup| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| nntp| RSTO| tcp| neptune| 19.0| 1.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| private| SF| udp| teardrop| 12.0| 9.0|\n| private| SF| udp| teardrop| 18.0| 9.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| mtp| S0| tcp| neptune| 21.0| 1.0|\n| login| S0| tcp| neptune| 20.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| vmnet| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| netbios_dgm| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| Z39_50| REJ| tcp| neptune| 19.0| 1.0|\n| login| S0| tcp| neptune| 20.0| 1.0|\n| uucp_path| S0| tcp| neptune| 20.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| ctf| S0| tcp| neptune| 21.0| 1.0|\n| other| REJ| tcp| satan| 17.0| 2.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| finger| RSTO| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| iso_tsap| S0| tcp| neptune| 19.0| 1.0|\n| other| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| REJ| tcp| satan| 20.0| 2.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| IRC| RSTR| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| Z39_50| S0| tcp| neptune| 19.0| 1.0|\n| klogin| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| teardrop| 16.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| gopher| S0| tcp| neptune| 18.0| 1.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| normal| 20.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| sunrpc| RSTO| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| time| RSTO| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| normal| 17.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ldap| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| normal| 17.0| 0.0|\n| gopher| S0| tcp| neptune| 21.0| 1.0|\n| gopher| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S1| tcp| normal| 5.0| 0.0|\n| whois| REJ| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| sunrpc| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| vmnet| REJ| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| back| 12.0| 7.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| SF| udp| satan| 16.0| 2.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| link| S0| tcp| neptune| 20.0| 1.0|\n| private| SF| udp| normal| 21.0| 0.0|\n| name| S0| tcp| neptune| 18.0| 1.0|\n| daytime| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 19.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| vmnet| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| exec| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 15.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| RSTO| tcp| normal| 7.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| telnet| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| ftp| SF| tcp| normal| 18.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| daytime| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 18.0| 1.0|\n| bgp| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| nnsp| S0| tcp| neptune| 20.0| 1.0|\n| iso_tsap| REJ| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| bgp| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| imap4| S0| tcp| neptune| 19.0| 1.0|\n| courier| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| nnsp| S0| tcp| neptune| 19.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| supdup| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| S0| tcp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| normal| 18.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| ipsweep| 17.0| 3.0|\n| private| RSTOS0| tcp| portsweep| 20.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| imap4| S0| tcp| neptune| 18.0| 1.0|\n| iso_tsap| RSTR| tcp| portsweep| 16.0| 4.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| S1| tcp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 20.0| 1.0|\n| gopher| S0| tcp| neptune| 20.0| 1.0|\n| echo| RSTO| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| red_i| SF| icmp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| iso_tsap| S0| tcp| neptune| 21.0| 1.0|\n| uucp_path| S0| tcp| neptune| 20.0| 1.0|\n| hostnames| S0| tcp| neptune| 20.0| 1.0|\n| telnet| SF| tcp| normal| 19.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| other| SF| tcp| normal| 20.0| 0.0|\n| telnet| SF| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| nmap| 13.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain| SF| tcp| normal| 15.0| 0.0|\n| ftp_data| REJ| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| sql_net| S0| tcp| neptune| 20.0| 1.0|\n| ftp| SF| tcp| warezclient| 8.0| 8.0|\n| private| SF| udp| satan| 17.0| 2.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| supdup| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| IRC| RSTR| tcp| normal| 17.0| 0.0|\n| ssh| S0| tcp| neptune| 19.0| 1.0|\n| time| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| SF| tcp| normal| 17.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| ftp_data| SF| tcp| normal| 17.0| 0.0|\n| private| SF| udp| teardrop| 18.0| 9.0|\n| auth| SF| tcp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| login| S0| tcp| neptune| 18.0| 1.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| netbios_ns| SH| tcp| nmap| 19.0| 6.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 12.0| 8.0|\n| daytime| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| http| S0| tcp| neptune| 17.0| 1.0|\n| login| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| normal| 18.0| 0.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| neptune| 20.0| 1.0|\n| finger| SF| tcp| normal| 17.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| RSTO| tcp| normal| 18.0| 0.0|\n| auth| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| link| S0| tcp| neptune| 19.0| 1.0|\n| sunrpc| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| S0| tcp| neptune| 17.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 16.0| 6.0|\n| http| SF| tcp| back| 12.0| 7.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| other| SF| udp| normal| 17.0| 0.0|\n| discard| S0| tcp| neptune| 19.0| 1.0|\n| ctf| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| ldap| S0| tcp| neptune| 18.0| 1.0|\n| ftp| SF| tcp| normal| 15.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| other| REJ| tcp| satan| 20.0| 2.0|\n| finger| SF| tcp| ipsweep| 1.0| 3.0|\n| Z39_50| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| private| SF| udp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| iso_tsap| S0| tcp| neptune| 20.0| 1.0|\n| echo| RSTR| tcp| portsweep| 13.0| 4.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| finger| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 13.0| 8.0|\n| ctf| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp| RSTO| tcp| neptune| 19.0| 1.0|\n| klogin| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| normal| 20.0| 0.0|\n| nnsp| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| S3| tcp| normal| 14.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| uucp_path| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| time| RSTO| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| name| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| smtp| S0| tcp| neptune| 18.0| 1.0|\n| Z39_50| REJ| tcp| neptune| 18.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 20.0| 1.0|\n| nnsp| REJ| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| ipsweep| 16.0| 3.0|\n| private| SF| udp| satan| 17.0| 2.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| REJ| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| whois| S0| tcp| neptune| 19.0| 1.0|\n| auth| REJ| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| normal| 16.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| warezclient| 6.0| 8.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| csnet_ns| REJ| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 17.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| finger| RSTO| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| kshell| S0| tcp| neptune| 20.0| 1.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| IRC| RSTR| tcp| normal| 20.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| netstat| REJ| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| nnsp| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| csnet_ns| REJ| tcp| neptune| 19.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 20.0| 0.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| teardrop| 16.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| systat| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| vmnet| REJ| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 17.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| nnsp| S0| tcp| neptune| 19.0| 1.0|\n| ftp| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| hostnames| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| RSTO| tcp| satan| 16.0| 2.0|\n| ssh| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| S0| tcp| normal| 16.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| back| 12.0| 7.0|\n| netbios_ssn| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| hostnames| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| eco_i| SF| icmp| normal| 18.0| 0.0|\n| http| SF| tcp| back| 15.0| 7.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| back| 10.0| 7.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| ftp_data| S0| tcp| neptune| 19.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| ftp_data| SF| tcp| normal| 12.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| other| REJ| tcp| satan| 18.0| 2.0|\n| systat| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| gopher| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| urp_i| SF| icmp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| rje| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| normal| 16.0| 0.0|\n| mtp| S0| tcp| neptune| 18.0| 1.0|\n| sql_net| REJ| tcp| neptune| 20.0| 1.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| telnet| S1| tcp| normal| 5.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| normal| 16.0| 0.0|\n| bgp| REJ| tcp| neptune| 18.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| urp_i| SF| icmp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| netbios_ssn| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ssh| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| auth| S0| tcp| neptune| 19.0| 1.0|\n| other| RSTR| tcp| portsweep| 15.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| REJ| tcp| satan| 17.0| 2.0|\n| netbios_ns| S0| tcp| neptune| 20.0| 1.0|\n| exec| S0| tcp| neptune| 18.0| 1.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| exec| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 17.0| 0.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ssh| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 20.0| 0.0|\n| login| S0| tcp| neptune| 19.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| klogin| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| SF| udp| satan| 13.0| 2.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netstat| S0| tcp| neptune| 19.0| 1.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| smurf| 17.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| nnsp| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| vmnet| REJ| tcp| neptune| 20.0| 1.0|\n| bgp| RSTR| tcp| portsweep| 15.0| 4.0|\n| other| SF| udp| normal| 17.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| echo| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| time| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp| SF| tcp| warezclient| 3.0| 8.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| normal| 17.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| normal| 17.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| other| REJ| tcp| satan| 20.0| 2.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| systat| S0| tcp| neptune| 18.0| 1.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| vmnet| S0| tcp| neptune| 20.0| 1.0|\n| sql_net| S0| tcp| neptune| 19.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| netbios_ns| S0| tcp| neptune| 20.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| finger| S0| tcp| neptune| 18.0| 1.0|\n| auth| REJ| tcp| neptune| 18.0| 1.0|\n| finger| SF| tcp| normal| 18.0| 0.0|\n| supdup| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| time| RSTO| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp| RSTO| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| time| RSTO| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| uucp_path| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| finger| RSTO| tcp| neptune| 20.0| 1.0|\n| http| S0| tcp| neptune| 19.0| 1.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| RSTO| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| finger| SF| tcp| normal| 20.0| 0.0|\n| ftp| RSTO| tcp| neptune| 20.0| 1.0|\n| urp_i| SF| icmp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| Z39_50| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| auth| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| auth| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| satan| 18.0| 2.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| telnet| SF| tcp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| iso_tsap| REJ| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| gopher| SF| tcp| ipsweep| 9.0| 3.0|\n| ftp| SF| tcp| warezclient| 6.0| 8.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| mtp| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| eco_i| SF| icmp| normal| 20.0| 0.0|\n| http_443| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| S0| tcp| neptune| 20.0| 1.0|\n| nnsp| S0| tcp| neptune| 18.0| 1.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| ssh| REJ| tcp| ipsweep| 14.0| 3.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| SF| udp| teardrop| 18.0| 9.0|\n| http| SF| tcp| back| 12.0| 7.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| iso_tsap| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| auth| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 18.0| 2.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| private| SF| udp| satan| 15.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netbios_ssn| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| http| S2| tcp| back| 10.0| 7.0|\n| http| SF| tcp| back| 12.0| 7.0|\n| kshell| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 20.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| ftp| SF| tcp| ftp_write| 7.0| 21.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| private| SH| tcp| nmap| 17.0| 6.0|\n| ftp_data| SF| tcp| normal| 10.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| portsweep| 20.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 18.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| S2| tcp| normal| 16.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| vmnet| REJ| tcp| neptune| 18.0| 1.0|\n| kshell| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| kshell| REJ| tcp| neptune| 20.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| neptune| 19.0| 1.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| discard| S0| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| teardrop| 15.0| 9.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| gopher| S0| tcp| neptune| 21.0| 1.0|\n| name| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| S0| tcp| neptune| 20.0| 1.0|\n| ftp| S0| tcp| neptune| 20.0| 1.0|\n| other| REJ| tcp| satan| 20.0| 2.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| ftp| SF| tcp| normal| 17.0| 0.0|\n| other| REJ| tcp| satan| 17.0| 2.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| nnsp| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| SF| tcp| normal| 20.0| 0.0|\n| ftp_data| S0| tcp| neptune| 19.0| 1.0|\n| domain| SF| tcp| normal| 15.0| 0.0|\n| eco_i| SF| icmp| nmap| 18.0| 6.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| daytime| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| ftp| S0| tcp| neptune| 19.0| 1.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| http| S0| tcp| neptune| 17.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| normal| 20.0| 0.0|\n| ctf| S0| tcp| neptune| 19.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| exec| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| back| 12.0| 7.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| RSTR| tcp| portsweep| 15.0| 4.0|\n| http| S0| tcp| neptune| 20.0| 1.0|\n| other| REJ| tcp| normal| 19.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| pod| 12.0| 10.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain| SF| tcp| normal| 15.0| 0.0|\n| http| S1| tcp| normal| 20.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| time| S0| tcp| neptune| 19.0| 1.0|\n| kshell| REJ| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| exec| RSTO| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| telnet| SF| tcp| normal| 13.0| 0.0|\n| klogin| S0| tcp| neptune| 19.0| 1.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| whois| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| Z39_50| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| http_443| S0| tcp| neptune| 18.0| 1.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| eco_i| SF| icmp| nmap| 10.0| 6.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| link| S0| tcp| neptune| 19.0| 1.0|\n| kshell| REJ| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| ftp| RSTO| tcp| ipsweep| 9.0| 3.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| Z39_50| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| telnet| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| pop_3| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| finger| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| time| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| csnet_ns| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| S0| tcp| neptune| 20.0| 1.0|\n| imap4| REJ| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 19.0| 1.0|\n| private| SF| udp| normal| 19.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| smtp| SF| tcp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| discard| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| name| REJ| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 19.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| csnet_ns| S0| tcp| neptune| 18.0| 1.0|\n| login| S0| tcp| neptune| 18.0| 1.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| S0| tcp| normal| 18.0| 0.0|\n| whois| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| satan| 18.0| 2.0|\n| ftp_data| S1| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 17.0| 0.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| private| REJ| tcp| neptune| 18.0| 1.0|\n| courier| S0| tcp| neptune| 20.0| 1.0|\n| echo| RSTO| tcp| neptune| 19.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 16.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| RSTO| tcp| neptune| 20.0| 1.0|\n| courier| S0| tcp| neptune| 21.0| 1.0|\n| netbios_dgm| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| S0| tcp| neptune| 20.0| 1.0|\n| ftp| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| sql_net| S0| tcp| neptune| 20.0| 1.0|\n| netbios_ns| REJ| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| imap4| S0| tcp| neptune| 18.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| REJ| tcp| neptune| 20.0| 1.0|\n| netbios_dgm| S0| tcp| neptune| 21.0| 1.0|\n| netbios_ns| REJ| tcp| neptune| 18.0| 1.0|\n| ftp| SF| tcp| warezclient| 6.0| 8.0|\n| supdup| REJ| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| pop_2| REJ| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ctf| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| bgp| S0| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| supdup| S0| tcp| neptune| 20.0| 1.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| netbios_ns| S0| tcp| neptune| 21.0| 1.0|\n| other| REJ| tcp| normal| 19.0| 0.0|\n| private| REJ| tcp| portsweep| 18.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SH| tcp| nmap| 18.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| courier| S0| tcp| neptune| 20.0| 1.0|\n| whois| RSTR| tcp| portsweep| 17.0| 4.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| systat| S0| tcp| neptune| 20.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SH| tcp| nmap| 18.0| 6.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| ftp_data| SF| tcp| normal| 16.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| auth| REJ| tcp| neptune| 19.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ecr_i| SF| icmp| normal| 20.0| 0.0|\n| ntp_u| SF| udp| normal| 21.0| 0.0|\n| http| S1| tcp| normal| 19.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| Z39_50| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| ftp| SF| tcp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| name| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| urp_i| SF| icmp| normal| 18.0| 0.0|\n| auth| REJ| tcp| neptune| 20.0| 1.0|\n| ftp_data| REJ| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| Z39_50| REJ| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| csnet_ns| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| urp_i| SF| icmp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 20.0| 1.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| nntp| S0| tcp| neptune| 19.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| nnsp| REJ| tcp| neptune| 21.0| 1.0|\n| ldap| S0| tcp| neptune| 18.0| 1.0|\n| sunrpc| S0| tcp| neptune| 19.0| 1.0|\n| ftp_data| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| SF| udp| satan| 17.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| RSTO| tcp| neptune| 20.0| 1.0|\n| iso_tsap| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netbios_ns| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| uucp_path| REJ| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| supdup| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 19.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| back| 15.0| 7.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| uucp_path| S0| tcp| neptune| 19.0| 1.0|\n| link| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| time| S0| tcp| neptune| 19.0| 1.0|\n| auth| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| ftp_data| SF| tcp| normal| 17.0| 0.0|\n| private| SF| udp| teardrop| 12.0| 9.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| csnet_ns| S0| tcp| neptune| 19.0| 1.0|\n| mtp| S0| tcp| neptune| 19.0| 1.0|\n| private| SF| udp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| urp_i| SF| icmp| normal| 19.0| 0.0|\n| exec| S0| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| satan| 19.0| 2.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| gopher| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| SF| tcp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ctf| S0| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| satan| 16.0| 2.0|\n| private| SF| udp| satan| 18.0| 2.0|\n| klogin| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| private| SF| udp| normal| 20.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| private| SF| udp| satan| 18.0| 2.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| nmap| 15.0| 6.0|\n| http| S1| tcp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| netstat| S0| tcp| neptune| 21.0| 1.0|\n| finger| S0| tcp| neptune| 18.0| 1.0|\n| kshell| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain| S0| tcp| neptune| 20.0| 1.0|\n| hostnames| S0| tcp| neptune| 19.0| 1.0|\n| netstat| S0| tcp| neptune| 18.0| 1.0|\n| other| REJ| tcp| satan| 20.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| auth| S0| tcp| neptune| 20.0| 1.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| exec| S0| tcp| neptune| 18.0| 1.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netbios_ssn| REJ| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| systat| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| REJ| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| Z39_50| REJ| tcp| neptune| 20.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| private| REJ| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| telnet| RSTO| tcp| guess_passwd| 10.0| 11.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| back| 11.0| 7.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 18.0| 1.0|\n| urp_i| SF| icmp| normal| 21.0| 0.0|\n| finger| SF| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 19.0| 1.0|\n| gopher| S0| tcp| neptune| 20.0| 1.0|\n| link| S0| tcp| neptune| 20.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| warezclient| 3.0| 8.0|\n| mtp| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| whois| REJ| tcp| neptune| 19.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| private| REJ| tcp| ipsweep| 16.0| 3.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| finger| S0| tcp| neptune| 18.0| 1.0|\n| echo| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| courier| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| S0| tcp| neptune| 20.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| kshell| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 19.0| 0.0|\n| pop_3| SF| tcp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp_data| S0| tcp| neptune| 20.0| 1.0|\n| imap4| S0| tcp| neptune| 20.0| 1.0|\n| ftp_data| SF| tcp| normal| 14.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| Z39_50| REJ| tcp| neptune| 18.0| 1.0|\n| auth| RSTO| tcp| normal| 14.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 19.0| 1.0|\n| remote_job| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| REJ| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| name| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| private| REJ| tcp| satan| 17.0| 2.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| private| SH| tcp| nmap| 18.0| 6.0|\n| ecr_i| SF| icmp| smurf| 18.0| 5.0|\n| private| RSTR| tcp| portsweep| 15.0| 4.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| vmnet| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| other| SF| udp| satan| 19.0| 2.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| courier| S0| tcp| neptune| 19.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| private| SF| udp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| private| SF| udp| normal| 18.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 19.0| 5.0|\n| urp_i| SF| icmp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| telnet| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ftp| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| smurf| 20.0| 5.0|\n| efs| S0| tcp| neptune| 20.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ecr_i| SF| icmp| pod| 15.0| 10.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 16.0| 3.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netstat| S0| tcp| neptune| 21.0| 1.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| ftp| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| nntp| REJ| tcp| portsweep| 20.0| 4.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| private| REJ| tcp| satan| 20.0| 2.0|\n| courier| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 19.0| 0.0|\n| private| SF| udp| normal| 20.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| ftp_data| SF| tcp| normal| 21.0| 0.0|\n| whois| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| exec| S0| tcp| neptune| 20.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| ldap| S0| tcp| neptune| 20.0| 1.0|\n| bgp| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 20.0| 0.0|\n| ftp_data| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| private| SF| udp| nmap| 8.0| 6.0|\n| eco_i| SF| icmp| ipsweep| 15.0| 3.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| private| SF| udp| nmap| 14.0| 6.0|\n| eco_i| SF| icmp| ipsweep| 17.0| 3.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain| S0| tcp| neptune| 18.0| 1.0|\n| whois| S0| tcp| neptune| 19.0| 1.0|\n| ftp_data| SF| tcp| normal| 20.0| 0.0|\n| private| RSTR| tcp| portsweep| 18.0| 4.0|\n| private| REJ| tcp| neptune| 21.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| netbios_dgm| S0| tcp| neptune| 21.0| 1.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 21.0| 1.0|\n| domain_u| SF| udp| normal| 18.0| 0.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n| private| S0| tcp| neptune| 18.0| 1.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| other| SF| udp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 20.0| 0.0|\n| smtp| SF| tcp| normal| 21.0| 0.0|\n| http| SF| tcp| normal| 21.0| 0.0|\n| mtp| S0| tcp| neptune| 19.0| 1.0|\n| private| SF| udp| satan| 20.0| 2.0|\n| uucp| S0| tcp| neptune| 20.0| 1.0|\n| domain_u| SF| udp| normal| 21.0| 0.0|\n+-------------+-------+--------+------------------------+-----+-------+\nonly showing top 3000 rows\n\n"
],
[
"#encoder\n",
"_____no_output_____"
],
[
"encoder = OneHotEncoder(inputCol=\"labeled\", outputCol=\"features\")",
"_____no_output_____"
],
[
"encoded = encoder.transform(indexed)",
"_____no_output_____"
],
[
"VA=VectorAssembler(inputCols=[\"label\",\"labelVec\"],outputCol=\"features\",handleInvalid =\"skip\")",
"_____no_output_____"
],
[
"selector = ChiSqSelector(numTopFeatures=4, featuresCol=\"features\",\n outputCol=\"selectedFeatures\", labelCol=\"labeled\")",
"_____no_output_____"
],
[
"print(\"ChiSqSelector output with top %d features selected\" % selector.getNumTopFeatures())",
"ChiSqSelector output with top 4 features selected\n"
],
[
"Normalized=Normalizer(inputCol=\"features\",outputCol=\"features_norm\",p=1.0)",
"_____no_output_____"
],
[
"result = selector.fit(encoded).transform(encoded)",
"_____no_output_____"
],
[
"result.show()",
"+-------------+-------+--------+------------------------+-----+-------+--------------+----------------+\n|protocol_type|service|duration|dst_host_srv_rerror_rate|label|labeled| features|selectedFeatures|\n+-------------+-------+--------+------------------------+-----+-------+--------------+----------------+\n| ftp_data| SF| tcp| normal| 20.0| 0.0|(22,[0],[1.0])| (4,[0],[1.0])|\n| other| SF| udp| normal| 15.0| 0.0|(22,[0],[1.0])| (4,[0],[1.0])|\n| private| S0| tcp| neptune| 19.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| http| SF| tcp| normal| 21.0| 0.0|(22,[0],[1.0])| (4,[0],[1.0])|\n| http| SF| tcp| normal| 21.0| 0.0|(22,[0],[1.0])| (4,[0],[1.0])|\n| private| REJ| tcp| neptune| 21.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| private| S0| tcp| neptune| 21.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| private| S0| tcp| neptune| 21.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| remote_job| S0| tcp| neptune| 21.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| private| S0| tcp| neptune| 21.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| private| REJ| tcp| neptune| 21.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| private| S0| tcp| neptune| 21.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| http| SF| tcp| normal| 21.0| 0.0|(22,[0],[1.0])| (4,[0],[1.0])|\n| ftp_data| SF| tcp| warezclient| 15.0| 8.0|(22,[8],[1.0])| (4,[],[])|\n| name| S0| tcp| neptune| 19.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| netbios_ns| S0| tcp| neptune| 18.0| 1.0|(22,[1],[1.0])| (4,[1],[1.0])|\n| http| SF| tcp| normal| 21.0| 0.0|(22,[0],[1.0])| (4,[0],[1.0])|\n| eco_i| SF| icmp| ipsweep| 18.0| 3.0|(22,[3],[1.0])| (4,[3],[1.0])|\n| http| SF| tcp| normal| 21.0| 0.0|(22,[0],[1.0])| (4,[0],[1.0])|\n| http| SF| tcp| normal| 21.0| 0.0|(22,[0],[1.0])| (4,[0],[1.0])|\n+-------------+-------+--------+------------------------+-----+-------+--------------+----------------+\nonly showing top 20 rows\n\n"
],
[
"labelIndexer = StringIndexer(inputCol=\"labeled\", outputCol=\"indexedLabel\").fit(result)",
"_____no_output_____"
],
[
"featureIndexer =\\\n VectorIndexer(inputCol=\"features\", outputCol=\"indexedFeatures\", maxCategories=4).fit(result)\n",
"_____no_output_____"
],
[
"dt = DecisionTreeClassifier(labelCol=\"indexedLabel\", featuresCol=\"indexedFeatures\")\n\n",
"_____no_output_____"
],
[
"pipeline = Pipeline(stages=[labelIndexer, featureIndexer, dt])",
"_____no_output_____"
],
[
"(trainingData, testData) = result.randomSplit([0.7, 0.3])",
"_____no_output_____"
],
[
"model = pipeline.fit(trainingData)",
"_____no_output_____"
],
[
"predictions = model.transform(testData)",
"_____no_output_____"
],
[
"p=predictions.toPandas()",
"_____no_output_____"
],
[
"p.head(3000)",
"_____no_output_____"
],
[
"normal=[0.0]\nattackdos=[1.0,5.0,7.0,9.0,10.0,1]\nattackprobe=[5.0,4.0,3.0,2.0,6.0,2,3,4,5,6]\nattackr2l=[8.0,11.0]\ntotalnotu2r=[0.0,1.0,5.0,7.0,9.0,10.0,1,5.0,4.0,3.0,2.0,6.0,2,3,4,5,6,8.0,11.0]\n\ndef replace():\n for x in p['prediction'] : \n if x==0.0:\n p['prediction'].replace(to_replace=[0.0], value='normal',inplace=True)\n elif x in attackdos:\n p['prediction'].replace(to_replace=[1.0,5.0,7.0,9.0,10.0,1], value=' ATTACK DOS',inplace=True)\n elif x in attackprobe:\n p['prediction'].replace(to_replace=[5.0,4.0,3.0,2.0,6.0,2,3,4,5,6], value=' ATTACK PROBE',inplace=True)\n elif x in [8.0,11.0]:\n p['prediction'].replace(to_replace=[8.0,11.0], value=' ATTACK R2L',inplace=True)\n elif x in [12.0,13.0]:\n p['prediction'].replace(to_replace=[12.0,13.0], value=' ATTACK U2L',inplace=True)\n \n \nif __name__=='__main__':\n replace()",
"_____no_output_____"
],
[
"p.head(1000)",
"_____no_output_____"
],
[
"p[\"prediction\"].value_counts()",
"_____no_output_____"
],
[
"normal=7952\nAttackdos=5825\nAttackprobe=1217\nTotal=normal+Attackdos+Attackprobe",
"_____no_output_____"
],
[
"%matplotlib inline\nimport matplotlib.pyplot as plt\nplt.style.use('seaborn-whitegrid')\nimport numpy as np\n\nfig = plt.figure()\nax = plt.axes()\n\nnormal = np.linspace(0,7952)\nax.plot(normal, np.sin(attac),label='Normal');\n\nattackdos = np.linspace(0,5825)\nax.plot(attackdos, np.sin(attac),label='Attack Dos'); \n\nattackprobe = np.linspace(0,1217)\nax.plot(attackprobe, np.sin(attac),label='Attack Probe'); \n\nplt.legend();",
"_____no_output_____"
],
[
"def counter():\n a=0\n b=0\n for x in p['prediction']:\n if x=='normal':\n a=a+1\n return a\n else:\n b=b+1\n return b\nif __name__=='__main__':\n counter()",
"_____no_output_____"
],
[
"counter()",
"_____no_output_____"
],
[
"from pyspark.ml.evaluation import MulticlassClassificationEvaluator\nevaluator = MulticlassClassificationEvaluator(\n labelCol=\"indexedLabel\", predictionCol=\"prediction\", metricName=\"accuracy\")\naccuracy = evaluator.evaluate(predictions)\nprint(\"Test Error = %g \" % (1.0 - accuracy))\nprint(\"accuracy= %g \" % (accuracy))",
"_____no_output_____"
],
[
"%matplotlib inline\nimport matplotlib.pyplot as plt\nplt.style.use('seaborn-whitegrid')\nimport numpy as np\n\nfig = plt.figure()\nax = plt.axes()\n\nacc = np.linspace(0,0.961113 )\nax.plot(attac, np.sin(acc),label='Accuracy');\n\nerr = np.linspace(0,0.0388867 )\nax.plot(norm, np.sin(err),linestyle='--',label='Error');\nplt.legend();",
"_____no_output_____"
],
[
"import seaborn as sns",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6b04b055868db38d1ac210bffa46efb25a2665 | 111,726 | ipynb | Jupyter Notebook | Cannabis_model.ipynb | Med-Cabinet-37/Med-Cabinet | 56b2c2d0a8094d1f1aa4453d0aed6779fe53a151 | [
"MIT"
]
| null | null | null | Cannabis_model.ipynb | Med-Cabinet-37/Med-Cabinet | 56b2c2d0a8094d1f1aa4453d0aed6779fe53a151 | [
"MIT"
]
| null | null | null | Cannabis_model.ipynb | Med-Cabinet-37/Med-Cabinet | 56b2c2d0a8094d1f1aa4453d0aed6779fe53a151 | [
"MIT"
]
| 2 | 2020-11-16T17:09:06.000Z | 2020-11-17T20:13:28.000Z | 53.947851 | 15,446 | 0.445662 | [
[
[
"# Exploratory Data Analysis",
"_____no_output_____"
],
[
"## Loading Imports and Data",
"_____no_output_____"
]
],
[
[
"!python -m spacy download en_core_web_lg\n!pip install squarify",
"Collecting en_core_web_lg==2.2.5\n\u001b[?25l Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-2.2.5/en_core_web_lg-2.2.5.tar.gz (827.9MB)\n\u001b[K |████████████████████████████████| 827.9MB 1.2MB/s \n\u001b[?25hRequirement already satisfied: spacy>=2.2.2 in /usr/local/lib/python3.6/dist-packages (from en_core_web_lg==2.2.5) (2.2.4)\nRequirement already satisfied: blis<0.5.0,>=0.4.0 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (0.4.1)\nRequirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (1.0.3)\nRequirement already satisfied: catalogue<1.1.0,>=0.0.7 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (1.0.0)\nRequirement already satisfied: preshed<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (3.0.2)\nRequirement already satisfied: plac<1.2.0,>=0.9.6 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (1.1.3)\nRequirement already satisfied: requests<3.0.0,>=2.13.0 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (2.23.0)\nRequirement already satisfied: cymem<2.1.0,>=2.0.2 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (2.0.4)\nRequirement already satisfied: tqdm<5.0.0,>=4.38.0 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (4.41.1)\nRequirement already satisfied: wasabi<1.1.0,>=0.4.0 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (0.8.0)\nRequirement already satisfied: thinc==7.4.0 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (7.4.0)\nRequirement already satisfied: srsly<1.1.0,>=1.0.2 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (1.0.2)\nRequirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (50.3.2)\nRequirement already satisfied: numpy>=1.15.0 in /usr/local/lib/python3.6/dist-packages (from spacy>=2.2.2->en_core_web_lg==2.2.5) (1.18.5)\nRequirement already satisfied: importlib-metadata>=0.20; python_version < \"3.8\" in /usr/local/lib/python3.6/dist-packages (from catalogue<1.1.0,>=0.0.7->spacy>=2.2.2->en_core_web_lg==2.2.5) (2.0.0)\nRequirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.2->en_core_web_lg==2.2.5) (1.24.3)\nRequirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.2->en_core_web_lg==2.2.5) (3.0.4)\nRequirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.2->en_core_web_lg==2.2.5) (2020.6.20)\nRequirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests<3.0.0,>=2.13.0->spacy>=2.2.2->en_core_web_lg==2.2.5) (2.10)\nRequirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata>=0.20; python_version < \"3.8\"->catalogue<1.1.0,>=0.0.7->spacy>=2.2.2->en_core_web_lg==2.2.5) (3.4.0)\nBuilding wheels for collected packages: en-core-web-lg\n Building wheel for en-core-web-lg (setup.py) ... \u001b[?25l\u001b[?25hdone\n Created wheel for en-core-web-lg: filename=en_core_web_lg-2.2.5-cp36-none-any.whl size=829180944 sha256=318c91c1e571b2598547218b4a457e4b3e0ffeaf4e2552a8d8a84de36a4d6e47\n Stored in directory: /tmp/pip-ephem-wheel-cache-vslz4333/wheels/2a/c1/a6/fc7a877b1efca9bc6a089d6f506f16d3868408f9ff89f8dbfc\nSuccessfully built en-core-web-lg\nInstalling collected packages: en-core-web-lg\nSuccessfully installed en-core-web-lg-2.2.5\n\u001b[38;5;2m✔ Download and installation successful\u001b[0m\nYou can now load the model via spacy.load('en_core_web_lg')\nCollecting squarify\n Using cached https://files.pythonhosted.org/packages/0b/2b/2e77c35326efec19819cd1d729540d4d235e6c2a3f37658288a363a67da5/squarify-0.4.3-py3-none-any.whl\nInstalling collected packages: squarify\nSuccessfully installed squarify-0.4.3\n"
],
[
"# Base\nimport pandas as pd\nimport numpy as np\nfrom collections import Counter\n\n# Plotting\nimport squarify\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\n# NLP Libraries\nimport spacy\nfrom spacy.tokenizer import Tokenizer\nfrom sklearn.neighbors import NearestNeighbors\nfrom sklearn.feature_extraction.text import TfidfVectorizer\n\nnlp = spacy.load('en_core_web_lg')",
"_____no_output_____"
],
[
"df = pd.read_csv(\"cannabis.csv\")",
"_____no_output_____"
],
[
"print(df.shape)\ndf",
"(2351, 6)\n"
],
[
"df.info()",
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 2351 entries, 0 to 2350\nData columns (total 6 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 Strain 2351 non-null object \n 1 Type 2351 non-null object \n 2 Rating 2351 non-null float64\n 3 Effects 2351 non-null object \n 4 Flavor 2305 non-null object \n 5 Description 2318 non-null object \ndtypes: float64(1), object(5)\nmemory usage: 110.3+ KB\n"
]
],
[
[
"## Data Cleaning/Wrangling",
"_____no_output_____"
]
],
[
[
"df[df['Effects']=='None'].value_counts()",
"_____no_output_____"
],
[
"df['Description'].isnull().value_counts()",
"_____no_output_____"
],
[
"df[df['Description'].isnull()]",
"_____no_output_____"
],
[
"df = df.dropna()",
"_____no_output_____"
],
[
"df.shape",
"_____no_output_____"
],
[
"df[df['Effects']=='None'].value_counts()",
"_____no_output_____"
],
[
"df = df[df.Effects != 'None']",
"_____no_output_____"
],
[
"df.shape",
"_____no_output_____"
]
],
[
[
"# Natural Language Processing",
"_____no_output_____"
]
],
[
[
"# Instantiate Tokenizer\ntokenizer = Tokenizer(nlp.vocab)\n\n# Create description tokens\ntokens = []\n\nfor doc in tokenizer.pipe(df['Description'], batch_size=500):\n doc_tokens = [token.text for token in doc]\n tokens.append(doc_tokens)\n\ndf['Description_Tokens'] = tokens\nprint(df['Description_Tokens'].head())",
"0 [$100, OG, is, a, 50/50, hybrid, strain, that,...\n1 [The, ‘98, Aloha, White, Widow, is, an, especi...\n2 [1024, is, a, sativa-dominant, hybrid, bred, i...\n3 [13, Dawgs, is, a, hybrid, of, G13, and, Chemd...\n4 [Also, known, as, Kosher, Tangie,, 24k, Gold, ...\nName: Description_Tokens, dtype: object\n"
],
[
"def count(docs):\n\n word_counts = Counter()\n appears_in = Counter()\n \n total_docs = len(docs)\n\n for doc in docs:\n word_counts.update(doc)\n appears_in.update(set(doc))\n\n temp = zip(word_counts.keys(), word_counts.values())\n \n wc = pd.DataFrame(temp, columns = ['word', 'count'])\n\n wc['rank'] = wc['count'].rank(method='first', ascending=False)\n total = wc['count'].sum()\n\n wc['pct_total'] = wc['count'].apply(lambda x: x / total)\n \n wc = wc.sort_values(by='rank')\n wc['cul_pct_total'] = wc['pct_total'].cumsum()\n\n t2 = zip(appears_in.keys(), appears_in.values())\n ac = pd.DataFrame(t2, columns=['word', 'appears_in'])\n wc = ac.merge(wc, on='word')\n\n wc['appears_in_pct'] = wc['appears_in'].apply(lambda x: x / total_docs)\n \n return wc.sort_values(by='rank')",
"_____no_output_____"
],
[
"wc = count(df['Description_Tokens'])\nwc.head()",
"_____no_output_____"
],
[
"tokens = []\n\n\"\"\" Update those tokens w/o stopwords\"\"\"\nfor doc in nlp.pipe(df['Description'], batch_size=500):\n \n doc_tokens = []\n \n for token in doc:\n if (token.is_stop == False) & (token.is_punct == False) & (token.text is not ' '):\n doc_tokens.append(token.lemma_.lower())\n\n tokens.append(doc_tokens)\n\ndf['Description_Tokens'] = tokens\ndf['Description_Tokens']",
"_____no_output_____"
],
[
"wc = count(df['Description_Tokens'])\n\nwc_top20 = wc[wc['rank'] <= 20]\n\nsquarify.plot(sizes=wc_top20['pct_total'], label=wc_top20['word'], alpha=.8)\nplt.axis('off')\nplt.show()",
"_____no_output_____"
],
[
"wc_top20['word']",
"_____no_output_____"
],
[
"# Instantiate vectorizer\ntfidf = TfidfVectorizer(stop_words = 'english',\n #ngram_range = (1,2),\n max_features = 5000)\n\n# Create a vocabulary and tf-idf score per document\ndtm = tfidf.fit_transform(df['Description'])\n \n# Get feature names to use as dataframe column headers\ndtm = pd.DataFrame(dtm.todense(), columns=tfidf.get_feature_names())\nnn = NearestNeighbors(n_neighbors=4, algorithm='kd_tree')\nnn.fit(dtm)\n\n# View Feature Matrix as DataFrame\nprint(dtm.shape)\ndtm.head()",
"(2200, 5000)\n"
],
[
"ideal = [\"\"\"Indica,Relaxed,Pain,Stress,Ache,Sleep\"\"\"]",
"_____no_output_____"
],
[
"# Query ideal descprition\nnew = tfidf.transform(ideal)\nnew",
"_____no_output_____"
],
[
"nn.kneighbors(new.todense())",
"_____no_output_____"
],
[
"print(df['Strain'][727])\nprint(df['Flavor'][727])\nprint(df['Effects'][727])\nprint(df['Description'][727])",
"Dutch-Treat\nSweet,Pine,Earthy\nRelaxed,Happy,Euphoric,Uplifted,Focused\nOver the years, Dutch Treat has become an essential strain of the Amsterdam coffee shops. The dense, sticky buds have an intense smell of sweet fruits mixed with pine and eucalyptus trees. The cerebral high comes on quick and leaves consumers feeling uplifted and euphoric while reducing stress and relaxing the mind.\n"
],
[
"print(df['Strain'][617])\nprint(df['Flavor'][617])\nprint(df['Effects'][617])\nprint(df['Description'][617])",
"Crown-Royale\nSweet,Flowery,Berry\nRelaxed,Happy,Euphoric,Sleepy,Aroused\nCrown Royale is a sweet indica-dominant hybrid that blends the best of parent strains Blueberry and Purple Kush together. This flower is a feast for the eyes with bright purple hues and deep green foliage. Just as delightful on the palate, Crown Royale exhibits notes of the forest floor with piney aromas and a telltale berry tartness. These scents show up in the flavor as a sweeter, fruiter pine. Enjoy this strain for pervasive physical effects that dull pain, nausea, and stress. \n"
],
[
"print(df['Strain'][2168])\nprint(df['Flavor'][2168])\nprint(df['Effects'][2168])\nprint(df['Description'][2168])",
"Tillamook-Strawberry\nStrawberry,Sweet,Berry\nHappy,Relaxed,Focused,Euphoric,Energetic\nTillamook Strawberry is a mash-up between Alphakronik Genes and Dark Horse Genetics for AKG’s Collaboration Series. Described by the breeder as the “diesel lover’s dream,” Tillamook Strawberry smells like a gas station in a strawberry field. The strain’s foliage is deep green with tight buds and the effects are bright yet soothing, promoting focus and relaxation. Utilize Tillamook Strawberry to improve your mood and counter depression and anxiety. \n"
],
[
"print(df['Strain'][1249])\nprint(df['Flavor'][1249])\nprint(df['Effects'][1249])\nprint(df['Description'][1249])",
"Legend-Og\nPungent,Earthy,Pine\nRelaxed,Sleepy,Happy,Creative,Focused\nLegend OG is a presumed OG Kush phenotype that offers a fresh take on a classic. Known for tart, floral, and pungent terpenes, Legend OG stays true to its Kush background. Heavily sedating in large doses, Legend OG works hard to relax the consumer by elevating the mind while soothing aches and pains throughout the body. Its sleepy qualities also make it a solid choice before bedtime, but monitor your dosage, as high-THC varieties can overstimulate some minds.\n"
],
[
"import pickle\n\nPkl_Filename = \"nn_model.pkl\" \n\nwith open(Pkl_Filename, 'wb') as file: \n pickle.dump(nn, file)",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6b0d4760c44ac67e70f194c07129cb01e1a540 | 19,807 | ipynb | Jupyter Notebook | labs/Archived Labs/2-22/2-22_scikitlearn_regression_solutions.ipynb | jdmarshl/Legal-123-Sp20 | 11de39c916ae1d385b1cc675dee2a984ecb3931d | [
"BSD-3-Clause"
]
| 3 | 2021-01-20T19:08:40.000Z | 2022-01-19T18:27:00.000Z | labs/Archived Labs/2-22/2-22_scikitlearn_regression_solutions.ipynb | jdmarshl/Legal-123-Sp20 | 11de39c916ae1d385b1cc675dee2a984ecb3931d | [
"BSD-3-Clause"
]
| null | null | null | labs/Archived Labs/2-22/2-22_scikitlearn_regression_solutions.ipynb | jdmarshl/Legal-123-Sp20 | 11de39c916ae1d385b1cc675dee2a984ecb3931d | [
"BSD-3-Clause"
]
| 4 | 2021-03-08T09:54:36.000Z | 2022-02-01T03:44:51.000Z | 31.439683 | 410 | 0.611148 | [
[
[
"# 2-22: Intro to scikit-learn\n\n<img src=\"https://www.cityofberkeley.info/uploadedImages/Public_Works/Level_3_-_Transportation/DSC_0637.JPG\" style=\"width: 500px; height: 275px;\" />\n---\n\n** Regression** is useful for predicting a value that varies on a continuous scale from a bunch of features. This lab will introduce the regression methods available in the scikit-learn extension to scipy, focusing on ordinary least squares linear regression, LASSO, and Ridge regression.\n\n*Estimated Time: 45 minutes*\n\n---\n\n\n### Table of Contents\n\n\n1 - [The Test-Train-Validation Split](#section 1)<br>\n\n2 - [Linear Regression](#section 2)<br>\n\n3 - [LASSO Regression](#section 3)<br>\n\n4 - [Ridge Regression](#section 4)<br>\n\n5 - [Choosing a Model](#section 5)<br>\n\n\n\n**Dependencies:**",
"_____no_output_____"
]
],
[
[
"import numpy as np\nfrom datascience import *\nimport datetime as dt\nimport pandas as pd\nimport matplotlib.pyplot as plt\n%matplotlib inline\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import Ridge, Lasso, LinearRegression\nfrom sklearn.model_selection import KFold",
"_____no_output_____"
]
],
[
[
"## The Data: Bike Sharing",
"_____no_output_____"
],
[
"In your time at Cal, you've probably passed by one of the many bike sharing station around campus. Bike sharing systems have become more and more popular as traffic and concerns about global warming rise. This lab's data describes one such bike sharing system in Washington D.C., from [UC Irvine's Machine Learning Repository](https://archive.ics.uci.edu/ml/datasets/Bike+Sharing+Dataset).",
"_____no_output_____"
]
],
[
[
"bike=Table().read_table(('data/Bike-Sharing-Dataset/day.csv'))\n\n# reformat the date column to integers representing the day of the year, 001-366\nbike['dteday'] = pd.to_datetime(bike['dteday']).strftime('%j')\n\n# get rid of the index column\nbike = bike.drop(0)\n\nbike.show(4)",
"_____no_output_____"
]
],
[
[
"Take a moment to get familiar with the data set. In data science, you'll often hear rows referred to as **records** and columns as **features**. Before you continue, make sure you can answer the following:\n\n- How many records are in this data set?\n- What does each record represent?\n- What are the different features?\n- How is each feature represented? What values does it take, and what are the data types of each value?\n\nUse Table methods and check the UC Irvine link for more information.",
"_____no_output_____"
]
],
[
[
"# explore the data set here",
"_____no_output_____"
]
],
[
[
"---\n## 1. The Test-Train-Validation Split <a id='section 1'></a>",
"_____no_output_____"
],
[
"When we train a model on a data set, we run the risk of [**over-fitting**](http://scikit-learn.org/stable/auto_examples/model_selection/plot_underfitting_overfitting.html). Over-fitting happens when a model becomes so complex that it makes very accurate predictions for the data it was trained on, but it can't generalize to make good predictions on new data.\n\nWe can reduce the risk of overfitting by using a **test-train split**. \n\n1. Randomly divide our data set into two smaller sets: one for training and one for testing\n2. Train the data on the training set, changing our model along the way to increase accuracy\n3. Test the data's predictions using the test set.\n\nScikit-learn's [`test_train_split`](http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html) function will help here. First, separate your data into two parts: a Table containing the features used to make our prediction, and an array of the true values. To start, let's predict the *total number of riders* (y) using *every feature that isn't a rider count* (X).\n\nNote: for the function to work, X can't be a Table. Save X as a pandas DataFrame by calling `.to_df()` on the feature Table.",
"_____no_output_____"
]
],
[
[
"# the features used to predict riders\nX = bike.drop('casual', 'registered', 'cnt')\nX = X.to_df()\n\n# the number of riders\ny = bike['cnt']",
"_____no_output_____"
]
],
[
[
"Next, set the random seed using `np.random.seed(...)`. This will affect the way numpy pseudo-randomly generates the numbers it uses to decide how to split the data into training and test sets. Any seed number is fine- the important thing is to document the number you used in case we need to recreate this pseudorandom split in the future.\n\nThen, call `train_test_split` on your X and y. Also set the parameters `train_size=` and `test_size=` to set aside 80% of the data for training and 20% for testing.",
"_____no_output_____"
]
],
[
[
"# set the random seed\n\nnp.random.seed(10)\n\n# split the data\n# train_test_split returns 4 values: X_train, X_test, y_train, y_test\n\nX_train, X_test, y_train, y_test = train_test_split(X, y,\n train_size=0.80, test_size=0.20)",
"_____no_output_____"
]
],
[
[
"### The Validation Set\n\nOur test data should only be used once: after our model has been selected, trained, and tweaked. Unfortunately, it's possible that in the process of tweaking our model, we could still overfit it to the training data and only find out when we return a poor test data score. What then?\n\nA **validation set** can help here. By trying your trained models on a validation set, you can (hopefully) weed out models that don't generalize well.\n\nCall `train_test_split` again, this time on your X_train and y_train. We want to set aside 25% of the data to go to our validation set, and keep the remaining 75% for our training set.\n\nNote: This means that out of the original data, 20% is for testing, 20% is for validation, and 60% is for training.",
"_____no_output_____"
]
],
[
[
"# split the data\n# Returns 4 values: X_train, X_validate, y_train, y_validate\n\nX_train, X_validate, y_train, y_validate = train_test_split(X_train, y_train,\n train_size=0.75, test_size=0.25)",
"_____no_output_____"
]
],
[
[
"## 2. Linear Regression (Ordinary Least Squares) <a id='section 2'></a>",
"_____no_output_____"
],
[
"Now, we're ready to start training models and making predictions. We'll start with a **linear regression** model.\n\n[Scikit-learn's linear regression](http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html#sklearn.linear_model.LinearRegression.score) is built around scipy's ordinary least squares, which you used in the last lab. The syntax for each scikit-learn model is very similar:\n1. Create a model by calling its constructor function. For example, `LinearRegression()` makes a linear regression model.\n2. Train the model on your training data by calling `.fit(train_X, train_y)` on the model\n\nCreate a linear regression model in the cell below.",
"_____no_output_____"
]
],
[
[
"# create a model\nlin_reg = LinearRegression(normalize=True)\n\n# fit the model\nlin_model = lin_reg.fit(X_train, y_train)\n",
"_____no_output_____"
]
],
[
[
"With the model fit, you can look at the best-fit slope for each feature using `.coef_`, and you can get the intercept of the regression line with `.intercept_`.",
"_____no_output_____"
]
],
[
[
"print(lin_model.coef_)\nprint(lin_model.intercept_)",
"_____no_output_____"
]
],
[
[
"Now, let's get a sense of how good our model is. We can do this by looking at the difference between the predicted values and the actual values, also called the error.\n\nWe can see this graphically using a scatter plot.\n\n- Call `.predict(X)` on your linear regression model, using your training X and training y, to return a list of predicted number of riders per hour. Save it to a variable `lin_pred`.\n- Using a scatter plot (`plt.scatter(...)`), plot the predicted values against the actual values (`y_train`)",
"_____no_output_____"
]
],
[
[
"# predict the number of riders\nlin_pred = lin_model.predict(X_train)\n\n# plot the residuals on a scatter plot\nplt.scatter(y_train, lin_pred)\nplt.title('Linear Model (OLS)')\nplt.xlabel('actual value')\nplt.ylabel('predicted value')\nplt.show()",
"_____no_output_____"
]
],
[
[
"Question: what should our scatter plot look like if our model was 100% accurate?",
"_____no_output_____"
],
[
"**ANSWER:** All points (i.e. errors) would fall on a line with a slope of one: the predicted value would always equal the actual value.",
"_____no_output_____"
],
[
"We can also get a sense of how well our model is doing by calculating the **root mean squared error**. The root mean squared error (RMSE) represents the average difference between the predicted and the actual values.\n\nTo get the RMSE:\n- subtract each predicted value from its corresponding actual value (the errors)\n- square each error (this prevents negative errors from cancelling positive errors)\n- average the squared errors\n- take the square root of the average (this gets the error back in the original units)\n\nWrite a function `rmse` that calculates the mean squared error of a predicted set of values.",
"_____no_output_____"
]
],
[
[
"def rmse(pred, actual):\n return np.sqrt(np.mean((pred - actual) ** 2))",
"_____no_output_____"
]
],
[
[
"Now calculate the mean squared error for your linear model.",
"_____no_output_____"
]
],
[
[
"rmse(lin_pred, y_train)",
"_____no_output_____"
]
],
[
[
"## 3. Ridge Regression <a id='section 3'></a>",
"_____no_output_____"
],
[
"Now that you've gone through the process for OLS linear regression, it's easy to do the same for [**Ridge Regression**](http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html). In this case, the constructor function that makes the model is `Ridge()`.",
"_____no_output_____"
]
],
[
[
"# make and fit a Ridge regression model\nridge_reg = Ridge() \nridge_model = ridge_reg.fit(X_train, y_train)\n",
"_____no_output_____"
],
[
"# use the model to make predictions\nridge_pred = ridge_model.predict(X_train)\n\n# plot the predictions\nplt.scatter(y_train, ridge_pred)\nplt.title('Ridge Model')\nplt.xlabel('actual values')\nplt.ylabel('predicted values')\nplt.show()",
"_____no_output_____"
],
[
"# calculate the rmse for the Ridge model\nrmse(ridge_pred, y_train)",
"_____no_output_____"
]
],
[
[
"Note: the documentation for Ridge regression shows it has lots of **hyperparameters**: values we can choose when the model is made. Now that we've tried it using the defaults, look at the [documentation](http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html) and try changing some parameters to see if you can get a lower RMSE (`alpha` might be a good one to try).",
"_____no_output_____"
],
[
"## 4. LASSO Regression <a id='section 4'></a>",
"_____no_output_____"
],
[
"Finally, we'll try using [LASSO regression](http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html). The constructor function to make the model is `Lasso()`. \n\nYou may get a warning message saying the objective did not converge. The model will still work, but to get convergence try increasing the number of iterations (`max_iter=`) when you construct the model.\n",
"_____no_output_____"
]
],
[
[
"# create and fit the model\nlasso_reg = Lasso(max_iter=10000) \n\nlasso_model = lasso_reg.fit(X_train, y_train)\n",
"_____no_output_____"
],
[
"# use the model to make predictions\nlasso_pred = lasso_model.predict(X_train)\n\n# plot the predictions\nplt.scatter(y_train, lasso_pred)\nplt.title('LASSO Model')\nplt.xlabel('actual values')\nplt.ylabel('predicted values')\nplt.show()",
"_____no_output_____"
],
[
"# calculate the rmse for the LASSO model\nrmse(lasso_pred, y_train)",
"_____no_output_____"
]
],
[
[
"Note: LASSO regression also has many tweakable hyperparameters. See how changing them affects the accuracy!\n\nQuestion: How do these three models compare on performance? What sorts of things could we do to improve performance?",
"_____no_output_____"
],
[
"**ANSWER:** All three models have very similar accuracy, around 900 RMSE for each.\n\nWe could try changing which features we use or adjust the hyperparameters.",
"_____no_output_____"
],
[
"---\n## 5. Choosing a model <a id='section 5'></a>\n### Validation",
"_____no_output_____"
],
[
"Once you've tweaked your models' hyperparameters to get the best possible accuracy on your training sets, we can compare your models on your validation set. Make predictions on `X_validate` with each one of your models, then calculate the RMSE for each set of predictions.",
"_____no_output_____"
]
],
[
[
"# make predictions for each model\nlin_vpred = lin_model.predict(X_validate)\nridge_vpred = ridge_model.predict(X_validate)\nlasso_vpred = lasso_model.predict(X_validate)",
"_____no_output_____"
],
[
"# calculate RMSE for each set of validation predictions\nprint(\"linear model rmse: \", rmse(lin_vpred, y_validate))\nprint(\"Ridge rmse: \", rmse(ridge_vpred, y_validate))\nprint(\"LASSO rmse: \", rmse(lasso_vpred, y_validate))",
"_____no_output_____"
]
],
[
[
"How do the RMSEs for the validation data compare to those for the training data? Why?\n\nDid the model that performed best on the training set also do best on the validation set?",
"_____no_output_____"
],
[
"**YOUR ANSWER:** The RMSE for the validation set tends to be larger than for the training set, simply because the models were fit to the training data.",
"_____no_output_____"
],
[
"### Predicting the Test Set",
"_____no_output_____"
],
[
"Finally, select one final model to make predictions for your test set. This is often the model that performed best on the validation data.",
"_____no_output_____"
]
],
[
[
"# make predictions for the test set using one model of your choice\nfinal_pred = lin_model.predict(X_test)\n# calculate the rmse for the final predictions\nprint('Test set rmse: ', rmse(final_pred, y_test))",
"_____no_output_____"
]
],
[
[
"Coming up this semester: how to select your models, model parameters, and features to get the best performance.",
"_____no_output_____"
],
[
"---\nNotebook developed by: Keeley Takimoto\n\nData Science Modules: http://data.berkeley.edu/education/modules\n",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
]
]
|
cb6b0e34d304e5785e4279d5ef42b0146895b5e3 | 61,074 | ipynb | Jupyter Notebook | Task_1 Prediction Using Supervised ML/Task_1 Prediction Using Supervised ML.ipynb | faiqueali017/The-Sparks-Foundation | 2b026fcb306cbaa06a733221ed526a260896a324 | [
"MIT"
]
| 1 | 2021-09-22T09:06:43.000Z | 2021-09-22T09:06:43.000Z | Task_1 Prediction Using Supervised ML/Task_1 Prediction Using Supervised ML.ipynb | faiqueali017/The-Sparks-Foundation | 2b026fcb306cbaa06a733221ed526a260896a324 | [
"MIT"
]
| null | null | null | Task_1 Prediction Using Supervised ML/Task_1 Prediction Using Supervised ML.ipynb | faiqueali017/The-Sparks-Foundation | 2b026fcb306cbaa06a733221ed526a260896a324 | [
"MIT"
]
| null | null | null | 86.752841 | 23,784 | 0.829813 | [
[
[
"# Author: Faique Ali\n\n## Task 01 : Prediction Using Supervised ML \n<p>\n Using Linear Regression, predict the percentage of an student based on his no. of study hours.\n</p>",
"_____no_output_____"
],
[
"# Imports",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nfrom pandas import DataFrame\nimport matplotlib.pyplot as plt\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn import metrics\n\n%matplotlib inline",
"_____no_output_____"
]
],
[
[
"# Constants",
"_____no_output_____"
]
],
[
[
"DATA_SOURCE_LINK = 'http://bit.ly/w-data'\nCOL_HRS = 'Hours'\nCOL_SCORES = 'Scores'\n\nSCATTER_PLT_TITLE = 'Scatter Plot showing Students Nr. of Hours Studied VS Scored Marks'\nSCATTER_PLT_XLABEL = 'HOURS'\nSCATTER_PLT_YLABEL = 'SCORES'",
"_____no_output_____"
]
],
[
[
"## Step1: Gather the Data",
"_____no_output_____"
]
],
[
[
"data = pd.read_csv(DATA_SOURCE_LINK)",
"_____no_output_____"
],
[
"# Show first 5 rows\ndata.head()",
"_____no_output_____"
],
[
"# Checking for null values in the data set\ndata.info()",
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 25 entries, 0 to 24\nData columns (total 2 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 Hours 25 non-null float64\n 1 Scores 25 non-null int64 \ndtypes: float64(1), int64(1)\nmemory usage: 528.0 bytes\n"
]
],
[
[
"## Step 2: Visualizing the Data",
"_____no_output_____"
],
[
"#### Splitting Hours and Scores into two varibales",
"_____no_output_____"
]
],
[
[
"X = DataFrame(data, columns=[COL_HRS])\ny = DataFrame(data, columns=[COL_SCORES])",
"_____no_output_____"
]
],
[
[
"#### Creating a scatter plot",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(9,6))\n\n# Specifying plot type\nplt.scatter(X,y, s=120, alpha=0.7)\n\n# Adding labels to the plot\nplt.title(SCATTER_PLT_TITLE)\nplt.xlabel(SCATTER_PLT_XLABEL)\nplt.ylabel(SCATTER_PLT_YLABEL)\n\n#\nplt.show()",
"_____no_output_____"
]
],
[
[
"## Step 3: Training the Model on Testing Data",
"_____no_output_____"
]
],
[
[
"X_train, X_test, y_train, y_test = train_test_split(X,y, random_state=0, test_size=0.2)",
"_____no_output_____"
],
[
"# Creating an obj\nregression = LinearRegression()\n\nregression.fit(X_train, y_train)",
"_____no_output_____"
]
],
[
[
"#### Slope coefficient (Theta_1)",
"_____no_output_____"
]
],
[
[
"regression.coef_",
"_____no_output_____"
]
],
[
[
"#### Intercept\n\nThe intercept here is a +ve value. It represents that a student with `0hrs` of preparation can score at least `2 marks`",
"_____no_output_____"
]
],
[
[
"regression.intercept_",
"_____no_output_____"
]
],
[
[
"## Step 4: Testing outcomes on Test Data",
"_____no_output_____"
]
],
[
[
"# Making predictions on testing data\npredicted_scores = regression.predict(X_test)\npredicted_scores",
"_____no_output_____"
],
[
"# Convert numpy nd array to 1d array\npredicted_scores = predicted_scores.flatten()\n\n# Extracting Hrs cols from X_test\nnr_of_hrs = X_test['Hours'].to_numpy()\n\n# Displaying our test results into a Data frame\ntest_df = pd.DataFrame(data={'Nr.of Hrs': nr_of_hrs, 'Scored Marks': predicted_scores})\ntest_df",
"_____no_output_____"
]
],
[
[
"## Step 5: Plotting Regression Line",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(9,6))\n\n# Specifying plot type\nplt.scatter(X,y, s=120, alpha=0.85)\n\n# To plot regression line\nplt.plot(X, regression.predict(X), color='red', linewidth=2, alpha= 0.9)\n\n# Adding labels to the plot\nplt.title(SCATTER_PLT_TITLE)\nplt.xlabel(SCATTER_PLT_XLABEL)\nplt.ylabel(SCATTER_PLT_YLABEL)\n\n#\nplt.show()",
"_____no_output_____"
]
],
[
[
"## Step 6: Comparing & Evaluating our Model",
"_____no_output_____"
]
],
[
[
"# Extracting Scores cols from y_test\nactual_scores = y_test['Scores'].to_numpy()\n\n# Displaying our test results into a Data frame\nact_vs_pred_df = pd.DataFrame(data={'Actual Scores': actual_scores, 'Predicted Scores': predicted_scores})\nact_vs_pred_df",
"_____no_output_____"
]
],
[
[
"### Estimating training and testing accuracy or $R^{2}$",
"_____no_output_____"
]
],
[
[
"print(f'Training Accuracy: ', regression.score(X_train,y_train))\nprint(f'Testing Accuracy: ', regression.score(X_test,y_test))",
"Training Accuracy: 0.9515510725211552\nTesting Accuracy: 0.9454906892105356\n"
]
],
[
[
"### Evaluating model",
"_____no_output_____"
]
],
[
[
"print(f'Mean Squared Error: ', metrics.mean_squared_error(y_test,predicted_scores))\nprint(f'Mean Absolute Error: ', metrics.mean_absolute_error(y_test,predicted_scores))",
"Mean Squared Error: 21.5987693072174\nMean Absolute Error: 4.183859899002975\n"
]
],
[
[
"# `Making Predictions `",
"_____no_output_____"
],
[
"<b>What will be the predicted score if a student studies for 9.25 hrs/day?<b>",
"_____no_output_____"
]
],
[
[
"hrs = 9.25\npred = regression.predict([[hrs]])\n\nprint(f'Nr of hrs studied: {hrs}')\nprint(f'Obtained marks/score: {pred[0][0]}')",
"Nr of hrs studied: 9.25\nObtained marks/score: 93.69173248737538\n"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
]
]
|
cb6b0f210fcce9d648db6fd1eb54ffd23596eff2 | 416,889 | ipynb | Jupyter Notebook | examples/dev/POC-HFD_calculation.ipynb | adamkosik/PSGeothermieAargau | 00274bf2bc3fe033476b9375085a80c6510713ee | [
"MIT"
]
| null | null | null | examples/dev/POC-HFD_calculation.ipynb | adamkosik/PSGeothermieAargau | 00274bf2bc3fe033476b9375085a80c6510713ee | [
"MIT"
]
| null | null | null | examples/dev/POC-HFD_calculation.ipynb | adamkosik/PSGeothermieAargau | 00274bf2bc3fe033476b9375085a80c6510713ee | [
"MIT"
]
| null | null | null | 776.329609 | 79,706 | 0.943016 | [
[
[
"# Analysis of SHEMAT-Suite models\n\nThe created geological models with gempy were exported as SHEMAT-Suite input files. SHEMAT-Suite (https://git.rwth-aachen.de/SHEMAT-Suite/SHEMAT-Suite-open) [1] is a code for solving coupled heat transport in porous media. It is written in fortran and uses a finite differences scheme in a hexahedral grid.\n\nIn this example, we will load a heat transport simulation from the base POC model we created in \"Geological model creation and gravity simulation\". We will demonstrate methods contained in OpenWF for loading the result file, displaying the parameters it contains and how to visualize these parameters. Finally, we will calculate the conductive heat flow and plot it.",
"_____no_output_____"
]
],
[
[
"# import some libraries\n#from scipy.stats import hmean\n#import pandas as pd\nimport numpy as np\n#import glob\nimport h5py\nimport os, sys\nsys.path.append('../../')\nimport OpenWF.postprocessing as pp\n\nimport matplotlib.pyplot as plt\n#from mpl_toolkits.axes_grid1 import make_axes_locatable\n%matplotlib inline\n\nimport seaborn as sns\nsns.set_style('ticks')\nsns.set_context('talk')",
"_____no_output_____"
]
],
[
[
"Simulation results from SHEMAT-Suite can be written in different file formats, such as VTK (Visualization Toolkit) HDF5 (Hierarchical Data Format), or PLT (TecPlot). In addition, optional outputs, such as ASCII-Files with comparison of simulated values to measured ones can be provided. Further, a status log of the simulation and other meta-files. A full coverage of possible output files is provided in the SHEMAT-Suite wiki ( https://git.rwth-aachen.de/SHEMAT-Suite/SHEMAT-Suite-open/-/wikis/home). \nIn this tutorial, we will work with HDF5 files and VTK files. The majority of methods in OpenWF are tailored towards HDF5 files, which are smaller than their VTK relatives.\n\nHowever, there exists a powerful visualization code for python which builds upon vtk, called pyvista. We will briefly showcase its capabilities at the end of this tutorial.",
"_____no_output_____"
],
[
"## Load HDF5 file\nFrom the base POC model, we created a SHEMAT-Suite input file. This was then executed with the compiled SHEMAT-Suite code. As basic information: we look at conductive heat transport, i.e. no fluid flow, and heat transport is described by Fourier's law of heat conduction $q = - \\lambda \\nabla T$. At the base of the model, the heat flow boundary condition is set to 72 mW/m$^2$.\n\nOpenWF has a built in method for loading HDF5 files, though reading a file is a one-liner using the library ``h5py``. \n```python \nfid = h5py.File('../../models/SHEMAT-Suite_output/SHEMAT_PCT_base_model_final.h5')\n```\nThe file can be loaded in different states, among others for 'r' for read, 'a' for append, 'w' for write, etc. The ``read_hdf`` method in OpenWF lets the user also choose the state to load the HDF5 file.",
"_____no_output_____"
]
],
[
[
"model_path = '../../models/SHEMAT-Suite_output/SHEMAT_PCT_base_model_temp_final.h5'\nfid = pp.read_hdf_file(model_path, write=False)",
"_____no_output_____"
]
],
[
[
"To check the parameters stored in the HDF5 file, you can query the loaded h5py file for its keys, i.e. the \"labels\" of the data boxes stored in the HDF5 file.",
"_____no_output_____"
]
],
[
[
"fid.keys()",
"_____no_output_____"
]
],
[
[
"As some of these acronyms can have no meaning to new users, we implemented a method, specifically for SHEMAT-Suite generated HDF5 files to present information about the stored parameters:",
"_____no_output_____"
]
],
[
[
"pp.available_parameters(fid)",
"_____no_output_____"
]
],
[
[
"The postprocessing in OpenWF has methods for quickly displaying the parameters in each of the model dimensions in a 2D slice. For instance, we will look at a profile through the model parallel to the y direction, thus showing a crosssection of the model. In lines, it shows the interfaces between different geological units, and the specified parameter as a colored contour field. ",
"_____no_output_____"
]
],
[
[
"# plot slice temperature\nfig = plt.figure(figsize=[15,7])\npp.plot_slice(model_path, parameter='temp', direction='y', cell_number=25, model_depth=6500.)",
"_____no_output_____"
],
[
"# plot slice fluid density\nfig = plt.figure(figsize=[15,7])\npp.plot_slice(model_path, parameter='rhof', direction='y', cell_number=25, model_depth=6500)",
"_____no_output_____"
]
],
[
[
"## Heat flow estimation\nSHEMAT-Suite does not provide the heat flow for HDF5 files. It does, however, store it in the vtk output. To also have the heat flow for HDF5 files, we provide a method for calculating it. In the future, it may be directly written in HDF5 files by SHEMAT-Suite. The method calculates the conductive heat flow in all model dimensions per default. The user can specify, if only one direction should be yielded by the method.",
"_____no_output_____"
]
],
[
[
"qx, qy, qz = pp.calc_cond_hf(fid)\nprint(qz.shape)",
"(60, 50, 100)\n"
]
],
[
[
"Maybe here is a good point to talk about the dimensions and according directions in the HDF5 file. We see above, that qz has three dimensions, one with 60 entries, one with 50 entries, and one with 100 entries. These is also the cell discretization in z, y, and x direction. That is, in an HDF5 file from SHEMAT-Suite, we have the dimensions [z,y,x], so here qz[z,y,x]. \n\nThe three variables now contain the heat flow in x, y, z direction for each cell in the model. Let's have a look at a horizontal slice through the model center and the heat flow in z-direction. Remembering the notation for directions, and seeing that in z-direction, we have 60 cells, the horizontal slice would reflect ``qz[29,:,:]``, i.e. all entries in x- and y-direction at index 29 of the z-direction. In the HDF5-file, we further count from the bottom, so ``qz[0,:,:]`` is the deepest slice, ``qz[-1,:,:]`` the shallowest.",
"_____no_output_____"
]
],
[
[
"# Get the model dimensions in x, y, z\nx = fid['x'][0,0,:]\ny = fid['y'][0,:,0]\nz = fid['z'][:,0,0]\n\ncell_number = 29\nui_cs = fid['uindex'][cell_number,:,:]\n\nfig = plt.figure(figsize=[15,7])\ncs = plt.contourf(x,y,qz[cell_number]*1000, 20, cmap='viridis')\nplt.contour(x,y,ui_cs, colors='k')\nplt.colorbar(cs, label='HF mW/m$^2$')\nplt.xlabel('X [m]')\nplt.ylabel('Y [m]');",
"_____no_output_____"
]
],
[
[
"Next to calculating the heatflow in each cell, we implemented a method to calculate it over a specified interval, e.g. over the depth interval of -4000 m to -3000 m, so providing the average heat flow over this depth interval.",
"_____no_output_____"
]
],
[
[
"deeper = -4000\nshallower = -3000\nmid_depth = deeper - (deeper - shallower) / 2\n\nqz_int = pp.calc_cond_hf_over_interval(fid, depth_interval=[deeper,shallower], model_depth=6500)\n\nfig = plt.figure(figsize=[15,7])\ncs = plt.contourf(x,y,qz_int*1000, 20, cmap='viridis')\nplt.contour(x,y,ui_cs, colors='k')\nplt.colorbar(cs, label='HF mW/m$^2$')\nplt.title(f\"Heat flow, at {mid_depth} m a.s.l. depth, over a {np.abs(deeper-shallower)} m depth interval\")\nplt.xlabel('X [m]')\nplt.ylabel('Y [m]');",
"_____no_output_____"
]
],
[
[
"## VTK and pyvista\nPyvista ( https://docs.pyvista.org/ ) is a python library for working with 3D meshes and providing an interface for VTK files.",
"_____no_output_____"
]
],
[
[
"import pyvista as pv\npv.set_plot_theme(\"document\")\n\nsimulation = pv.read('../../models/SHEMAT-Suite_output/SHEMAT_PCT_base_model_temp_final.vtk')",
"_____no_output_____"
]
],
[
[
"This line loads the VTK file. For information about its content, we can simply call the variable:",
"_____no_output_____"
]
],
[
[
"simulation",
"_____no_output_____"
],
[
"simulation.plot();",
"_____no_output_____"
]
],
[
[
"The vtk file has a couple of scalar values stored (seen in the table with data arrays). We can switch the active scalars to temperature for example using:",
"_____no_output_____"
]
],
[
[
"simulation.set_active_scalars('temp')",
"_____no_output_____"
],
[
"simulation.plot();",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb6b245180e51c976e00a21ab66f65090840f222 | 55,602 | ipynb | Jupyter Notebook | 19_training_and_deploying_at_scale.ipynb | antonin-lfv/handson-ml2 | 92b5f83f8a967ed6ce533a2b6b571d8280588d4b | [
"Apache-2.0"
]
| 16 | 2020-08-30T06:24:02.000Z | 2021-08-20T16:14:02.000Z | 19_training_and_deploying_at_scale.ipynb | annan92419/handson-ml2 | 0b5333c6fc5bb53d72f4933234385e16c287f4be | [
"Apache-2.0"
]
| 8 | 2020-11-13T18:58:45.000Z | 2022-03-12T00:38:05.000Z | 19_training_and_deploying_at_scale.ipynb | yangguo/handson-ml2 | e078ce99cd261ce5bbc4f5de5deeef03c1d49f15 | [
"Apache-2.0"
]
| 12 | 2020-06-03T08:42:44.000Z | 2021-06-08T17:48:17.000Z | 32.978648 | 1,522 | 0.541222 | [
[
[
"**Chapter 19 – Training and Deploying TensorFlow Models at Scale**",
"_____no_output_____"
],
[
"_This notebook contains all the sample code in chapter 19._",
"_____no_output_____"
],
[
"<table align=\"left\">\n <td>\n <a target=\"_blank\" href=\"https://colab.research.google.com/github/ageron/handson-ml2/blob/master/19_training_and_deploying_at_scale.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n </td>\n</table>",
"_____no_output_____"
],
[
"# Setup\nFirst, let's import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures. We also check that Python 3.5 or later is installed (although Python 2.x may work, it is deprecated so we strongly recommend you use Python 3 instead), as well as Scikit-Learn ≥0.20 and TensorFlow ≥2.0.\n",
"_____no_output_____"
]
],
[
[
"# Python ≥3.5 is required\nimport sys\nassert sys.version_info >= (3, 5)\n\n# Scikit-Learn ≥0.20 is required\nimport sklearn\nassert sklearn.__version__ >= \"0.20\"\n\ntry:\n # %tensorflow_version only exists in Colab.\n %tensorflow_version 2.x\n !echo \"deb http://storage.googleapis.com/tensorflow-serving-apt stable tensorflow-model-server tensorflow-model-server-universal\" > /etc/apt/sources.list.d/tensorflow-serving.list\n !curl https://storage.googleapis.com/tensorflow-serving-apt/tensorflow-serving.release.pub.gpg | apt-key add -\n !apt update && apt-get install -y tensorflow-model-server\n !pip install -q -U tensorflow-serving-api\n IS_COLAB = True\nexcept Exception:\n IS_COLAB = False\n\n# TensorFlow ≥2.0 is required\nimport tensorflow as tf\nfrom tensorflow import keras\nassert tf.__version__ >= \"2.0\"\n\nif not tf.config.list_physical_devices('GPU'):\n print(\"No GPU was detected. CNNs can be very slow without a GPU.\")\n if IS_COLAB:\n print(\"Go to Runtime > Change runtime and select a GPU hardware accelerator.\")\n\n# Common imports\nimport numpy as np\nimport os\n\n# to make this notebook's output stable across runs\nnp.random.seed(42)\ntf.random.set_seed(42)\n\n# To plot pretty figures\n%matplotlib inline\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\nmpl.rc('axes', labelsize=14)\nmpl.rc('xtick', labelsize=12)\nmpl.rc('ytick', labelsize=12)\n\n# Where to save the figures\nPROJECT_ROOT_DIR = \".\"\nCHAPTER_ID = \"deploy\"\nIMAGES_PATH = os.path.join(PROJECT_ROOT_DIR, \"images\", CHAPTER_ID)\nos.makedirs(IMAGES_PATH, exist_ok=True)\n\ndef save_fig(fig_id, tight_layout=True, fig_extension=\"png\", resolution=300):\n path = os.path.join(IMAGES_PATH, fig_id + \".\" + fig_extension)\n print(\"Saving figure\", fig_id)\n if tight_layout:\n plt.tight_layout()\n plt.savefig(path, format=fig_extension, dpi=resolution)",
"_____no_output_____"
]
],
[
[
"# Deploying TensorFlow models to TensorFlow Serving (TFS)\nWe will use the REST API or the gRPC API.",
"_____no_output_____"
],
[
"## Save/Load a `SavedModel`",
"_____no_output_____"
]
],
[
[
"(X_train_full, y_train_full), (X_test, y_test) = keras.datasets.mnist.load_data()\nX_train_full = X_train_full[..., np.newaxis].astype(np.float32) / 255.\nX_test = X_test[..., np.newaxis].astype(np.float32) / 255.\nX_valid, X_train = X_train_full[:5000], X_train_full[5000:]\ny_valid, y_train = y_train_full[:5000], y_train_full[5000:]\nX_new = X_test[:3]",
"_____no_output_____"
],
[
"np.random.seed(42)\ntf.random.set_seed(42)\n\nmodel = keras.models.Sequential([\n keras.layers.Flatten(input_shape=[28, 28, 1]),\n keras.layers.Dense(100, activation=\"relu\"),\n keras.layers.Dense(10, activation=\"softmax\")\n])\nmodel.compile(loss=\"sparse_categorical_crossentropy\",\n optimizer=keras.optimizers.SGD(lr=1e-2),\n metrics=[\"accuracy\"])\nmodel.fit(X_train, y_train, epochs=10, validation_data=(X_valid, y_valid))",
"Train on 55000 samples, validate on 5000 samples\nEpoch 1/10\n55000/55000 [==============================] - 2s 40us/sample - loss: 0.7018 - accuracy: 0.8223 - val_loss: 0.3722 - val_accuracy: 0.9022\nEpoch 2/10\n55000/55000 [==============================] - 2s 36us/sample - loss: 0.3528 - accuracy: 0.9021 - val_loss: 0.3000 - val_accuracy: 0.9170\nEpoch 3/10\n55000/55000 [==============================] - 2s 36us/sample - loss: 0.3032 - accuracy: 0.9150 - val_loss: 0.2659 - val_accuracy: 0.9280\nEpoch 4/10\n55000/55000 [==============================] - 2s 37us/sample - loss: 0.2730 - accuracy: 0.9233 - val_loss: 0.2442 - val_accuracy: 0.9342\nEpoch 5/10\n55000/55000 [==============================] - 2s 37us/sample - loss: 0.2504 - accuracy: 0.9305 - val_loss: 0.2272 - val_accuracy: 0.9346\nEpoch 6/10\n55000/55000 [==============================] - 2s 37us/sample - loss: 0.2319 - accuracy: 0.9353 - val_loss: 0.2104 - val_accuracy: 0.9418\nEpoch 7/10\n55000/55000 [==============================] - 2s 37us/sample - loss: 0.2156 - accuracy: 0.9395 - val_loss: 0.1987 - val_accuracy: 0.9484\nEpoch 8/10\n55000/55000 [==============================] - 2s 36us/sample - loss: 0.2019 - accuracy: 0.9434 - val_loss: 0.1893 - val_accuracy: 0.9496\nEpoch 9/10\n55000/55000 [==============================] - 2s 41us/sample - loss: 0.1898 - accuracy: 0.9471 - val_loss: 0.1765 - val_accuracy: 0.9526\nEpoch 10/10\n55000/55000 [==============================] - 2s 39us/sample - loss: 0.1791 - accuracy: 0.9495 - val_loss: 0.1691 - val_accuracy: 0.9550\n"
],
[
"np.round(model.predict(X_new), 2)",
"_____no_output_____"
],
[
"model_version = \"0001\"\nmodel_name = \"my_mnist_model\"\nmodel_path = os.path.join(model_name, model_version)\nmodel_path",
"_____no_output_____"
],
[
"!rm -rf {model_name}",
"_____no_output_____"
],
[
"tf.saved_model.save(model, model_path)",
"_____no_output_____"
],
[
"for root, dirs, files in os.walk(model_name):\n indent = ' ' * root.count(os.sep)\n print('{}{}/'.format(indent, os.path.basename(root)))\n for filename in files:\n print('{}{}'.format(indent + ' ', filename))",
"my_mnist_model/\n 0001/\n saved_model.pb\n variables/\n variables.data-00000-of-00001\n variables.index\n assets/\n"
],
[
"!saved_model_cli show --dir {model_path}",
"The given SavedModel contains the following tag-sets:\nserve\n"
],
[
"!saved_model_cli show --dir {model_path} --tag_set serve",
"The given SavedModel MetaGraphDef contains SignatureDefs with the following keys:\nSignatureDef key: \"__saved_model_init_op\"\nSignatureDef key: \"serving_default\"\n"
],
[
"!saved_model_cli show --dir {model_path} --tag_set serve \\\n --signature_def serving_default",
"The given SavedModel SignatureDef contains the following input(s):\n inputs['flatten_2_input'] tensor_info:\n dtype: DT_FLOAT\n shape: (-1, 28, 28, 1)\n name: serving_default_flatten_2_input:0\nThe given SavedModel SignatureDef contains the following output(s):\n outputs['dense_5'] tensor_info:\n dtype: DT_FLOAT\n shape: (-1, 10)\n name: StatefulPartitionedCall:0\nMethod name is: tensorflow/serving/predict\n"
],
[
"!saved_model_cli show --dir {model_path} --all",
"\nMetaGraphDef with tag-set: 'serve' contains the following SignatureDefs:\n\nsignature_def['__saved_model_init_op']:\n The given SavedModel SignatureDef contains the following input(s):\n The given SavedModel SignatureDef contains the following output(s):\n outputs['__saved_model_init_op'] tensor_info:\n dtype: DT_INVALID\n shape: unknown_rank\n name: NoOp\n Method name is: \n\nsignature_def['serving_default']:\n The given SavedModel SignatureDef contains the following input(s):\n inputs['flatten_2_input'] tensor_info:\n dtype: DT_FLOAT\n shape: (-1, 28, 28, 1)\n name: serving_default_flatten_2_input:0\n The given SavedModel SignatureDef contains the following output(s):\n outputs['dense_5'] tensor_info:\n dtype: DT_FLOAT\n shape: (-1, 10)\n name: StatefulPartitionedCall:0\n Method name is: tensorflow/serving/predict\n"
]
],
[
[
"Let's write the new instances to a `npy` file so we can pass them easily to our model:",
"_____no_output_____"
]
],
[
[
"np.save(\"my_mnist_tests.npy\", X_new)",
"_____no_output_____"
],
[
"input_name = model.input_names[0]\ninput_name",
"_____no_output_____"
]
],
[
[
"And now let's use `saved_model_cli` to make predictions for the instances we just saved:",
"_____no_output_____"
]
],
[
[
"!saved_model_cli run --dir {model_path} --tag_set serve \\\n --signature_def serving_default \\\n --inputs {input_name}=my_mnist_tests.npy",
"2019-06-10 10:56:43.396851: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\nWARNING: Logging before flag parsing goes to stderr.\nW0610 10:56:43.397369 140735810999168 deprecation.py:323] From /Users/ageron/miniconda3/envs/tf2/lib/python3.6/site-packages/tensorflow/python/tools/saved_model_cli.py:339: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.\nInstructions for updating:\nThis function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.\nW0610 10:56:43.421489 140735810999168 deprecation.py:323] From /Users/ageron/miniconda3/envs/tf2/lib/python3.6/site-packages/tensorflow/python/training/saver.py:1276: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.\nInstructions for updating:\nUse standard file APIs to check for files with this prefix.\nResult for output key dense_5:\n[[1.17575204e-04 1.13160660e-07 5.96997386e-04 2.08104262e-03\n 2.57820852e-06 6.44166794e-05 2.77263990e-08 9.96703804e-01\n 3.96052455e-05 3.93810158e-04]\n [1.22226949e-03 2.92685600e-05 9.86054957e-01 9.63000767e-03\n 8.81790996e-08 2.88744748e-04 1.58111588e-03 1.12290488e-09\n 1.19344448e-03 1.09315742e-07]\n [6.40679718e-05 9.63618696e-01 9.04400647e-03 2.98595289e-03\n 5.95759891e-04 3.74212675e-03 2.50709383e-03 1.14931818e-02\n 5.52693009e-03 4.22279176e-04]]\n"
],
[
"np.round([[1.1739199e-04, 1.1239604e-07, 6.0210604e-04, 2.0804715e-03, 2.5779348e-06,\n 6.4079795e-05, 2.7411186e-08, 9.9669880e-01, 3.9654213e-05, 3.9471846e-04],\n [1.2294615e-03, 2.9207937e-05, 9.8599273e-01, 9.6755642e-03, 8.8930705e-08,\n 2.9156188e-04, 1.5831805e-03, 1.1311053e-09, 1.1980456e-03, 1.1113169e-07],\n [6.4066830e-05, 9.6359509e-01, 9.0598064e-03, 2.9872139e-03, 5.9552520e-04,\n 3.7478798e-03, 2.5074568e-03, 1.1462728e-02, 5.5553433e-03, 4.2495009e-04]], 2)",
"_____no_output_____"
]
],
[
[
"## TensorFlow Serving",
"_____no_output_____"
],
[
"Install [Docker](https://docs.docker.com/install/) if you don't have it already. Then run:\n\n```bash\ndocker pull tensorflow/serving\n\nexport ML_PATH=$HOME/ml # or wherever this project is\ndocker run -it --rm -p 8500:8500 -p 8501:8501 \\\n -v \"$ML_PATH/my_mnist_model:/models/my_mnist_model\" \\\n -e MODEL_NAME=my_mnist_model \\\n tensorflow/serving\n```\nOnce you are finished using it, press Ctrl-C to shut down the server.",
"_____no_output_____"
],
[
"Alternatively, if `tensorflow_model_server` is installed (e.g., if you are running this notebook in Colab), then the following 3 cells will start the server:",
"_____no_output_____"
]
],
[
[
"os.environ[\"MODEL_DIR\"] = os.path.split(os.path.abspath(model_path))[0]",
"_____no_output_____"
],
[
"%%bash --bg\nnohup tensorflow_model_server \\\n --rest_api_port=8501 \\\n --model_name=my_mnist_model \\\n --model_base_path=\"${MODEL_DIR}\" >server.log 2>&1",
"_____no_output_____"
],
[
"!tail server.log",
"2019-11-06 13:04:12.267136: I external/org_tensorflow/tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA\n2019-11-06 13:04:12.283035: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:202] Restoring SavedModel bundle.\n2019-11-06 13:04:12.300096: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:151] Running initialization op on SavedModel bundle at path: /content/my_mnist_model/0002\n2019-11-06 13:04:12.304438: I external/org_tensorflow/tensorflow/cc/saved_model/loader.cc:311] SavedModel load for tags { serve }; Status: success. Took 39993 microseconds.\n2019-11-06 13:04:12.304900: I tensorflow_serving/servables/tensorflow/saved_model_warmup.cc:105] No warmup data file found at /content/my_mnist_model/0002/assets.extra/tf_serving_warmup_requests\n2019-11-06 13:04:12.305057: I tensorflow_serving/core/loader_harness.cc:87] Successfully loaded servable version {name: my_mnist_model version: 2}\n2019-11-06 13:04:12.306462: I tensorflow_serving/model_servers/server.cc:353] Running gRPC ModelServer at 0.0.0.0:8500 ...\n[warn] getaddrinfo: address family for nodename not supported\n2019-11-06 13:04:12.307179: I tensorflow_serving/model_servers/server.cc:373] Exporting HTTP/REST API at:localhost:8501 ...\n[evhttp_server.cc : 238] NET_LOG: Entering the event loop ...\n"
],
[
"import json\n\ninput_data_json = json.dumps({\n \"signature_name\": \"serving_default\",\n \"instances\": X_new.tolist(),\n})",
"_____no_output_____"
],
[
"repr(input_data_json)[:1500] + \"...\"",
"_____no_output_____"
]
],
[
[
"Now let's use TensorFlow Serving's REST API to make predictions:",
"_____no_output_____"
]
],
[
[
"import requests\n\nSERVER_URL = 'http://localhost:8501/v1/models/my_mnist_model:predict'\nresponse = requests.post(SERVER_URL, data=input_data_json)\nresponse.raise_for_status() # raise an exception in case of error\nresponse = response.json()",
"_____no_output_____"
],
[
"response.keys()",
"_____no_output_____"
],
[
"y_proba = np.array(response[\"predictions\"])\ny_proba.round(2)",
"_____no_output_____"
]
],
[
[
"### Using the gRPC API",
"_____no_output_____"
]
],
[
[
"from tensorflow_serving.apis.predict_pb2 import PredictRequest\n\nrequest = PredictRequest()\nrequest.model_spec.name = model_name\nrequest.model_spec.signature_name = \"serving_default\"\ninput_name = model.input_names[0]\nrequest.inputs[input_name].CopyFrom(tf.make_tensor_proto(X_new))",
"_____no_output_____"
],
[
"import grpc\nfrom tensorflow_serving.apis import prediction_service_pb2_grpc\n\nchannel = grpc.insecure_channel('localhost:8500')\npredict_service = prediction_service_pb2_grpc.PredictionServiceStub(channel)\nresponse = predict_service.Predict(request, timeout=10.0)",
"_____no_output_____"
],
[
"response",
"_____no_output_____"
]
],
[
[
"Convert the response to a tensor:",
"_____no_output_____"
]
],
[
[
"output_name = model.output_names[0]\noutputs_proto = response.outputs[output_name]\ny_proba = tf.make_ndarray(outputs_proto)\ny_proba.round(2)",
"_____no_output_____"
]
],
[
[
"Or to a NumPy array if your client does not include the TensorFlow library:",
"_____no_output_____"
]
],
[
[
"output_name = model.output_names[0]\noutputs_proto = response.outputs[output_name]\nshape = [dim.size for dim in outputs_proto.tensor_shape.dim]\ny_proba = np.array(outputs_proto.float_val).reshape(shape)\ny_proba.round(2)",
"_____no_output_____"
]
],
[
[
"## Deploying a new model version",
"_____no_output_____"
]
],
[
[
"np.random.seed(42)\ntf.random.set_seed(42)\n\nmodel = keras.models.Sequential([\n keras.layers.Flatten(input_shape=[28, 28, 1]),\n keras.layers.Dense(50, activation=\"relu\"),\n keras.layers.Dense(50, activation=\"relu\"),\n keras.layers.Dense(10, activation=\"softmax\")\n])\nmodel.compile(loss=\"sparse_categorical_crossentropy\",\n optimizer=keras.optimizers.SGD(lr=1e-2),\n metrics=[\"accuracy\"])\nhistory = model.fit(X_train, y_train, epochs=10, validation_data=(X_valid, y_valid))",
"Train on 55000 samples, validate on 5000 samples\nEpoch 1/10\n55000/55000 [==============================] - 2s 39us/sample - loss: 0.7035 - accuracy: 0.8060 - val_loss: 0.3445 - val_accuracy: 0.9032\nEpoch 2/10\n55000/55000 [==============================] - 2s 35us/sample - loss: 0.3213 - accuracy: 0.9084 - val_loss: 0.2660 - val_accuracy: 0.9252\nEpoch 3/10\n55000/55000 [==============================] - 2s 37us/sample - loss: 0.2663 - accuracy: 0.9236 - val_loss: 0.2304 - val_accuracy: 0.9392\nEpoch 4/10\n55000/55000 [==============================] - 2s 35us/sample - loss: 0.2331 - accuracy: 0.9331 - val_loss: 0.2069 - val_accuracy: 0.9430\nEpoch 5/10\n55000/55000 [==============================] - 2s 35us/sample - loss: 0.2105 - accuracy: 0.9390 - val_loss: 0.1910 - val_accuracy: 0.9446\nEpoch 6/10\n55000/55000 [==============================] - 2s 35us/sample - loss: 0.1924 - accuracy: 0.9442 - val_loss: 0.1732 - val_accuracy: 0.9518\nEpoch 7/10\n55000/55000 [==============================] - 2s 37us/sample - loss: 0.1771 - accuracy: 0.9489 - val_loss: 0.1679 - val_accuracy: 0.9526\nEpoch 8/10\n55000/55000 [==============================] - 2s 37us/sample - loss: 0.1650 - accuracy: 0.9527 - val_loss: 0.1574 - val_accuracy: 0.9546\nEpoch 9/10\n55000/55000 [==============================] - 2s 35us/sample - loss: 0.1540 - accuracy: 0.9555 - val_loss: 0.1446 - val_accuracy: 0.9590\nEpoch 10/10\n55000/55000 [==============================] - 2s 35us/sample - loss: 0.1448 - accuracy: 0.9583 - val_loss: 0.1414 - val_accuracy: 0.9608\n"
],
[
"model_version = \"0002\"\nmodel_name = \"my_mnist_model\"\nmodel_path = os.path.join(model_name, model_version)\nmodel_path",
"_____no_output_____"
],
[
"tf.saved_model.save(model, model_path)",
"_____no_output_____"
],
[
"for root, dirs, files in os.walk(model_name):\n indent = ' ' * root.count(os.sep)\n print('{}{}/'.format(indent, os.path.basename(root)))\n for filename in files:\n print('{}{}'.format(indent + ' ', filename))",
"my_mnist_model/\n 0002/\n saved_model.pb\n variables/\n variables.data-00000-of-00001\n variables.index\n assets/\n 0001/\n saved_model.pb\n variables/\n variables.data-00000-of-00001\n variables.index\n assets/\n"
]
],
[
[
"**Warning**: You may need to wait a minute before the new model is loaded by TensorFlow Serving.",
"_____no_output_____"
]
],
[
[
"import requests\n\nSERVER_URL = 'http://localhost:8501/v1/models/my_mnist_model:predict'\n \nresponse = requests.post(SERVER_URL, data=input_data_json)\nresponse.raise_for_status()\nresponse = response.json()",
"_____no_output_____"
],
[
"response.keys()",
"_____no_output_____"
],
[
"y_proba = np.array(response[\"predictions\"])\ny_proba.round(2)",
"_____no_output_____"
]
],
[
[
"# Deploy the model to Google Cloud AI Platform",
"_____no_output_____"
],
[
"Follow the instructions in the book to deploy the model to Google Cloud AI Platform, download the service account's private key and save it to the `my_service_account_private_key.json` in the project directory. Also, update the `project_id`:",
"_____no_output_____"
]
],
[
[
"project_id = \"onyx-smoke-242003\"",
"_____no_output_____"
],
[
"import googleapiclient.discovery\n\nos.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"] = \"my_service_account_private_key.json\"\nmodel_id = \"my_mnist_model\"\nmodel_path = \"projects/{}/models/{}\".format(project_id, model_id)\nmodel_path += \"/versions/v0001/\" # if you want to run a specific version\nml_resource = googleapiclient.discovery.build(\"ml\", \"v1\").projects()",
"_____no_output_____"
],
[
"def predict(X):\n input_data_json = {\"signature_name\": \"serving_default\",\n \"instances\": X.tolist()}\n request = ml_resource.predict(name=model_path, body=input_data_json)\n response = request.execute()\n if \"error\" in response:\n raise RuntimeError(response[\"error\"])\n return np.array([pred[output_name] for pred in response[\"predictions\"]])",
"_____no_output_____"
],
[
"Y_probas = predict(X_new)\nnp.round(Y_probas, 2)",
"_____no_output_____"
]
],
[
[
"# Using GPUs",
"_____no_output_____"
]
],
[
[
"tf.test.is_gpu_available()",
"_____no_output_____"
],
[
"tf.test.gpu_device_name()",
"_____no_output_____"
],
[
"tf.test.is_built_with_cuda()",
"_____no_output_____"
],
[
"from tensorflow.python.client.device_lib import list_local_devices\n\ndevices = list_local_devices()\ndevices",
"_____no_output_____"
]
],
[
[
"# Distributed Training",
"_____no_output_____"
]
],
[
[
"keras.backend.clear_session()\ntf.random.set_seed(42)\nnp.random.seed(42)",
"_____no_output_____"
],
[
"def create_model():\n return keras.models.Sequential([\n keras.layers.Conv2D(filters=64, kernel_size=7, activation=\"relu\",\n padding=\"same\", input_shape=[28, 28, 1]),\n keras.layers.MaxPooling2D(pool_size=2),\n keras.layers.Conv2D(filters=128, kernel_size=3, activation=\"relu\",\n padding=\"same\"), \n keras.layers.Conv2D(filters=128, kernel_size=3, activation=\"relu\",\n padding=\"same\"),\n keras.layers.MaxPooling2D(pool_size=2),\n keras.layers.Flatten(),\n keras.layers.Dense(units=64, activation='relu'),\n keras.layers.Dropout(0.5),\n keras.layers.Dense(units=10, activation='softmax'),\n ])",
"_____no_output_____"
],
[
"batch_size = 100\nmodel = create_model()\nmodel.compile(loss=\"sparse_categorical_crossentropy\",\n optimizer=keras.optimizers.SGD(lr=1e-2),\n metrics=[\"accuracy\"])\nmodel.fit(X_train, y_train, epochs=10,\n validation_data=(X_valid, y_valid), batch_size=batch_size)",
"_____no_output_____"
],
[
"keras.backend.clear_session()\ntf.random.set_seed(42)\nnp.random.seed(42)\n\ndistribution = tf.distribute.MirroredStrategy()\n\n# Change the default all-reduce algorithm:\n#distribution = tf.distribute.MirroredStrategy(\n# cross_device_ops=tf.distribute.HierarchicalCopyAllReduce())\n\n# Specify the list of GPUs to use:\n#distribution = tf.distribute.MirroredStrategy(devices=[\"/gpu:0\", \"/gpu:1\"])\n\n# Use the central storage strategy instead:\n#distribution = tf.distribute.experimental.CentralStorageStrategy()\n\n#resolver = tf.distribute.cluster_resolver.TPUClusterResolver()\n#tf.tpu.experimental.initialize_tpu_system(resolver)\n#distribution = tf.distribute.experimental.TPUStrategy(resolver)\n\nwith distribution.scope():\n model = create_model()\n model.compile(loss=\"sparse_categorical_crossentropy\",\n optimizer=keras.optimizers.SGD(lr=1e-2),\n metrics=[\"accuracy\"])",
"WARNING: Logging before flag parsing goes to stderr.\nW0603 15:31:26.178871 140735810999168 cross_device_ops.py:1178] There is non-GPU devices in `tf.distribute.Strategy`, not using nccl allreduce.\n"
],
[
"batch_size = 100 # must be divisible by the number of workers\nmodel.fit(X_train, y_train, epochs=10,\n validation_data=(X_valid, y_valid), batch_size=batch_size)",
"_____no_output_____"
],
[
"model.predict(X_new)",
"_____no_output_____"
]
],
[
[
"Custom training loop:",
"_____no_output_____"
]
],
[
[
"keras.backend.clear_session()\ntf.random.set_seed(42)\nnp.random.seed(42)\n\nK = keras.backend\n\ndistribution = tf.distribute.MirroredStrategy()\n\nwith distribution.scope():\n model = create_model()\n optimizer = keras.optimizers.SGD()\n\nwith distribution.scope():\n dataset = tf.data.Dataset.from_tensor_slices((X_train, y_train)).repeat().batch(batch_size)\n input_iterator = distribution.make_dataset_iterator(dataset)\n \[email protected]\ndef train_step():\n def step_fn(inputs):\n X, y = inputs\n with tf.GradientTape() as tape:\n Y_proba = model(X)\n loss = K.sum(keras.losses.sparse_categorical_crossentropy(y, Y_proba)) / batch_size\n\n grads = tape.gradient(loss, model.trainable_variables)\n optimizer.apply_gradients(zip(grads, model.trainable_variables))\n return loss\n\n per_replica_losses = distribution.experimental_run(step_fn, input_iterator)\n mean_loss = distribution.reduce(tf.distribute.ReduceOp.SUM,\n per_replica_losses, axis=None)\n return mean_loss\n\nn_epochs = 10\nwith distribution.scope():\n input_iterator.initialize()\n for epoch in range(n_epochs):\n print(\"Epoch {}/{}\".format(epoch + 1, n_epochs))\n for iteration in range(len(X_train) // batch_size):\n print(\"\\rLoss: {:.3f}\".format(train_step().numpy()), end=\"\")\n print()",
"_____no_output_____"
],
[
"batch_size = 100 # must be divisible by the number of workers\nmodel.fit(X_train, y_train, epochs=10,\n validation_data=(X_valid, y_valid), batch_size=batch_size)",
"_____no_output_____"
]
],
[
[
"## Training across multiple servers",
"_____no_output_____"
],
[
"A TensorFlow cluster is a group of TensorFlow processes running in parallel, usually on different machines, and talking to each other to complete some work, for example training or executing a neural network. Each TF process in the cluster is called a \"task\" (or a \"TF server\"). It has an IP address, a port, and a type (also called its role or its job). The type can be `\"worker\"`, `\"chief\"`, `\"ps\"` (parameter server) or `\"evaluator\"`:\n* Each **worker** performs computations, usually on a machine with one or more GPUs.\n* The **chief** performs computations as well, but it also handles extra work such as writing TensorBoard logs or saving checkpoints. There is a single chief in a cluster. If no chief is specified, then the first worker is the chief.\n* A **parameter server** (ps) only keeps track of variable values, it is usually on a CPU-only machine.\n* The **evaluator** obviously takes care of evaluation. There is usually a single evaluator in a cluster.\n\nThe set of tasks that share the same type is often called a \"job\". For example, the \"worker\" job is the set of all workers.\n\nTo start a TensorFlow cluster, you must first specify it. This means defining all the tasks (IP address, TCP port, and type). For example, the following cluster specification defines a cluster with 3 tasks (2 workers and 1 parameter server). It's a dictionary with one key per job, and the values are lists of task addresses:\n\n```\n{\n \"worker\": [\"my-worker0.example.com:9876\", \"my-worker1.example.com:9876\"],\n \"ps\": [\"my-ps0.example.com:9876\"]\n}\n```\n\nEvery task in the cluster may communicate with every other task in the server, so make sure to configure your firewall to authorize all communications between these machines on these ports (it's usually simpler if you use the same port on every machine).\n\nWhen a task is started, it needs to be told which one it is: its type and index (the task index is also called the task id). A common way to specify everything at once (both the cluster spec and the current task's type and id) is to set the `TF_CONFIG` environment variable before starting the program. It must be a JSON-encoded dictionary containing a cluster specification (under the `\"cluster\"` key), and the type and index of the task to start (under the `\"task\"` key). For example, the following `TF_CONFIG` environment variable defines a simple cluster with 2 workers and 1 parameter server, and specifies that the task to start is the first worker:",
"_____no_output_____"
]
],
[
[
"import os\nimport json\n\nos.environ[\"TF_CONFIG\"] = json.dumps({\n \"cluster\": {\n \"worker\": [\"my-work0.example.com:9876\", \"my-work1.example.com:9876\"],\n \"ps\": [\"my-ps0.example.com:9876\"]\n },\n \"task\": {\"type\": \"worker\", \"index\": 0}\n})\nprint(\"TF_CONFIG='{}'\".format(os.environ[\"TF_CONFIG\"]))",
"TF_CONFIG='{\"cluster\": {\"worker\": [\"my-work0.example.com:9876\", \"my-work1.example.com:9876\"], \"ps\": [\"my-ps0.example.com:9876\"]}, \"task\": {\"type\": \"worker\", \"index\": 0}}'\n"
]
],
[
[
"Some platforms (e.g., Google Cloud ML Engine) automatically set this environment variable for you.",
"_____no_output_____"
],
[
"Then you would write a short Python script to start a task. The same script can be used on every machine, since it will load the `TF_CONFIG` variable, which will tell it which task to start:",
"_____no_output_____"
]
],
[
[
"import tensorflow as tf\n\nresolver = tf.distribute.cluster_resolver.TFConfigClusterResolver()\nworker0 = tf.distribute.Server(resolver.cluster_spec(),\n job_name=resolver.task_type,\n task_index=resolver.task_id)",
"_____no_output_____"
]
],
[
[
"Another way to specify the cluster specification is directly in Python, rather than through an environment variable:",
"_____no_output_____"
]
],
[
[
"cluster_spec = tf.train.ClusterSpec({\n \"worker\": [\"127.0.0.1:9901\", \"127.0.0.1:9902\"],\n \"ps\": [\"127.0.0.1:9903\"]\n})",
"_____no_output_____"
]
],
[
[
"You can then start a server simply by passing it the cluster spec and indicating its type and index. Let's start the two remaining tasks (remember that in general you would only start a single task per machine; we are starting 3 tasks on the localhost just for the purpose of this code example):",
"_____no_output_____"
]
],
[
[
"#worker1 = tf.distribute.Server(cluster_spec, job_name=\"worker\", task_index=1)\nps0 = tf.distribute.Server(cluster_spec, job_name=\"ps\", task_index=0)",
"_____no_output_____"
],
[
"os.environ[\"TF_CONFIG\"] = json.dumps({\n \"cluster\": {\n \"worker\": [\"127.0.0.1:9901\", \"127.0.0.1:9902\"],\n \"ps\": [\"127.0.0.1:9903\"]\n },\n \"task\": {\"type\": \"worker\", \"index\": 1}\n})\nprint(repr(os.environ[\"TF_CONFIG\"]))",
"'{\"cluster\": {\"worker\": [\"127.0.0.1:9901\", \"127.0.0.1:9902\"], \"ps\": [\"127.0.0.1:9903\"]}, \"task\": {\"type\": \"worker\", \"index\": 1}}'\n"
],
[
"distribution = tf.distribute.experimental.MultiWorkerMirroredStrategy()\n\nkeras.backend.clear_session()\ntf.random.set_seed(42)\nnp.random.seed(42)\n\nos.environ[\"TF_CONFIG\"] = json.dumps({\n \"cluster\": {\n \"worker\": [\"127.0.0.1:9901\", \"127.0.0.1:9902\"],\n \"ps\": [\"127.0.0.1:9903\"]\n },\n \"task\": {\"type\": \"worker\", \"index\": 1}\n})\n#CUDA_VISIBLE_DEVICES=0 \n\nwith distribution.scope():\n model = create_model()\n model.compile(loss=\"sparse_categorical_crossentropy\",\n optimizer=keras.optimizers.SGD(lr=1e-2),\n metrics=[\"accuracy\"])",
"_____no_output_____"
],
[
"import tensorflow as tf\nfrom tensorflow import keras\nimport numpy as np\n\n# At the beginning of the program (restart the kernel before running this cell)\ndistribution = tf.distribute.experimental.MultiWorkerMirroredStrategy()\n\n(X_train_full, y_train_full), (X_test, y_test) = keras.datasets.mnist.load_data()\nX_train_full = X_train_full[..., np.newaxis] / 255.\nX_test = X_test[..., np.newaxis] / 255.\nX_valid, X_train = X_train_full[:5000], X_train_full[5000:]\ny_valid, y_train = y_train_full[:5000], y_train_full[5000:]\nX_new = X_test[:3]\n\nn_workers = 2\nbatch_size = 32 * n_workers\ndataset = tf.data.Dataset.from_tensor_slices((X_train[..., np.newaxis], y_train)).repeat().batch(batch_size)\n \ndef create_model():\n return keras.models.Sequential([\n keras.layers.Conv2D(filters=64, kernel_size=7, activation=\"relu\",\n padding=\"same\", input_shape=[28, 28, 1]),\n keras.layers.MaxPooling2D(pool_size=2),\n keras.layers.Conv2D(filters=128, kernel_size=3, activation=\"relu\",\n padding=\"same\"), \n keras.layers.Conv2D(filters=128, kernel_size=3, activation=\"relu\",\n padding=\"same\"),\n keras.layers.MaxPooling2D(pool_size=2),\n keras.layers.Flatten(),\n keras.layers.Dense(units=64, activation='relu'),\n keras.layers.Dropout(0.5),\n keras.layers.Dense(units=10, activation='softmax'),\n ])\n\nwith distribution.scope():\n model = create_model()\n model.compile(loss=\"sparse_categorical_crossentropy\",\n optimizer=keras.optimizers.SGD(lr=1e-2),\n metrics=[\"accuracy\"])\n\nmodel.fit(dataset, steps_per_epoch=len(X_train)//batch_size, epochs=10)",
"_____no_output_____"
],
[
"# Hyperparameter tuning\n\n# Only talk to ps server\nconfig_proto = tf.ConfigProto(device_filters=['/job:ps', '/job:worker/task:%d' % tf_config['task']['index']])\nconfig = tf.estimator.RunConfig(session_config=config_proto)\n# default since 1.10",
"_____no_output_____"
],
[
"strategy.num_replicas_in_sync",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6b2cd1859b3604e13d832860c3917c721462b7 | 786,436 | ipynb | Jupyter Notebook | module4-model-interpretation/LS_DS_234.ipynb | Lilchoto3/DS-Unit-2-Applied-Modeling | 873d330de86ef301ab57248b06b36931549387f2 | [
"MIT"
]
| null | null | null | module4-model-interpretation/LS_DS_234.ipynb | Lilchoto3/DS-Unit-2-Applied-Modeling | 873d330de86ef301ab57248b06b36931549387f2 | [
"MIT"
]
| null | null | null | module4-model-interpretation/LS_DS_234.ipynb | Lilchoto3/DS-Unit-2-Applied-Modeling | 873d330de86ef301ab57248b06b36931549387f2 | [
"MIT"
]
| null | null | null | 318.524099 | 108,868 | 0.761055 | [
[
[
"\nLambda School Data Science\n\n*Unit 2, Sprint 3, Module 4*\n\n---\n",
"_____no_output_____"
],
[
"# Model Interpretation\n\n- Visualize and interpret **partial dependence plots**\n- Explain individual predictions with **shapley value plots**",
"_____no_output_____"
],
[
"### Setup\n\nRun the code cell below. You can work locally (follow the [local setup instructions](https://lambdaschool.github.io/ds/unit2/local/)) or on Colab.\n\nLibraries:\n\n- category_encoders\n- matplotlib\n- numpy\n- pandas\n- [**pdpbox**](https://github.com/SauceCat/PDPbox)\n- plotly\n- scikit-learn\n- scipy.stats\n- [**shap**](https://github.com/slundberg/shap)\n- xgboost\n",
"_____no_output_____"
]
],
[
[
"%%capture\nimport sys\n\n# If you're on Colab:\nif 'google.colab' in sys.modules:\n DATA_PATH = 'https://raw.githubusercontent.com/LambdaSchool/DS-Unit-2-Applied-Modeling/master/data/'\n !pip install category_encoders==2.*\n !pip install pdpbox\n !pip install shap\n\n# If you're working locally:\nelse:\n DATA_PATH = '../data/'\n\n\n# Ignore this warning: https://github.com/dmlc/xgboost/issues/4300\n# xgboost/core.py:587: FutureWarning: Series.base is deprecated and will be removed in a future version\nimport warnings\nwarnings.filterwarnings(action='ignore', category=FutureWarning, module='xgboost')",
"_____no_output_____"
]
],
[
[
"# Visualize and interpret partial dependence plots",
"_____no_output_____"
],
[
"## Overview",
"_____no_output_____"
],
[
"Partial dependence plots show the relationship between 1-2 individual features and the target — how predictions partially depend on the isolated features.",
"_____no_output_____"
],
[
"It's explained well by [PDPbox library documentation](https://pdpbox.readthedocs.io/en/latest/):\n\n>**The common headache**: When using black box machine learning algorithms like random forest and boosting, it is hard to understand the relations between predictors and model outcome. For example, in terms of random forest, all we get is the feature importance. Although we can know which feature is significantly influencing the outcome based on the importance calculation, it really sucks that we don’t know in which direction it is influencing. And in most of the real cases, the effect is non-monotonic. We need some powerful tools to help understanding the complex relations between predictors and model prediction.\n",
"_____no_output_____"
],
[
"Let's also look at an [animation by Christoph Molnar](https://twitter.com/ChristophMolnar/status/1066398522608635904), author of [_Interpretable Machine Learning_](https://christophm.github.io/interpretable-ml-book/pdp.html#examples):\n\n> Partial dependence plots show how a feature affects predictions of a Machine Learning model on average.\n> 1. Define grid along feature\n> 2. Model predictions at grid points\n> 3. Line per data instance -> ICE (Individual Conditional Expectation) curve\n> 4. Average curves to get a PDP (Partial Dependence Plot)\n",
"_____no_output_____"
],
[
"To demonstrate, we'll use a Lending Club dataset, to predict interest rates. (Like [this example](https://rrherr-project2-example.herokuapp.com/).)",
"_____no_output_____"
]
],
[
[
"import pandas as pd\n\n# Stratified sample, 10% of expired Lending Club loans, grades A-D\n# Source: https://www.lendingclub.com/info/download-data.action\nhistory = pd.read_csv(DATA_PATH+'lending-club/lending-club-subset.csv')\nhistory['issue_d'] = pd.to_datetime(history['issue_d'], infer_datetime_format=True)\n\n# Just use 36 month loans\nhistory = history[history.term==' 36 months']\n\n# Index & sort by issue date\nhistory = history.set_index('issue_d').sort_index()\n\n# Clean data, engineer feature, & select subset of features\nhistory = history.rename(columns= \n {'annual_inc': 'Annual Income', \n 'fico_range_high': 'Credit Score', \n 'funded_amnt': 'Loan Amount', \n 'title': 'Loan Purpose'})\n\nhistory['Interest Rate'] = history['int_rate'].str.strip('%').astype(float)\nhistory['Monthly Debts'] = history['Annual Income'] / 12 * history['dti'] / 100\n\ncolumns = ['Annual Income', \n 'Credit Score', \n 'Loan Amount', \n 'Loan Purpose', \n 'Monthly Debts', \n 'Interest Rate']\n\nhistory = history[columns]\nhistory = history.dropna()\n\n# Test on the last 10,000 loans,\n# Validate on the 10,000 before that,\n# Train on the rest\ntest = history[-10000:]\nval = history[-20000:-10000]\ntrain = history[:-20000]",
"_____no_output_____"
],
[
"# Assign to X, y\ntarget = 'Interest Rate'\nfeatures = history.columns.drop('Interest Rate')\n\nX_train = train[features]\ny_train = train[target]\n\nX_val = val[features]\ny_val = val[target]\n\nX_test = test[features]\ny_test = test[target]",
"_____no_output_____"
],
[
"# The target has some right skew, but it's not too bad\n%matplotlib inline\nimport seaborn as sns\nsns.distplot(y_train);",
"_____no_output_____"
],
[
"y_train.describe()",
"_____no_output_____"
]
],
[
[
"### Fit Linear Regression model",
"_____no_output_____"
]
],
[
[
"import category_encoders as ce\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.preprocessing import StandardScaler\n\nlr = make_pipeline(\n ce.TargetEncoder(), \n LinearRegression()\n)\n\nlr.fit(X_train, y_train)\nprint('Linear Regression R^2', lr.score(X_val, y_val))",
"Linear Regression R^2 0.22422462337805615\n"
]
],
[
[
"### Explaining Linear Regression",
"_____no_output_____"
]
],
[
[
"coefficients = lr.named_steps['linearregression'].coef_\npd.Series(coefficients, features)",
"_____no_output_____"
]
],
[
[
"### Fit Gradient Boosting model\n",
"_____no_output_____"
]
],
[
[
"from sklearn.metrics import r2_score\nfrom xgboost import XGBRegressor\n\ngb = make_pipeline(\n ce.OrdinalEncoder(), \n XGBRegressor(n_estimators=200, objective='reg:squarederror', n_jobs=-1)\n)\n\ngb.fit(X_train, y_train)\ny_pred = gb.predict(X_val)\nprint('Gradient Boosting R^2', r2_score(y_val, y_pred))",
"Gradient Boosting R^2 0.27488377264062747\n"
]
],
[
[
"### Explaining Gradient Boosting???\n\nLinear models have coefficients, but trees do not.\n\nInstead, to see the relationship between individual feature(s) and the target, we can use partial dependence plots.",
"_____no_output_____"
],
[
"## Follow Along\n",
"_____no_output_____"
],
[
"### Partial Dependence Plots with 1 feature\n\nPDPbox\n- [Gallery](https://github.com/SauceCat/PDPbox#gallery)\n- [API Reference: pdp_isolate](https://pdpbox.readthedocs.io/en/latest/pdp_isolate.html)\n- [API Reference: pdp_plot](https://pdpbox.readthedocs.io/en/latest/pdp_plot.html)\n",
"_____no_output_____"
]
],
[
[
"# Later, when you save matplotlib images to include in blog posts or web apps,\n# increase the dots per inch (double it), so the text isn't so fuzzy\nimport matplotlib.pyplot as plt\nplt.rcParams['figure.dpi'] = 72",
"_____no_output_____"
],
[
"",
"_____no_output_____"
]
],
[
[
"### Partial Dependence Plots with 2 features\n\nSee interactions!\n\nPDPbox\n- [Gallery](https://github.com/SauceCat/PDPbox#gallery)\n- [API Reference: pdp_interact](https://pdpbox.readthedocs.io/en/latest/pdp_interact.html)\n- [API Reference: pdp_interact_plot](https://pdpbox.readthedocs.io/en/latest/pdp_interact_plot.html)\n\nBe aware of a bug in PDPBox version <= 0.20 with some versions of matplotlib:\n- With the `pdp_interact_plot` function, `plot_type='contour'` gets an error, but `plot_type='grid'` works\n- This will be fixed in the next release of PDPbox: https://github.com/SauceCat/PDPbox/issues/40\n",
"_____no_output_____"
]
],
[
[
"from pdpbox.pdp import pdp_interact, pdp_interact_plot\n\nfeatures = ['Annual Income', 'Credit Score']\n\ninteraction = pdp_interact(\n model=gb,\n dataset=X_val,\n model_features=X_val.columns,\n features=features\n)\n\npdp_interact_plot(interaction, plot_type='grid', feature_names=features);",
"findfont: Font family ['Arial'] not found. Falling back to DejaVu Sans.\n"
]
],
[
[
"### BONUS: 3D with Plotly!\n\nJust for your future reference, here's how you can make it 3D! (Like [this example](https://rrherr-project2-example.herokuapp.com/).)",
"_____no_output_____"
]
],
[
[
"# First, make the 2D plot above. Then ...\n\npdp = interaction.pdp.pivot_table(\n values='preds', \n columns=features[0], \n index=features[1]\n)[::-1] # Slice notation to reverse index order so y axis is ascending",
"_____no_output_____"
],
[
"pdp = pdp.drop(columns=[1000.0, 751329.0])",
"_____no_output_____"
],
[
"import plotly.graph_objs as go\n\nsurface = go.Surface(\n x=pdp.columns, \n y=pdp.index, \n z=pdp.values\n)\n\n\nlayout = go.Layout(\n scene=dict(\n xaxis=dict(title=features[0]), \n yaxis=dict(title=features[1]), \n zaxis=dict(title=target)\n )\n)\n\nfig = go.Figure(surface, layout)\nfig.show()",
"_____no_output_____"
]
],
[
[
"### BONUS: PDPs with categorical features\n\nJust for your future reference, here's a bonus example to demonstrate partial dependence plots with categorical features.\n\n1. I recommend you use Ordinal Encoder or Target Encoder, outside of a pipeline, to encode your data first. (If there is a natural ordering, then take the time to encode it that way, instead of random integers.) Then use the encoded data with pdpbox.\n2. There's some extra work to get readable category names on your plot, instead of integer category codes.\n",
"_____no_output_____"
]
],
[
[
"# Fit a model on Titanic data\nimport category_encoders as ce\nimport seaborn as sns\nfrom sklearn.ensemble import RandomForestClassifier\n\ndf = sns.load_dataset('titanic')\ndf.age = df.age.fillna(df.age.median())\ndf = df.drop(columns='deck')\ndf = df.dropna()\n\ntarget = 'survived'\nfeatures = df.columns.drop(['survived', 'alive'])\n\nX = df[features]\ny = df[target]\n\n# Use Ordinal Encoder, outside of a pipeline\nencoder = ce.OrdinalEncoder()\nX_encoded = encoder.fit_transform(X)\n\nmodel = RandomForestClassifier(n_estimators=100, random_state=42, n_jobs=-1)\nmodel.fit(X_encoded, y)",
"_____no_output_____"
],
[
"# Use Pdpbox\n%matplotlib inline\nimport matplotlib.pyplot as plt\nfrom pdpbox import pdp\nfeature = 'sex'\npdp_dist = pdp.pdp_isolate(model=model, dataset=X_encoded, model_features=features, feature=feature)\npdp.pdp_plot(pdp_dist, feature);",
"_____no_output_____"
],
[
"# Look at the encoder's mappings\nencoder.mapping",
"_____no_output_____"
],
[
"pdp.pdp_plot(pdp_dist, feature)\n\n# Manually change the xticks labels\nplt.xticks([1, 2], ['male', 'female']);",
"_____no_output_____"
],
[
"# Let's automate it\n\nfeature = 'sex'\nfor item in encoder.mapping:\n if item['col'] == feature:\n feature_mapping = item['mapping']\n \nfeature_mapping = feature_mapping[feature_mapping.index.dropna()]\ncategory_names = feature_mapping.index.tolist()\ncategory_codes = feature_mapping.values.tolist()",
"_____no_output_____"
],
[
"pdp.pdp_plot(pdp_dist, feature)\n\n# Automatically change the xticks labels\nplt.xticks(category_codes, category_names);",
"_____no_output_____"
],
[
"features = ['sex', 'age']\n\ninteraction = pdp_interact(\n model=model, \n dataset=X_encoded, \n model_features=X_encoded.columns, \n features=features\n)\n\npdp_interact_plot(interaction, plot_type='grid', feature_names=features);",
"_____no_output_____"
],
[
"pdp = interaction.pdp.pivot_table(\n values='preds', \n columns=features[0], # First feature on x axis\n index=features[1] # Next feature on y axis\n)[::-1] # Reverse the index order so y axis is ascending\n\npdp = pdp.rename(columns=dict(zip(category_codes, category_names)))\nplt.figure(figsize=(10,8))\nsns.heatmap(pdp, annot=True, fmt='.2f', cmap='viridis')\nplt.title('Partial Dependence of Titanic survival, on sex & age');",
"_____no_output_____"
]
],
[
[
"# Explain individual predictions with shapley value plots",
"_____no_output_____"
],
[
"## Overview",
"_____no_output_____"
],
[
"We’ll use TreeExplainer from an awesome library called [SHAP](https://github.com/slundberg/shap), for “additive explanations” — we can explain individual predictions by seeing how the features add up!\n\n<img src=\"https://raw.githubusercontent.com/slundberg/shap/master/docs/artwork/shap_header.png\" width=\"800\" />",
"_____no_output_____"
],
[
"### Regression example",
"_____no_output_____"
],
[
"We're coming full circle, with the NYC Apartment Rent dataset! Remember this code you wrote for your first assignment?\n\n```python\n# Arrange X features matrix & y target vector\nfeatures = ['bedrooms', 'bathrooms']\ntarget = 'price'\nX = df[features]\ny = df[target]\n\n# Fit model\nfrom sklearn.linear_model import LinearRegression\nmodel = LinearRegression()\nmodel.fit(X, y)\n\ndef predict(bedrooms, bathrooms):\n y_pred = model.predict([[bedrooms, bathrooms]])\n estimate = y_pred[0]\n bed_coef = model.coef_[0]\n bath_coef = model.coef_[1]\n \n # Format with $ and comma separators. No decimals.\n result = f'Rent for a {bedrooms}-bed, {bathrooms}-bath apartment in NYC is estimated at ${estimate:,.0f}.'\n explanation = f' In this model, each bedroom adds ${bed_coef:,.0f} & each bathroom adds ${bath_coef:,.0f}.'\n return result + explanation\n```",
"_____no_output_____"
],
[
"Let’s do something similar, but with a tuned Random Forest and Shapley Values.",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport pandas as pd\n\n# Read New York City apartment rental listing data\ndf = pd.read_csv(DATA_PATH+'apartments/renthop-nyc.csv')\nassert df.shape == (49352, 34)\n\n# Remove the most extreme 1% prices,\n# the most extreme .1% latitudes, &\n# the most extreme .1% longitudes\ndf = df[(df['price'] >= np.percentile(df['price'], 0.5)) & \n (df['price'] <= np.percentile(df['price'], 99.5)) & \n (df['latitude'] >= np.percentile(df['latitude'], 0.05)) & \n (df['latitude'] < np.percentile(df['latitude'], 99.95)) &\n (df['longitude'] >= np.percentile(df['longitude'], 0.05)) & \n (df['longitude'] <= np.percentile(df['longitude'], 99.95))]\n\n# Do train/test split\n# Use data from April & May 2016 to train\n# Use data from June 2016 to test\ndf['created'] = pd.to_datetime(df['created'], infer_datetime_format=True)\ncutoff = pd.to_datetime('2016-06-01')\ntrain = df[df.created < cutoff]\ntest = df[df.created >= cutoff]",
"_____no_output_____"
],
[
"# Assign to X, y\nfeatures = ['bedrooms', 'bathrooms', 'longitude', 'latitude']\ntarget = 'price'\nX_train = train[features]\ny_train = train[target]\nX_test = test[features]\ny_test = test[target]",
"_____no_output_____"
],
[
"from scipy.stats import randint, uniform\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.model_selection import RandomizedSearchCV\n\nparam_distributions = { \n 'n_estimators': randint(50, 500), \n 'max_depth': [5, 10, 15, 20, None], \n 'max_features': uniform(0, 1), \n}\n\nsearch = RandomizedSearchCV(\n RandomForestRegressor(random_state=42), \n param_distributions=param_distributions, \n n_iter=5, \n cv=2, \n scoring='neg_mean_absolute_error', \n verbose=10, \n return_train_score=True, \n n_jobs=-1, \n random_state=42\n)\n\nsearch.fit(X_train, y_train);",
"Fitting 2 folds for each of 5 candidates, totalling 10 fits\n"
],
[
"print('Best hyperparameters', search.best_params_)\nprint('Cross-validation MAE', -search.best_score_)\nmodel = search.best_estimator_",
"Best hyperparameters {'max_depth': None, 'max_features': 0.6011150117432088, 'n_estimators': 201}\nCross-validation MAE 375.95637690332126\n"
]
],
[
[
"## Follow Along",
"_____no_output_____"
],
[
"#### [Dan Becker explains Shapley Values:](https://www.kaggle.com/dansbecker/shap-values)\n\n>You've seen (and used) techniques to extract general insights from a machine learning model. But what if you want to break down how the model works for an individual prediction?\n>\n>SHAP Values (an acronym from SHapley Additive exPlanations) break down a prediction to show the impact of each feature. \n>\n>There is some complexity to the technique ... We won't go into that detail here, since it isn't critical for using the technique. [This blog post](https://towardsdatascience.com/one-feature-attribution-method-to-supposedly-rule-them-all-shapley-values-f3e04534983d) has a longer theoretical explanation.",
"_____no_output_____"
]
],
[
[
"# Get an individual observation to explain.\n# For example, the 0th row from the test set.\n\nrow = X_test.iloc[[0]]\nrow",
"_____no_output_____"
],
[
"# What was the actual rent for this apartment?\ny_test.iloc[[0]]",
"_____no_output_____"
],
[
"# What does the model predict for this apartment?\n\nmodel.predict(row)",
"_____no_output_____"
],
[
"# Why did the model predict this?\n# Look at a Shapley Values Force Plot\n\nimport shap\n\nexplainer = shap.TreeExplainer(model)\nshap_values = explainer.shap_values(row)\n\nshap.initjs()\nshap.force_plot(\n base_value=explainer.expected_value,\n shap_values=shap_values,\n features=row\n)",
"ERROR! Session/line number was not unique in database. History logging moved to new session 59\n"
]
],
[
[
"### Define the predict function",
"_____no_output_____"
]
],
[
[
"def predict(bedrooms, bathrooms, longitude, latitude):\n\n # Make dataframe from the inputs\n df = pd.DataFrame(\n data=[[bedrooms, bathrooms, longitude, latitude]], \n columns=['bedrooms', 'bathrooms', 'longitude', 'latitude']\n )\n\n # Get the model's prediction\n pred = model.predict(df)[0]\n\n # Calculate shap values\n explainer = shap.TreeExplainer(model)\n shap_values = explainer.shap_values(df)\n\n # Get series with shap values, feature names, & feature values\n feature_names = df.columns\n feature_values = df.values[0]\n shaps = pd.Series(shap_values[0], zip(feature_names, feature_values))\n\n # Print results\n result = f'${pred:,.0f} estimated rent for this NYC apartment. \\n\\n'\n result += f'Starting from baseline of ${explainer.expected_value:,.0f} \\n'\n result += shaps.to_string()\n print(result)\n\n\n # Show shapley values force plot\n shap.initjs()\n return shap.force_plot(\n base_value=explainer.expected_value, \n shap_values=shap_values, \n features=df\n )\n\npredict(3, 1.5, -73.9425, 40.7145)",
"_____no_output_____"
],
[
"# What if it was a 2 bedroom?\npredict(2, 1.5, -73.9425, 40.7145)",
"_____no_output_____"
],
[
"# What if it was a 1 bedroom?\npredict(1, 1.5, -73.9425, 40.7145)",
"_____no_output_____"
]
],
[
[
"### BONUS: Classification example\n\nJust for your future reference, here's a bonus example for a classification problem. This uses Lending Club data, historical and current. The goal: Predict if peer-to-peer loans are charged off or fully paid. Decide which loans to invest in.",
"_____no_output_____"
]
],
[
[
"import pandas as pd\n\n# Stratified sample, 10% of expired Lending Club loans, grades A-D\n# Source: https://www.lendingclub.com/info/download-data.action\nhistory = pd.read_csv(DATA_PATH+'lending-club/lending-club-subset.csv')\nhistory['issue_d'] = pd.to_datetime(history['issue_d'], infer_datetime_format=True)\n\n# Current loans available for manual investing, June 17, 2019\n# Source: https://www.lendingclub.com/browse/browse.action\ncurrent = pd.read_csv(DATA_PATH+'../data/lending-club/primaryMarketNotes_browseNotes_1-RETAIL.csv')",
"_____no_output_____"
],
[
"# Transform earliest_cr_line to an integer:\n# How many days the earliest credit line was open, before the loan was issued.\n# For current loans available for manual investing, assume the loan will be issued today.\nhistory['earliest_cr_line'] = pd.to_datetime(history['earliest_cr_line'], infer_datetime_format=True)\nhistory['earliest_cr_line'] = history['issue_d'] - history['earliest_cr_line']\nhistory['earliest_cr_line'] = history['earliest_cr_line'].dt.days\n\ncurrent['earliest_cr_line'] = pd.to_datetime(current['earliest_cr_line'], infer_datetime_format=True)\ncurrent['earliest_cr_line'] = pd.Timestamp.today() - current['earliest_cr_line']\ncurrent['earliest_cr_line'] = current['earliest_cr_line'].dt.days\n\n# Transform earliest_cr_line for the secondary applicant\nhistory['sec_app_earliest_cr_line'] = pd.to_datetime(history['sec_app_earliest_cr_line'], infer_datetime_format=True, errors='coerce')\nhistory['sec_app_earliest_cr_line'] = history['issue_d'] - history['sec_app_earliest_cr_line']\nhistory['sec_app_earliest_cr_line'] = history['sec_app_earliest_cr_line'].dt.days\n\ncurrent['sec_app_earliest_cr_line'] = pd.to_datetime(current['sec_app_earliest_cr_line'], infer_datetime_format=True, errors='coerce')\ncurrent['sec_app_earliest_cr_line'] = pd.Timestamp.today() - current['sec_app_earliest_cr_line']\ncurrent['sec_app_earliest_cr_line'] = current['sec_app_earliest_cr_line'].dt.days\n\n# Engineer features for issue date year & month\nhistory['issue_d_year'] = history['issue_d'].dt.year\nhistory['issue_d_month'] = history['issue_d'].dt.month\n\ncurrent['issue_d_year'] = pd.Timestamp.today().year\ncurrent['issue_d_month'] = pd.Timestamp.today().month",
"_____no_output_____"
],
[
"# Calculate percent of each loan repaid\nhistory['percent_paid'] = history['total_pymnt'] / history['funded_amnt']",
"_____no_output_____"
],
[
"# Train on the historical data.\n# For the target, use `loan_status` ('Fully Paid' or 'Charged Off')\ntarget = 'loan_status'\nX = history.drop(columns=target)\ny = history[target]",
"_____no_output_____"
],
[
"# Do train/validate/test 3-way split\nfrom sklearn.model_selection import train_test_split\n\nX_trainval, X_test, y_trainval, y_test = train_test_split(\n X, y, test_size=20000, stratify=y, random_state=42)\n\nX_train, X_val, y_train, y_val = train_test_split(\n X_trainval, y_trainval, test_size=20000, \n stratify=y_trainval, random_state=42)\n\nprint('X_train shape', X_train.shape)\nprint('y_train shape', y_train.shape)\nprint('X_val shape', X_val.shape)\nprint('y_val shape', y_val.shape)\nprint('X_test shape', X_test.shape)\nprint('y_test shape', y_test.shape)",
"_____no_output_____"
],
[
"# Save the ids for later, so we can look up actual results,\n# to compare with predicted results\ntrain_id = X_train['id']\nval_id = X_val['id']\ntest_id = X_test['id']",
"_____no_output_____"
],
[
"# Use Python sets to compare the historical columns & current columns\ncommon_columns = set(history.columns) & set(current.columns)\njust_history = set(history.columns) - set(current.columns)\njust_current = set(current.columns) - set(history.columns)",
"_____no_output_____"
],
[
"# For features, use only the common columns shared by the historical & current data.\nfeatures = list(common_columns)\nX_train = X_train[features]\nX_val = X_val[features]\nX_test = X_test[features]",
"_____no_output_____"
],
[
"def wrangle(X):\n X = X.copy()\n\n # Engineer new feature for every feature: is the feature null?\n for col in X:\n X[col+'_NULL'] = X[col].isnull()\n \n # Convert percentages from strings to floats\n X['int_rate'] = X['int_rate'].str.strip('%').astype(float)\n X['revol_util'] = X['revol_util'].str.strip('%').astype(float)\n \n # Convert employment length from string to float\n X['emp_length'] = X['emp_length'].str.replace(r'\\D','').astype(float)\n \n # Create features for three employee titles: teacher, manager, owner\n X['emp_title'] = X['emp_title'].str.lower()\n X['emp_title_teacher'] = X['emp_title'].str.contains('teacher', na=False)\n X['emp_title_manager'] = X['emp_title'].str.contains('manager', na=False)\n X['emp_title_owner'] = X['emp_title'].str.contains('owner', na=False)\n\n # Get length of free text fields\n X['title'] = X['title'].str.len()\n X['desc'] = X['desc'].str.len()\n X['emp_title'] = X['emp_title'].str.len()\n \n # Convert sub_grade from string \"A1\"-\"D5\" to numbers\n sub_grade_ranks = {'A1': 1.1, 'A2': 1.2, 'A3': 1.3, 'A4': 1.4, 'A5': 1.5, \n 'B1': 2.1, 'B2': 2.2, 'B3': 2.3, 'B4': 2.4, 'B5': 2.5, \n 'C1': 3.1, 'C2': 3.2, 'C3': 3.3, 'C4': 3.4, 'C5': 3.5, \n 'D1': 4.1, 'D2': 4.2, 'D3': 4.3, 'D4': 4.4, 'D5': 4.5}\n X['sub_grade'] = X['sub_grade'].map(sub_grade_ranks)\n \n # Drop some columns\n X = X.drop(columns='id') # Always unique\n X = X.drop(columns='url') # Always unique\n X = X.drop(columns='member_id') # Always null\n X = X.drop(columns='grade') # Duplicative of sub_grade\n X = X.drop(columns='zip_code') # High cardinality\n \n # Only use these features which had nonzero permutation importances in earlier models \n features = ['acc_open_past_24mths', 'addr_state', 'all_util', 'annual_inc', \n 'annual_inc_joint', 'avg_cur_bal', 'bc_open_to_buy', 'bc_util', \n 'collections_12_mths_ex_med', 'delinq_amnt', 'desc_NULL', 'dti', \n 'dti_joint', 'earliest_cr_line', 'emp_length', 'emp_length_NULL', \n 'emp_title', 'emp_title_NULL', 'emp_title_owner', 'fico_range_high', \n 'funded_amnt', 'home_ownership', 'inq_last_12m', 'inq_last_6mths', \n 'installment', 'int_rate', 'issue_d_month', 'issue_d_year', 'loan_amnt', \n 'max_bal_bc', 'mo_sin_old_il_acct', 'mo_sin_old_rev_tl_op', \n 'mo_sin_rcnt_rev_tl_op', 'mort_acc', 'mths_since_last_major_derog_NULL', \n 'mths_since_last_record', 'mths_since_recent_bc', 'mths_since_recent_inq', \n 'num_actv_bc_tl', 'num_actv_rev_tl', 'num_op_rev_tl', 'num_rev_tl_bal_gt_0', \n 'num_tl_120dpd_2m_NULL', 'open_rv_12m_NULL', 'open_rv_24m', \n 'pct_tl_nvr_dlq', 'percent_bc_gt_75', 'pub_rec_bankruptcies', 'purpose', \n 'revol_bal', 'revol_bal_joint', 'sec_app_earliest_cr_line', \n 'sec_app_fico_range_high', 'sec_app_open_acc', 'sec_app_open_act_il', \n 'sub_grade', 'term', 'title', 'title_NULL', 'tot_coll_amt', \n 'tot_hi_cred_lim', 'total_acc', 'total_bal_il', 'total_bc_limit', \n 'total_cu_tl', 'total_rev_hi_lim'] \n X = X[features]\n \n # Reset index\n X = X.reset_index(drop=True)\n \n # Return the wrangled dataframe\n return X\n\n\nX_train = wrangle(X_train)\nX_val = wrangle(X_val)\nX_test = wrangle(X_test)\n\nprint('X_train shape', X_train.shape)\nprint('X_val shape', X_val.shape)\nprint('X_test shape', X_test.shape)",
"_____no_output_____"
],
[
"import category_encoders as ce\nfrom sklearn.impute import SimpleImputer\nfrom sklearn.pipeline import make_pipeline\nfrom xgboost import XGBClassifier\n\nprocessor = make_pipeline(\n ce.OrdinalEncoder(), \n SimpleImputer(strategy='median')\n)\n\nX_train_processed = processor.fit_transform(X_train)\nX_val_processed = processor.transform(X_val)\n\neval_set = [(X_train_processed, y_train), \n (X_val_processed, y_val)]\n\nmodel = XGBClassifier(n_estimators=1000, n_jobs=-1)\nmodel.fit(X_train_processed, y_train, eval_set=eval_set, eval_metric='auc', \n early_stopping_rounds=10)",
"_____no_output_____"
],
[
"# THIS CELL ISN'T ABOUT THE NEW OBJECTIVES FOR TODAY\n# BUT IT IS IMPORTANT FOR YOUR SPRINT CHALLENGE\n\nfrom sklearn.metrics import roc_auc_score\nX_test_processed = processor.transform(X_test)\nclass_index = 1\ny_pred_proba = model.predict_proba(X_test_processed)[:, class_index]\nprint(f'Test ROC AUC for class {class_index}:')\nprint(roc_auc_score(y_test, y_pred_proba)) # Ranges from 0-1, higher is better",
"_____no_output_____"
]
],
[
[
"#### Look at predictions vs actuals\n",
"_____no_output_____"
]
],
[
[
"df = pd.DataFrame({\n 'id': test_id, \n 'pred_proba': y_pred_proba, \n 'status_group': y_test\n})\n\ndf = df.merge(\n history[['id', 'issue_d', 'sub_grade', 'percent_paid', 'term', 'int_rate']], \n how='left'\n)",
"_____no_output_____"
],
[
"df.head()",
"_____no_output_____"
],
[
"fully_paid = df['status_group'] == 'Fully Paid'\ncharged_off = ~fully_paid\nright = (fully_paid) == (df['pred_proba'] > 0.50)\nwrong = ~right",
"_____no_output_____"
]
],
[
[
"#### Loan was fully paid, model's prediction was right\n",
"_____no_output_____"
]
],
[
[
"df[fully_paid & right].sample(n=10, random_state=1).sort_values(by='pred_proba')",
"_____no_output_____"
],
[
"# To explain the prediction for test observation with index #3094, \n# first, get all of the features for that observation\nrow = X_test.iloc[[3094]]\nrow",
"_____no_output_____"
]
],
[
[
"#### Explain individual predictions with shapley value plots",
"_____no_output_____"
]
],
[
[
"# STUDY/PRACTICE THIS CELL FOR THE SPRINT CHALLENGE\nimport shap\n\nexplainer = shap.TreeExplainer(model)\nrow_processed = processor.transform(row)\nshap_values = explainer.shap_values(row_processed)\n\nshap.initjs()\nshap.force_plot(\n base_value=explainer.expected_value, \n shap_values=shap_values, \n features=row, \n link='logit' # For classification, this shows predicted probabilities\n)",
"_____no_output_____"
]
],
[
[
"#### Make a function to explain predictions\n\nGoal Output:\n\n```\nThe model predicts this loan is Fully Paid, with 74% probability.\n \n \nTop 3 reasons for prediction:\n1. dti is 10.97.\n2. term is 36 months.\n3. total_acc is 45.0.\n \n \nTop counter-argument against prediction:\n- sub_grade is 4.2.\n \n<INSERT SHAPLEY VALUE FORCE PLOT HERE>\n```",
"_____no_output_____"
]
],
[
[
"feature_names = row.columns\nfeature_values = row.values[0]\nshaps = pd.Series(shap_values[0], zip(feature_names, feature_values))",
"_____no_output_____"
],
[
"pros = shaps.sort_values(ascending=False)[:3].index\ncons = shaps.sort_values(ascending=True)[:3].index",
"_____no_output_____"
],
[
"print('Top 3 reasons for fully paid:')\nfor i, pro in enumerate(pros, start=1):\n feature_name, feature_value = pro\n print(f'{i}. {feature_name} is {feature_value}.')\n\nprint('\\n')\nprint('Cons:')\nfor i, con in enumerate(cons, start=1):\n feature_name, feature_value = con\n print(f'{i}. {feature_name} is {feature_value}.')",
"_____no_output_____"
],
[
"def explain(row_number):\n positive_class = 'Fully Paid'\n positive_class_index = 1\n\n # Get & process the data for the row\n row = X_test.iloc[[row_number]]\n row_processed = processor.transform(row)\n\n # Make predictions (includes predicted probability)\n pred = model.predict(row_processed)[0]\n pred_proba = model.predict_proba(row_processed)[0, positive_class_index]\n pred_proba *= 100\n if pred != positive_class:\n pred_proba = 100 - pred_proba\n\n # Show prediction & probability\n print(f'The model predicts this loan is {pred}, with {pred_proba:.0f}% probability.')\n \n # Get shapley additive explanations\n shap_values = explainer.shap_values(row_processed)\n\n # Get top 3 \"pros & cons\" for fully paid\n feature_names = row.columns\n feature_values = row.values[0]\n shaps = pd.Series(shap_values[0], zip(feature_names, feature_values))\n pros = shaps.sort_values(ascending=False)[:3].index\n cons = shaps.sort_values(ascending=True)[:3].index\n\n # Show top 3 reason for prediction\n print('\\n')\n print('Top 3 reasons for prediction:')\n evidence = pros if pred == positive_class else cons\n for i, info in enumerate(evidence, start=1):\n feature_name, feature_value = info\n print(f'{i}. {feature_name} is {feature_value}.')\n\n # Show top 1 counter-argument against prediction\n print('\\n')\n print('Top counter-argument against prediction:')\n evidence = cons if pred == positive_class else pros\n feature_name, feature_value = evidence[0]\n print(f'- {feature_name} is {feature_value}.')\n\n # Show Shapley Values Force Plot\n shap.initjs()\n return shap.force_plot(\n base_value=explainer.expected_value, \n shap_values=shap_values, \n features=row, \n link='logit' # For classification, this shows predicted probabilities\n )\n\nexplain(3094)",
"_____no_output_____"
]
],
[
[
"#### Look at more examples\n\nYou can choose an example from each quadrant of the confusion matrix, and get an explanation for the model's prediction.",
"_____no_output_____"
],
[
"#### Loan was charged off, model's prediction was right\n",
"_____no_output_____"
]
],
[
[
"df[charged_off & right].sample(n=10, random_state=1).sort_values(by='pred_proba')",
"_____no_output_____"
],
[
"explain(8383)",
"_____no_output_____"
]
],
[
[
"#### Loan was fully paid, model's prediction was wrong\n",
"_____no_output_____"
]
],
[
[
"df[fully_paid & wrong].sample(n=10, random_state=1).sort_values(by='pred_proba')",
"_____no_output_____"
],
[
"explain(18061)",
"_____no_output_____"
],
[
"explain(6763)",
"_____no_output_____"
]
],
[
[
"#### Loan was charged off, model's prediction was wrong\n",
"_____no_output_____"
]
],
[
[
"df[charged_off & wrong].sample(n=10, random_state=1).sort_values(by='pred_proba')",
"_____no_output_____"
],
[
"explain(19883)",
"_____no_output_____"
]
],
[
[
"## References\n\n#### Partial Dependence Plots\n- [Kaggle / Dan Becker: Machine Learning Explainability — Partial Dependence Plots](https://www.kaggle.com/dansbecker/partial-plots)\n- [Christoph Molnar: Interpretable Machine Learning — Partial Dependence Plots](https://christophm.github.io/interpretable-ml-book/pdp.html) + [animated explanation](https://twitter.com/ChristophMolnar/status/1066398522608635904)\n- [pdpbox repo](https://github.com/SauceCat/PDPbox) & [docs](https://pdpbox.readthedocs.io/en/latest/)\n\n#### Shapley Values\n- [Kaggle / Dan Becker: Machine Learning Explainability — SHAP Values](https://www.kaggle.com/learn/machine-learning-explainability)\n- [Christoph Molnar: Interpretable Machine Learning — Shapley Values](https://christophm.github.io/interpretable-ml-book/shapley.html)\n- [SHAP repo](https://github.com/slundberg/shap) & [docs](https://shap.readthedocs.io/en/latest/)",
"_____no_output_____"
],
[
"## Recap\n\nYou learned about three types of model explanations during the past 1.5 lessons:\n\n#### 1. Global model explanation: all features in relation to each other\n- Feature Importances: _Default, fastest, good for first estimates_\n- Drop-Column Importances: _The best in theory, but much too slow in practice_\n- Permutaton Importances: _A good compromise!_\n\n#### 2. Global model explanation: individual feature(s) in relation to target\n- Partial Dependence plots\n\n#### 3. Individual prediction explanation\n- Shapley Values\n\n_Note that the coefficients from a linear model give you all three types of explanations!_",
"_____no_output_____"
],
[
"## Challenge\n\nComplete these tasks for your project, and document your work.\n\n- Continue to iterate on your project: data cleaning, exploratory visualization, feature engineering, modeling.\n- Make at least 1 partial dependence plot to explain your model.\n- Make at least 1 Shapley force plot to explain an individual prediction.\n- **Share at least 1 visualization (of any type) on Slack!**\n\nIf you aren't ready to make these plots with your own dataset, you can practice these objectives with any dataset you've worked with previously. Example solutions are available for Partial Dependence Plots with the Tanzania Waterpumps dataset, and Shapley force plots with the Titanic dataset. (These datasets are available in the data directory of this repository.)\n\nPlease be aware that **multi-class classification** will result in multiple Partial Dependence Plots (one for each class), and multiple sets of Shapley Values (one for each class).",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
]
]
|
cb6b44aeacb5816b86a9f27ab252f080cb0c3154 | 3,762 | ipynb | Jupyter Notebook | content/lessons/07/Now-You-Code/NYC0-Link-Extraction-From-Webpage.ipynb | MahopacHS/spring-2020-oubinam0717 | 5b35579e658e34cbb07c3477a9fce13ce01830af | [
"MIT"
]
| 1 | 2020-01-17T13:22:31.000Z | 2020-01-17T13:22:31.000Z | content/lessons/07/Now-You-Code/NYC0-Link-Extraction-From-Webpage.ipynb | MahopacHS/spring-2020-oubinam0717 | 5b35579e658e34cbb07c3477a9fce13ce01830af | [
"MIT"
]
| null | null | null | content/lessons/07/Now-You-Code/NYC0-Link-Extraction-From-Webpage.ipynb | MahopacHS/spring-2020-oubinam0717 | 5b35579e658e34cbb07c3477a9fce13ce01830af | [
"MIT"
]
| null | null | null | 35.158879 | 303 | 0.620415 | [
[
[
"# Now You Code 0: Extracting Hyperlinks from a Webpage\n\nLet's write a program which extracts the hyperlinks from a Webpage. There are 3 webpage files you can try with this program:\n\n```\nfile = 'NYC0-httpbin-org.html'\nfile = 'NYC0-ischool-website.html'\nfile = 'NYC0-wikipedia-President-of-the-United-States.html'\n```\nHere's the basic strategy: you should be looking for the following token in the text of the file `<a href=\"` when you find this token the link is all characters until the second `\"` character. \n\nFor example: `<a href=\"http://ist256.github.io\">` the Hyperlink would be: `http://ist256.github.io`.\n\n## Recommended approach (the problem simplification technique):\n\nWe will use the problem simplification technique to solve this problem. It works by solving a simpler problem then taking what you've learned to solve a more complicated problem.\n\n1. Try to extract `http://ist256.github.io` from the string `<a href=\"http://ist256.github.io\">` in Python code\n2. Then read in the `file = 'NYC0-httpbin-org.html'` text file into a variable, and use the same code in step 1. to extract the first Hyperlink in the text. For `file = 'NYC0-httpbin-org.html'` It will be `https://github.com/requests/httpbin`\n3. Finally try to figure out how to use a loop to extract all the urls in the string text you read from the file. For `file = 'NYC0-httpbin-org.html'` you should get these Hyperlinks: `https://github.com/requests/httpbin`, `https://kennethreitz.org`, `mailto:[email protected]`, `/forms/post`\n\nA little HTML primer - there are 4 types of hyperlinks you will see:\n\n- those which begin with `http` are external links to other pages off site.\n- those which begin with `mailto` are links to email addresses\n- those which begin with a `/` are internal links other pages on the same website\n- those which begin with a `#` are internal links to places on the same page\n\nAnything else is not a link and you're probably extracting incorrectly.",
"_____no_output_____"
],
[
"## Step 1: Problem Analysis\n\nYou should write 3 algorithms, one for each iteration of your problem simplification technique\n\nInputs:\n\nOutputs:\n\nAlgorithm (Steps in Program):\n\n\n",
"_____no_output_____"
]
],
[
[
"## Step 2: write code here\n\nfile = 'NYC0-httpbin-org.html'\n#file = 'NYC0-ischool-website.html'\n#file = 'NYC0-wikipedia-President-of-the-United-States.html'\n",
"_____no_output_____"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code"
]
]
|
cb6b484968af2de968f003d5322450b2a64f2b11 | 816,017 | ipynb | Jupyter Notebook | notebooks/RF-performance.ipynb | pawel21/cta-lstchain | b7fc7c9aaeb952b85982981699b85701c37eb5e5 | [
"BSD-3-Clause"
]
| null | null | null | notebooks/RF-performance.ipynb | pawel21/cta-lstchain | b7fc7c9aaeb952b85982981699b85701c37eb5e5 | [
"BSD-3-Clause"
]
| null | null | null | notebooks/RF-performance.ipynb | pawel21/cta-lstchain | b7fc7c9aaeb952b85982981699b85701c37eb5e5 | [
"BSD-3-Clause"
]
| null | null | null | 321.773265 | 121,752 | 0.898625 | [
[
[
"<div align=\"center\">\n<font size=\"5\">__cta-lstchain: Notebook for training and storage Random Forests for LST1 data analysis__</font>\n \n<font size=\"4\">\nTo run this notebook you will need the last version of cta-lstchain:\n\ngit clone https://github.com/cta-observatory/cta-lstchain\n<br>\n<br>\n**If you have ctapipe already installed in a conda environment:**\n<br><br>\nsource activate cta-dev\n<br>\npython setup.py install\n<br>\n<font size=\"4\">\n**If you don't have ctapipe installed:**</font>\n<br><br>\nconda env create -f environment.yml\n<br>\nsource activate cta-dev\n<br>\npython setup.py install\n\nAlso, you will need the datafiles from **cta-lstchain-extra:**\n\ngit clone https://github.com/misabelber/cta-lstchain-extra\n\n\n",
"_____no_output_____"
],
[
"<font size=\"4\">\n**Some imports...**",
"_____no_output_____"
]
],
[
[
"import numpy as np \nimport pandas as pd \nimport matplotlib.pyplot as plt \nfrom sklearn.externals import joblib \nfrom lstchain.reco import reco_dl1_to_dl2 \nfrom lstchain.visualization import plot_dl2 \nfrom lstchain.reco import utils\n%matplotlib inline\nplt.rcParams['figure.figsize'] = (20, 15)\nplt.rcParams['font.size'] = 14",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\n**Get event DL1 files for training.**\n<br>\nWe need two files, for **gammas** and for **protons**. These gammas are pointlike.",
"_____no_output_____"
]
],
[
[
"try:\n PATH_EVENTS = \"/home/queenmab/DATA/LST1/Events\"\n gammafile = PATH_EVENTS+\"/gamma_events_point.h5\"\n protonfile = PATH_EVENTS+\"/proton_events.h5\"\n\nexcept:\n PATH_EVENTS = \"../../cta-lstchain-extra/reco/sample_data/dl1/\"\n gammafile = PATH_EVENTS+\"gamma_events_point_tiny.h5\"\n protonfile = PATH_EVENTS+\"proton_events_tiny.h5\"",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\nWe read the files as pandas dataframes:",
"_____no_output_____"
]
],
[
[
"df_gammas = pd.read_hdf(gammafile) \ndf_proton = pd.read_hdf(protonfile)\ndf_gammas.keys()",
"_____no_output_____"
],
[
"df_gammas",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\nFrom all the previous information, we choose certain features to train the Random Forests:",
"_____no_output_____"
]
],
[
[
"features = ['intensity', \n 'time_gradient', \n 'width', \n 'length', \n 'wl', \n 'phi', \n 'psi']",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\nNow we must split the data into train and test sets. \nGamma events will train energy and direction reconstruction, and gamma/hadron separation, but protons are only used for separation.",
"_____no_output_____"
]
],
[
[
"train,test = reco_dl1_to_dl2.split_traintest(df_gammas,0.5)\ntest = test.append(df_proton,ignore_index=True) #Protons are only for testing when trainin Energy/Direction reco.",
"/home/queenmab/anaconda3/envs/cta-dev/lib/python3.6/site-packages/pandas/core/frame.py:6211: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version\nof pandas will change to not sort by default.\n\nTo accept the future behavior, pass 'sort=False'.\n\nTo retain the current behavior and silence the warning, pass 'sort=True'.\n\n sort=sort)\n"
]
],
[
[
"<font size=\"4\">\n**Train the Reconstruction:**\n<br>\nWe train two Random Forest Regressors, from scikit-learn, to reconstruct energy and \"disp\" of the **test** set.",
"_____no_output_____"
]
],
[
[
"RFreg_Energy, RFreg_Disp = reco_dl1_to_dl2.trainRFreco(train,features)",
"Given features: ['intensity', 'time_gradient', 'width', 'length', 'wl', 'phi', 'psi']\nNumber of events for training: 266413\nTraining Random Forest Regressor for Energy Reconstruction...\nRandom Forest trained!\nTraining Random Forest Regressor for disp Reconstruction...\nRandom Forest trained!\nDone!\n"
]
],
[
[
"<font size=\"4\">\nWe can now predict the **energy** and **disp** of the test events, and from **disp**, calculate the reconstructed direction.",
"_____no_output_____"
]
],
[
[
"#Predict energy and direction for the test set:\ntest['e_rec'] = RFreg_Energy.predict(test[features]) \ntest['disp_rec'] = RFreg_Disp.predict(test[features]) \n \ntest['src_x_rec'],test['src_y_rec'] = utils.disp_to_pos(test['disp_rec'], \n test['x'], \n test['y'], \n test['psi'])\ntest.keys()",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\nWe use this test events with reconstructed energy and direction to **train the gamma/hadron separation.**\n<br>\nWe add these two features to the list of features for training:",
"_____no_output_____"
]
],
[
[
"features_sep = list(features) \nfeatures_sep.append('e_rec') \nfeatures_sep.append('disp_rec')",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\nWe split again the set into **train** and **test**.",
"_____no_output_____"
]
],
[
[
"train,test = reco_dl1_to_dl2.split_traintest(test,0.75)",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\n**Train the gamma/hadron classifier:**\n<br>\nNow we train a scikit-learn **RandomForestClassifier** which will separate events in two classes: 0 for **gammas** and 1 for **protons**. We call this parameter **hadroness**.",
"_____no_output_____"
]
],
[
[
"#Now we can train the Random Forest Classifier\nRFcls_GH = reco_dl1_to_dl2.trainRFsep(train,features_sep)",
"Given features: ['intensity', 'time_gradient', 'width', 'length', 'wl', 'phi', 'psi', 'e_rec', 'disp_rec']\nNumber of events for training: 365202\nTraining Random Forest Classifier for Gamma/Hadron separation...\nRandom Forest trained!\nDone!\n"
]
],
[
[
"<font size=\"4\">\nPredict the hadroness of the test events:",
"_____no_output_____"
]
],
[
[
"test['hadro_rec'] = RFcls_GH.predict(test[features_sep])",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\n**Save the Random Forests:**\n<br>\nWe can save these trained RF into files to apply them later on any set of data:",
"_____no_output_____"
]
],
[
[
"fileE = \"RFreg_Energy.sav\" \nfileD = \"RFreg_Disp.sav\" \nfileH = \"RFcls_GH.sav\" \njoblib.dump(RFreg_Energy, fileE) \njoblib.dump(RFreg_Disp, fileD) \njoblib.dump(RFcls_GH, fileH)",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\n**Now we can plot some results...**\n<br><br>\n**Distribution of features**",
"_____no_output_____"
]
],
[
[
"plot_dl2.plot_features(test)",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\n**Energy reconstruction**",
"_____no_output_____"
]
],
[
[
"plot_dl2.plot_e(test)",
"0.03707218517239982 0.6655900815918775\n"
]
],
[
[
"<font size=\"4\">\n **Disp reconstruction**",
"_____no_output_____"
]
],
[
[
"plot_dl2.plot_disp(test)",
"0.06304875206486528 0.23996262045022812\n"
]
],
[
[
"<font size=\"4\">\n**Source position in camera coordinates**",
"_____no_output_____"
]
],
[
[
"plot_dl2.plot_pos(test)",
"_____no_output_____"
]
],
[
[
"<font size=\"4\">\n**Importance of features for Gamma/Hadron separation**",
"_____no_output_____"
]
],
[
[
"plot_dl2.plot_importances(RFcls_GH,features_sep)",
"Feature importances (gini index)\n1. width (0.218487)\n2. length (0.149491)\n3. disp_rec (0.138147)\n4. intensity (0.107225)\n5. time_gradient (0.085866)\n6. e_rec (0.084655)\n7. wl (0.077336)\n8. phi (0.076596)\n9. psi (0.062197)\n"
]
],
[
[
"<font size=\"4\">\n**ROC curve**",
"_____no_output_____"
]
],
[
[
"plot_dl2.plot_ROC(RFcls_GH,test,features_sep,-1)",
"0.716945659937442\n"
]
],
[
[
"<font size=\"4\">\nMono analysis is very limited, specially at low energies, where it's much more difficult to separate gammas from hadrons without stereo information. If we discard low energy events, we can see that the performance improves.\n<br>\n<br>\n **For example, we can cut at 500 GeV:**",
"_____no_output_____"
]
],
[
[
"cut = 500.\n\ne_cut = np.log10(cut) \ntest_cut = test[test['e_rec']>e_cut]",
"_____no_output_____"
],
[
"plot_dl2.plot_e(test_cut)",
"0.050117434679284804 0.543312237662998\n"
],
[
"plot_dl2.plot_disp(test_cut)",
"0.013187109659541535 0.14300086957095326\n"
],
[
"plot_dl2.plot_pos(test_cut)",
"_____no_output_____"
],
[
"plot_dl2.plot_ROC(RFcls_GH,test_cut,features_sep,e_cut)",
"0.9364823609226595\n"
]
],
[
[
"<font size=\"4\">\n- The reconstruction is still in a very early stage, with close to none optimization of the Random Forests and a rather bad performance. \n- Also, the statistics are very low, we must retrieve more events for training the RF's.\n- We've been focusing on having a code that works and can be easily used by anyone.\n- **Now it's time to look forward having competitive mono reconstruction!**\n",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
]
]
|
cb6b4960c0564ee22b015149ac4261cac9ce966a | 84,044 | ipynb | Jupyter Notebook | 04 - KNN & Scikit-learn/.ipynb_checkpoints/Part 1 - K Nearest Neighbor-checkpoint.ipynb | iwanevandersyema/supervised_learning | c3b38024525139a6b36eda4763962d059bd6dc6b | [
"MIT"
]
| null | null | null | 04 - KNN & Scikit-learn/.ipynb_checkpoints/Part 1 - K Nearest Neighbor-checkpoint.ipynb | iwanevandersyema/supervised_learning | c3b38024525139a6b36eda4763962d059bd6dc6b | [
"MIT"
]
| null | null | null | 04 - KNN & Scikit-learn/.ipynb_checkpoints/Part 1 - K Nearest Neighbor-checkpoint.ipynb | iwanevandersyema/supervised_learning | c3b38024525139a6b36eda4763962d059bd6dc6b | [
"MIT"
]
| null | null | null | 857.591837 | 82,184 | 0.953798 | [
[
[
"from luwiji.knn import illustration, demo",
"_____no_output_____"
],
[
"demo.knn()",
"_____no_output_____"
],
[
"illustration.knn_distance",
"_____no_output_____"
]
],
[
[
"### Other Distance Metric",
"_____no_output_____"
],
[
"https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.DistanceMetric.html",
"_____no_output_____"
]
]
]
| [
"code",
"markdown"
]
| [
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
]
]
|
cb6b5e53b67c50211f07656f5938f0f82d6089b4 | 821,781 | ipynb | Jupyter Notebook | Modeling.ipynb | DCavanaugh98/WildfireMLProject | e7e3dc052b1fcbf38e8c3206286c0d684882e36e | [
"MIT"
]
| null | null | null | Modeling.ipynb | DCavanaugh98/WildfireMLProject | e7e3dc052b1fcbf38e8c3206286c0d684882e36e | [
"MIT"
]
| null | null | null | Modeling.ipynb | DCavanaugh98/WildfireMLProject | e7e3dc052b1fcbf38e8c3206286c0d684882e36e | [
"MIT"
]
| null | null | null | 478.057592 | 111,680 | 0.79428 | [
[
[
"# Napa County Model\n\nBuild the model for Napa County California. The goal of the model will be to predict the total burn area of wildfires in Napa County for a given month",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport statsmodels.api as sm\n\nfrom catboost import Pool, CatBoostRegressor\nfrom sklearn.metrics import mean_squared_error, mean_absolute_percentage_error, median_absolute_error\nfrom sklearn.preprocessing import OneHotEncoder, StandardScaler\n\nfrom sklearn.linear_model import LinearRegression, Lasso",
"_____no_output_____"
],
[
"def evaluate(train_pred, train_actual, test_pred, test_actual):\n train_rmse = np.sqrt(mean_squared_error(train_pred, train_actual))\n train_mape = mean_absolute_percentage_error(train_pred, train_actual)\n train_mae = median_absolute_error(train_pred, train_actual)\n\n test_rmse = np.sqrt(mean_squared_error(test_pred, test_actual))\n test_mape = mean_absolute_percentage_error(test_pred, test_actual)\n test_mae = median_absolute_error(test_pred, test_actual)\n\n metric_df = pd.DataFrame({'Train': [train_rmse, train_mape, train_mae], \n 'Test': [test_rmse, test_mape, test_mae]},\n index=['Root Mean Squared Error', 'Mean Absolute Percent Error', 'Median Absolute Error'])\n \n return metric_df",
"_____no_output_____"
]
],
[
[
"Read in the data and prep Napa County",
"_____no_output_____"
]
],
[
[
"fire_data = pd.read_csv(\"./Data/clean_fire_data.csv\", parse_dates=[\"MONTH\"])\nfire_data['FIPS_CODE'] = fire_data['FIPS_CODE'].astype(str).str.zfill(5)\nfire_data['STATE_CODE'] = fire_data['FIPS_CODE'].str.slice(0, 2)\n\nweather_data = pd.read_csv(\"./Data/cleaned_weather_data.csv\", parse_dates=['MONTH'])\nweather_data['STATE_CODE'] = weather_data['STATE_CODE'].astype(str).str.zfill(2)\n\nmin_month = min(fire_data['MONTH'])\nmax_month = max(fire_data['MONTH'])\n\nindx = pd.date_range(start=min_month, end=max_month, freq='MS')\n\ncomplete_data = pd.DataFrame(np.dstack(np.meshgrid(np.unique(fire_data['FIPS_CODE']), indx)).reshape(-1, 2), \n columns=['FIPS_CODE', 'MONTH'])\n\ncomplete_data['MONTH'] = pd.to_datetime(complete_data['MONTH'])\n\nfips_data = fire_data.groupby(by='FIPS_CODE').agg({'COUNTY_AREA': min, 'STATE_CODE': min}).reset_index()\n\nfull_data = pd.merge(complete_data, fire_data[['FIPS_CODE', 'MONTH', 'TOTAL_BURN_AREA']], \n how='left', on=['FIPS_CODE', 'MONTH']).fillna(0)\n\nfull_data = pd.merge(full_data, fips_data, how='inner', on=['FIPS_CODE'])\n\nfinal_data = pd.merge(full_data, weather_data, how='inner', on=['MONTH', 'STATE_CODE'])\n\nfinal_data['MONTH_VALUE'] = final_data['MONTH'].dt.month\n\nfinal_data.sort_values(by=['FIPS_CODE', 'MONTH'], inplace=True)\n\ncols = [\"TOTAL_BURN_AREA\", \"PRCP\", \"TMIN\", \"TMAX\"]\nlags = [1, 2, 3, 4, 5, 6, 11, 12, 13, 23, 24, 25]\nfor c in cols:\n for l in lags:\n final_data[f\"{c}_lag{l}\"] = final_data.groupby('FIPS_CODE')[c].shift(l)\n\nfinal_data.dropna(inplace=True)",
"_____no_output_____"
]
],
[
[
"### Linear Model",
"_____no_output_____"
]
],
[
[
"y_column = ['TOTAL_BURN_AREA']\nx_columns = ['COUNTY_AREA', 'FIPS_CODE',\n 'PRCP', 'TMAX', 'TOTAL_BURN_AREA_lag1',\n 'TOTAL_BURN_AREA_lag12']\n\nmodel_data = final_data[y_column + x_columns]\n\nohe = OneHotEncoder(drop='first', sparse=False).fit(model_data[['FIPS_CODE']])\nmodel_data[ohe.get_feature_names_out()] = ohe.transform(model_data[['FIPS_CODE']])\nmodel_data[x_columns] = StandardScaler().fit_transform(model_data[x_columns])\n\ntrain_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[:-24])\ntest_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[-24:])\n\nX_Train, y_train = train_data.drop(['TOTAL_BURN_AREA'], axis=1), train_data['TOTAL_BURN_AREA']\nX_Test, y_test = test_data.drop(['TOTAL_BURN_AREA'], axis=1), test_data['TOTAL_BURN_AREA']",
"C:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\frame.py:3678: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame.\nTry using .loc[row_indexer,col_indexer] = value instead\n\nSee the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n self[col] = igetitem(value, i)\nC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\frame.py:3678: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n self[col] = igetitem(value, i)\n"
],
[
"model = LinearRegression().fit(X_Train, y_train)\n\ntrain_preds = model.predict(X_Train)\ntest_preds = model.predict(X_Test)\n\nevaluate(train_preds, y_train, test_preds, y_test)",
"_____no_output_____"
]
],
[
[
"### Lasso Regression",
"_____no_output_____"
],
[
"Use same train and test data as Linear Regression",
"_____no_output_____"
]
],
[
[
"model = Lasso(alpha=0.1).fit(X_Train, y_train)\n\ntrain_preds = model.predict(X_Train)\ntest_preds = model.predict(X_Test)\n\nevaluate(train_preds, y_train, test_preds, y_test)",
"_____no_output_____"
]
],
[
[
"Adjust the Lasso regularization parameter from 0.1 to 0.5",
"_____no_output_____"
]
],
[
[
"model = Lasso(alpha=0.5).fit(X_Train, y_train)\n\ntrain_preds = model.predict(X_Train)\ntest_preds = model.predict(X_Test)\n\nevaluate(train_preds, y_train, test_preds, y_test)",
"_____no_output_____"
],
[
"final_data.columns",
"_____no_output_____"
]
],
[
[
"### CatBoost Model - Regression Component Only\n\nWe want to see the raw performance of our input variables",
"_____no_output_____"
]
],
[
[
"y_column = ['TOTAL_BURN_AREA']\nx_columns = ['FIPS_CODE', 'COUNTY_AREA', 'STATE', 'PRCP', 'TMAX', 'TMIN', \n 'PRCP_lag1', 'PRCP_lag2', 'PRCP_lag3',\n 'PRCP_lag4', 'PRCP_lag5', 'PRCP_lag6', 'PRCP_lag11', 'PRCP_lag12',\n 'PRCP_lag13', 'PRCP_lag23', 'PRCP_lag24', 'PRCP_lag25', 'TMIN_lag1',\n 'TMIN_lag2', 'TMIN_lag3', 'TMIN_lag4', 'TMIN_lag5', 'TMIN_lag6',\n 'TMIN_lag11', 'TMIN_lag12', 'TMIN_lag13', 'TMIN_lag23', 'TMIN_lag24',\n 'TMIN_lag25', 'TMAX_lag1', 'TMAX_lag2', 'TMAX_lag3', 'TMAX_lag4',\n 'TMAX_lag5', 'TMAX_lag6', 'TMAX_lag11', 'TMAX_lag12', 'TMAX_lag13',\n 'TMAX_lag23', 'TMAX_lag24', 'TMAX_lag25']\n\nmodel_data = final_data[y_column + x_columns]\n\ntrain_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[:-24])\ntest_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[-24:])\n\nX_Train, y_train = train_data.drop(['TOTAL_BURN_AREA'], axis=1), train_data['TOTAL_BURN_AREA']\nX_Test, y_test = test_data.drop(['TOTAL_BURN_AREA'], axis=1), test_data['TOTAL_BURN_AREA']",
"_____no_output_____"
],
[
"# Leave all parameters - except has_time as defaults\n\ntrain_pool = Pool(X_Train, label=y_train, cat_features=['FIPS_CODE', 'STATE'])\n\nmodel = CatBoostRegressor(iterations=1000, verbose=0, has_time=True, random_seed=42, \n min_data_in_leaf=1, max_depth=6).fit(train_pool)\n\ntrain_preds = model.predict(X_Train)\ntest_preds = model.predict(X_Test)\n\nevaluate(train_preds, y_train, test_preds, y_test)",
"_____no_output_____"
],
[
"# Increase the number of iterations\ntrain_pool = Pool(X_Train, label=y_train, cat_features=['FIPS_CODE', 'STATE'])\n\nmodel = CatBoostRegressor(iterations=1500, verbose=0, has_time=True, random_seed=42, \n min_data_in_leaf=1, max_depth=6).fit(train_pool)\n\ntrain_preds = model.predict(X_Train)\ntest_preds = model.predict(X_Test)\n\nevaluate(train_preds, y_train, test_preds, y_test)",
"_____no_output_____"
]
],
[
[
"Reduce the number of input variables using feature importance. Take only feature which contribute 1% importance",
"_____no_output_____"
]
],
[
[
"pd.DataFrame(zip(X_Train.columns, model.feature_importances_), \n columns=['Column', 'Importance']).sort_values('Importance', ascending=False).tail(15)",
"_____no_output_____"
],
[
"y_column = ['TOTAL_BURN_AREA']\nx_columns = ['FIPS_CODE', 'COUNTY_AREA', 'STATE', 'PRCP', 'TMAX', 'TMIN', \n 'PRCP_lag1', 'PRCP_lag2',\n 'PRCP_lag4', 'PRCP_lag11', 'PRCP_lag12',\n 'PRCP_lag13', 'PRCP_lag23','PRCP_lag25',\n 'TMIN_lag3', 'TMIN_lag6',\n 'TMIN_lag12', 'TMIN_lag23', 'TMIN_lag24',\n 'TMAX_lag1',\n 'TMAX_lag5', 'TMAX_lag6', 'TMAX_lag11', 'TMAX_lag12',\n 'TMAX_lag23', 'TMAX_lag24', 'TMAX_lag25']\n\nmodel_data = final_data[y_column + x_columns]\n\ntrain_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[:-24])\ntest_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[-24:])\n\nX_Train, y_train = train_data.drop(['TOTAL_BURN_AREA'], axis=1), train_data['TOTAL_BURN_AREA']\nX_Test, y_test = test_data.drop(['TOTAL_BURN_AREA'], axis=1), test_data['TOTAL_BURN_AREA']",
"_____no_output_____"
],
[
"train_pool = Pool(X_Train, label=y_train, cat_features=['FIPS_CODE', 'STATE'])\n\nmodel = CatBoostRegressor(iterations=1500, verbose=0, has_time=True, random_seed=42, \n min_data_in_leaf=1, max_depth=6).fit(train_pool)\n\ntrain_preds = model.predict(X_Train)\ntest_preds = model.predict(X_Test)\n\nevaluate(train_preds, y_train, test_preds, y_test)",
"_____no_output_____"
],
[
"final_data.columns",
"_____no_output_____"
]
],
[
[
"### CatBoost Model - Include AR Terms\n\nUsing the regression terms from the past model we now add in the AR terms for total burn area",
"_____no_output_____"
]
],
[
[
"y_column = ['TOTAL_BURN_AREA']\nx_columns = ['TOTAL_BURN_AREA_lag1',\n 'TOTAL_BURN_AREA_lag2', 'TOTAL_BURN_AREA_lag3', 'TOTAL_BURN_AREA_lag4',\n 'TOTAL_BURN_AREA_lag5', 'TOTAL_BURN_AREA_lag6', 'TOTAL_BURN_AREA_lag11',\n 'TOTAL_BURN_AREA_lag12', 'TOTAL_BURN_AREA_lag13',\n 'TOTAL_BURN_AREA_lag23', 'TOTAL_BURN_AREA_lag24',\n 'TOTAL_BURN_AREA_lag25',\n 'FIPS_CODE', 'COUNTY_AREA', 'STATE', 'PRCP', 'TMAX', 'TMIN', \n 'PRCP_lag1', 'PRCP_lag2',\n 'PRCP_lag4', 'PRCP_lag11', 'PRCP_lag12',\n 'PRCP_lag13', 'PRCP_lag23','PRCP_lag25',\n 'TMIN_lag3', 'TMIN_lag6',\n 'TMIN_lag12', 'TMIN_lag23', 'TMIN_lag24',\n 'TMAX_lag1',\n 'TMAX_lag5', 'TMAX_lag6', 'TMAX_lag11', 'TMAX_lag12',\n 'TMAX_lag23', 'TMAX_lag24', 'TMAX_lag25']\n\nmodel_data = final_data[y_column + x_columns]\n\ntrain_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[:-24])\ntest_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[-24:])\n\nX_Train, y_train = train_data.drop(['TOTAL_BURN_AREA'], axis=1), train_data['TOTAL_BURN_AREA']\nX_Test, y_test = test_data.drop(['TOTAL_BURN_AREA'], axis=1), test_data['TOTAL_BURN_AREA']",
"_____no_output_____"
],
[
"train_pool = Pool(X_Train, label=y_train, cat_features=['FIPS_CODE', 'STATE'])\n\nmodel = CatBoostRegressor(iterations=1500, verbose=0, has_time=True, random_seed=42, \n min_data_in_leaf=10, max_depth=5).fit(train_pool)\n\ntrain_preds = model.predict(X_Train)\ntest_preds = model.predict(X_Test)\n\nevaluate(train_preds, y_train, test_preds, y_test)",
"_____no_output_____"
]
],
[
[
"Reduce the number of features using the feature importance, remove any inputs which have importance less than 1",
"_____no_output_____"
]
],
[
[
"pd.DataFrame(zip(X_Train.columns, model.feature_importances_), \n columns=['Column', 'Importance']).sort_values('Importance', ascending=False).tail(15)",
"_____no_output_____"
],
[
"y_column = ['TOTAL_BURN_AREA']\nx_columns = ['TOTAL_BURN_AREA_lag1',\n 'TOTAL_BURN_AREA_lag2', 'TOTAL_BURN_AREA_lag3',\n 'TOTAL_BURN_AREA_lag5', 'TOTAL_BURN_AREA_lag11',\n 'TOTAL_BURN_AREA_lag12', 'TOTAL_BURN_AREA_lag13',\n 'TOTAL_BURN_AREA_lag23', 'TOTAL_BURN_AREA_lag24',\n 'TOTAL_BURN_AREA_lag25',\n 'FIPS_CODE', 'COUNTY_AREA', 'PRCP', 'TMAX',\n 'PRCP_lag1',\n 'PRCP_lag4', 'PRCP_lag11', 'PRCP_lag12',\n 'PRCP_lag23',\n 'TMIN_lag3', 'TMIN_lag6',\n 'TMIN_lag12', 'TMIN_lag23', 'TMIN_lag24',\n 'TMAX_lag6', 'TMAX_lag11', 'TMAX_lag12',\n 'TMAX_lag23', 'TMAX_lag24', 'TMAX_lag25']\n\nmodel_data = final_data[y_column + x_columns]\n\ntrain_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[:-24])\ntest_data = model_data.groupby(by='FIPS_CODE').apply(lambda x: x[-24:])\n\nX_Train, y_train = train_data.drop(['TOTAL_BURN_AREA'], axis=1), train_data['TOTAL_BURN_AREA']\nX_Test, y_test = test_data.drop(['TOTAL_BURN_AREA'], axis=1), test_data['TOTAL_BURN_AREA']",
"_____no_output_____"
],
[
"train_pool = Pool(X_Train, label=y_train, cat_features=['FIPS_CODE'])\n\nmodel = CatBoostRegressor(iterations=1500, verbose=0, has_time=True, random_seed=42, \n min_data_in_leaf=10, max_depth=5).fit(train_pool)\n\ntrain_preds = model.predict(X_Train)\ntest_preds = model.predict(X_Test)\n\nevaluate(train_preds, y_train, test_preds, y_test)",
"_____no_output_____"
]
],
[
[
"Check feature importances again to makes sure all features have importance > 1",
"_____no_output_____"
]
],
[
[
"pd.DataFrame(zip(X_Train.columns, model.feature_importances_), \n columns=['Column', 'Importance']).sort_values('Importance', ascending=False).tail(15)",
"_____no_output_____"
]
],
[
[
"### Compute Shaply Explanantions for the Final Model",
"_____no_output_____"
]
],
[
[
"import shap\nshap.initjs()",
"_____no_output_____"
],
[
"samps = X_Train.sample(50000)\n\nexplainer = shap.TreeExplainer(model)\nshap_vals = explainer(samps)",
"_____no_output_____"
],
[
"fig = shap.summary_plot(shap_values=shap_vals, features=samps, max_display=40)",
"_____no_output_____"
],
[
"shap.plots.bar(shap_vals, max_display=31)",
"_____no_output_____"
],
[
"sample = final_data.iloc[np.where((final_data['FIPS_CODE'] == '06055') & \n (final_data['MONTH'] == '2015-07-01'))][model_columns].drop(['TOTAL_BURN_AREA'], axis=1)\nsample\n\nexp = explainer(sample)\n\nshap.plots.bar(exp[0], max_display=31)",
"_____no_output_____"
],
[
"fcst_train = X_Train.copy().reset_index(drop=True)\nfcst_test = X_Test.copy().reset_index(drop=True)\n\nfcst_train['Preds'] = np.clip(train_preds, a_min=0, a_max=None)\nfcst_test['Preds'] = np.clip(test_preds, a_min=0, a_max=None)\n\nnapa_train_preds = fcst_train[fcst_train['FIPS_CODE'] == '06055']['Preds']\nelko_train_preds = fcst_train[fcst_train['FIPS_CODE'] == '32007']['Preds']\nnapa_test_preds = fcst_test[fcst_test['FIPS_CODE'] == '06055']['Preds']\nelko_test_preds = fcst_test[fcst_test['FIPS_CODE'] == '32007']['Preds']",
"_____no_output_____"
],
[
"plt.plot(final_data.loc[final_data['FIPS_CODE'] == '06055']['MONTH'][:-24], napa_train_preds.values, color='blue', zorder=2, \n label='Train Prediction')\nplt.plot(final_data.loc[final_data['FIPS_CODE'] == '06055']['MONTH'][:-24], \n final_data.loc[final_data['FIPS_CODE'] == '06055']['TOTAL_BURN_AREA'][:-24], color='red', zorder=1, \n label='Train Actual')\n\nplt.plot(final_data.loc[final_data['FIPS_CODE'] == '06055']['MONTH'][-24:], napa_test_preds.values, color='green', zorder=2,\n label='Test Prediction', alpha=0.6)\nplt.plot(final_data.loc[final_data['FIPS_CODE'] == '06055']['MONTH'][-24:], \n final_data.loc[final_data['FIPS_CODE'] == '06055']['TOTAL_BURN_AREA'][-24:], color='purple', zorder=1,\n label='Test Actual')\nplt.grid()\nplt.title(\"Napa County Prediction vs. Actual\")\nplt.legend()\nplt.ylabel(\"Total Burn Area\")\nplt.xlabel('Month')\nplt.tight_layout()\nplt.ylim(0, 10000)\nplt.savefig(\"./img/NapaPredPlot.png\")\nplt.show()",
"_____no_output_____"
],
[
"plt.plot(final_data.loc[final_data['FIPS_CODE'] == '32007']['MONTH'][:-24], elko_train_preds.values, color='blue', zorder=2, \n label='Train Prediction', alpha=0.5)\nplt.plot(final_data.loc[final_data['FIPS_CODE'] == '32007']['MONTH'][:-24], \n final_data.loc[final_data['FIPS_CODE'] == '32007']['TOTAL_BURN_AREA'][:-24], color='red', zorder=1, \n label='Train Actual', alpha=1)\n\nplt.plot(final_data.loc[final_data['FIPS_CODE'] == '32007']['MONTH'][-24:], elko_test_preds.values, color='green', zorder=2,\n label='Test Prediction', alpha=0.6)\nplt.plot(final_data.loc[final_data['FIPS_CODE'] == '32007']['MONTH'][-24:], \n final_data.loc[final_data['FIPS_CODE'] == '32007']['TOTAL_BURN_AREA'][-24:], color='purple', zorder=1,\n label='Test Actual')\nplt.grid()\nplt.title(\"Elko County Prediction vs. Actual\")\nplt.legend()\nplt.ylabel(\"Total Burn Area\")\nplt.xlabel('Month')\nplt.tight_layout()\nplt.savefig(\"./img/ElkoPredPlot.png\")\n# plt.ylim(0, 150000)\nplt.show()",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6b6f28b24e99992acc668a772b99282fa79e24 | 4,635 | ipynb | Jupyter Notebook | 11_String_Formatting.ipynb | rajibmitra/PythonNotebooks | 8efca498056ea373ae3623be89656106de3322ac | [
"Apache-2.0"
]
| null | null | null | 11_String_Formatting.ipynb | rajibmitra/PythonNotebooks | 8efca498056ea373ae3623be89656106de3322ac | [
"Apache-2.0"
]
| null | null | null | 11_String_Formatting.ipynb | rajibmitra/PythonNotebooks | 8efca498056ea373ae3623be89656106de3322ac | [
"Apache-2.0"
]
| 1 | 2019-01-27T20:16:05.000Z | 2019-01-27T20:16:05.000Z | 22.177033 | 382 | 0.542611 | [
[
[
"name = 'Pete'\n'Hello %s' % name",
"_____no_output_____"
]
],
[
[
"We can use the `%x` format specifier to convert an int value to a string:",
"_____no_output_____"
]
],
[
[
"num = 5\n'I have %x apples' % num",
"_____no_output_____"
]
],
[
[
"Note: For new code, using str.format or f-strings is strongly recommended over the `%` operator.\n\n### str.format\n\nPython 3 introduced a new way to do string formatting that was later back-ported to Python 2.7. This makes the syntax for string formatting more regular.",
"_____no_output_____"
]
],
[
[
"name = 'John'\nage = 20'\n\n\"Hello I'm {}, my age is {}\".format(name, age)",
"_____no_output_____"
],
[
"\"Hello I'm {0}, my age is {1}\".format(name, age)",
"_____no_output_____"
]
],
[
[
"The official [Python 3.x documentation](https://docs.python.org/3/library/stdtypes.html?highlight=sprintf#printf-style-string-formatting) recommend `str.format` over the `%` operator:\n\n> The formatting operations described here exhibit a variety of quirks that lead to a number of common errors (such as failing to display tuples and dictionaries correctly). Using the newer formatted string literals or the str.format() interface helps avoid these errors. These alternatives also provide more powerful, flexible and extensible approaches to formatting text.\n\n### Lazy string formatting\n\nYou would only use `%s` string formatting on functions that can do lazy parameters evaluation,\nthe most common being logging:\n\nPrefer:",
"_____no_output_____"
]
],
[
[
"name = \"alice\"\nlogging.debug(\"User name: %s\", name)",
"_____no_output_____"
]
],
[
[
"Over:",
"_____no_output_____"
]
],
[
[
"logging.debug(\"User name: {}\".format(name))",
"_____no_output_____"
]
],
[
[
"Or:",
"_____no_output_____"
]
],
[
[
"logging.debug(\"User name: \" + name)",
"_____no_output_____"
]
],
[
[
"### Formatted String Literals or f-strings\n\nPython 3.6+",
"_____no_output_____"
]
],
[
[
"name = 'Elizabeth'\nf'Hello {name}!'",
"_____no_output_____"
]
],
[
[
"It is even possible to do inline arithmetic with it:",
"_____no_output_____"
]
],
[
[
"a = 5\nb = 10\nf'Five plus ten is {a + b} and not {2 * (a + b)}.'",
"_____no_output_____"
]
],
[
[
"### Template Strings\n\nA simpler and less powerful mechanism, but it is recommended when handling format strings generated by users. Due to their reduced complexity template strings are a safer choice.",
"_____no_output_____"
]
],
[
[
"from string import Template\n\nname = 'Elizabeth'\nt = Template('Hey $name!')\nt.substitute(name=name)",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb6b7d7c45237729da1667c084e92abb3b1563ab | 89,216 | ipynb | Jupyter Notebook | Final+Project+Nov_15.ipynb | Thomas6541/GEOS_505_Fall2018 | 45325703de3c07fd0fe889bb585472cdcfa0bba4 | [
"MIT"
]
| null | null | null | Final+Project+Nov_15.ipynb | Thomas6541/GEOS_505_Fall2018 | 45325703de3c07fd0fe889bb585472cdcfa0bba4 | [
"MIT"
]
| null | null | null | Final+Project+Nov_15.ipynb | Thomas6541/GEOS_505_Fall2018 | 45325703de3c07fd0fe889bb585472cdcfa0bba4 | [
"MIT"
]
| null | null | null | 98.03956 | 35,488 | 0.769671 | [
[
[
"# Thomas Robbins\n### GEOS 505 Final Project Nov. 15 submission",
"_____no_output_____"
],
[
"#### In conjunction with the abstract that was previously submitted for this project, the work below is the submission requirement for Nov. 15th, 2018. \n\n##### Below are snippets of code that represent the data chosen for this project, along with brief explanations of the code and work to be performed. ",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport csv\nimport matplotlib.pyplot as plt\nimport numpy as np",
"_____no_output_____"
]
],
[
[
"#### First, I will import the required csv file with concrete test data. This file will be initialized as 'data'",
"_____no_output_____"
]
],
[
[
"data = pd.read_csv('Mix_Design_V2.0.csv')\ndata[0:8]",
"_____no_output_____"
]
],
[
[
"### Next, I separate out the particular values associated with the 7-Day compressive strength tests. These values are initialized into a separate variable.",
"_____no_output_____"
]
],
[
[
"day7 = data['7-Day'].values",
"_____no_output_____"
],
[
"day7[0:5]",
"_____no_output_____"
]
],
[
[
"#### Here, I noticed the nan values need to be removed to properly run statistical programs on the file. Conversion from nan to num work was performed. ",
"_____no_output_____"
]
],
[
[
"Data = data.fillna(0)",
"_____no_output_____"
],
[
"day7 = Data['7-Day'].values",
"_____no_output_____"
],
[
"Data[0:8]",
"_____no_output_____"
],
[
"day7[0:10]",
"_____no_output_____"
],
[
"day7.max()",
"_____no_output_____"
]
],
[
[
"#### Next, graphical representation was required to verify that the values made sense and are consistant. ",
"_____no_output_____"
]
],
[
[
"plt.plot(day7)",
"_____no_output_____"
]
],
[
[
"### To display clear and concise graphical representations, the following type of styling, labeling and graph representations will be provided.",
"_____no_output_____"
]
],
[
[
"fig1 = plt.figure(figsize=(3.0, 2.0), dpi = 150)\nplt.rcParams.update({'font.size':8})\nplt.plot(day7,label= '7-Day strength')\nplt.ylabel('Strength in psi', fontname = \"Times New Roman\", color = 'blue')\nplt.xlabel('Sample number [m${}^3$/s]', fontname = \"Times New Roman\", color = 'Blue')\nplt.title('7-Day Strength Results', fontsize = 10, color = 'Blue')\nplt.legend(loc=0)",
"_____no_output_____"
]
],
[
[
"#### The graph now show the 7-Day compressive strength for each sample, the next step is to determine the values for other samples. Graphical representation will be performed similarly with the following test results.",
"_____no_output_____"
]
],
[
[
"day10 = Data['10-Day'].values",
"_____no_output_____"
],
[
"day28 = Data['28-Day'].values",
"_____no_output_____"
],
[
"day56 = Data['56-Day'].values",
"_____no_output_____"
]
],
[
[
"#### Once the data is successfully presented graphically, statistical information can be extrapolated from that data. The intent of this project is to perform statistics on the provided data set, and potentially make future predictions. The variables are numerous in this data set, and often there are nan values in empty place holders. The data does have enough information that the inference of future strength properties may be made given variance of input parameters such as temperature, are and moisture content. Most of the test data provides an actual strength to be much larger than the design strength. Noting this, probabilistic analysis may be performed to determine the probability of producing a concrete sample that may have strength less than that of the design strength. To perform this, Monte Carlo simulation may be used. To perform Monte Carlo simulation, random selection of input parameters will generate a mostly likely output parameter in the form of a probability density function. ",
"_____no_output_____"
],
[
"#### Generating random numbers between given max and min values for Monte Carlo Simulation may be performed as follows. ",
"_____no_output_____"
]
],
[
[
"import random\n\ndef rollDice():\n roll = random.randint(1,100)\n return roll\n\n# Now, just to test our dice, let's roll the dice 100 times. \n\nx = 0\nwhile x < 100:\n result = rollDice()\n #print(result)\n x+=1",
"_____no_output_____"
]
],
[
[
"### Using the method shown above, simulations will be ran between several input parameters provided within the data set. Potentially, for a given sample a prediction could be made on the strength of that sample. Verification can be made as the 56-day test results are included with the test data. If the simulations prove to be sufficient in the predictions, further modeling will be performed. ",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
]
]
|
cb6b7eeb59cd42ec67ac3298d90d525f91952be6 | 35,550 | ipynb | Jupyter Notebook | Preliminaries/creating_and_manipulating_tensors.ipynb | FacundoZS/MLCC_TRAIN | 720d2986b7db1f80ca717ffa8dcbbd56d3242658 | [
"Apache-2.0"
]
| null | null | null | Preliminaries/creating_and_manipulating_tensors.ipynb | FacundoZS/MLCC_TRAIN | 720d2986b7db1f80ca717ffa8dcbbd56d3242658 | [
"Apache-2.0"
]
| null | null | null | Preliminaries/creating_and_manipulating_tensors.ipynb | FacundoZS/MLCC_TRAIN | 720d2986b7db1f80ca717ffa8dcbbd56d3242658 | [
"Apache-2.0"
]
| null | null | null | 33.162313 | 450 | 0.475921 | [
[
[
"<a href=\"https://colab.research.google.com/github/ayan59dutta/MLCC-Exercises/blob/master/Preliminaries/creating_and_manipulating_tensors.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
],
[
"#### Copyright 2017 Google LLC.",
"_____no_output_____"
]
],
[
[
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.",
"_____no_output_____"
]
],
[
[
"# Creating and Manipulating Tensors",
"_____no_output_____"
],
[
"**Learning Objectives:**\n * Initialize and assign TensorFlow `Variable`s\n * Create and manipulate tensors\n * Refresh your memory about addition and multiplication in linear algebra (consult an introduction to matrix [addition](https://en.wikipedia.org/wiki/Matrix_addition) and [multiplication](https://en.wikipedia.org/wiki/Matrix_multiplication) if these topics are new to you)\n * Familiarize yourself with basic TensorFlow math and array operations",
"_____no_output_____"
]
],
[
[
"# from __future__ import print_function\n\nimport tensorflow as tf\ntry:\n tf.contrib.eager.enable_eager_execution()\n print(\"TF imported with eager execution!\")\nexcept ValueError:\n print(\"TF already imported with eager execution!\")",
"TF imported with eager execution!\n"
]
],
[
[
"## Vector Addition\n\nYou can perform many typical mathematical operations on tensors ([TF API](https://www.tensorflow.org/api_guides/python/math_ops)). The code below creates the following vectors (1-D tensors), all having exactly six elements:\n\n* A `primes` vector containing prime numbers.\n* A `ones` vector containing all `1` values.\n* A vector created by performing element-wise addition over the first two vectors.\n* A vector created by doubling the elements in the `primes` vector.",
"_____no_output_____"
]
],
[
[
"primes = tf.constant([2, 3, 5, 7, 11, 13], dtype=tf.int32)\nprint(\"primes:\", primes\n)\nones = tf.ones([6], dtype=tf.int32)\nprint(\"ones:\", ones)\n\njust_beyond_primes = tf.add(primes, ones)\nprint(\"just_beyond_primes:\", just_beyond_primes)\n\ntwos = tf.constant([2, 2, 2, 2, 2, 2], dtype=tf.int32)\nprimes_doubled = primes * twos\nprint(\"primes_doubled:\", primes_doubled)",
"('primes:', <tf.Tensor: id=1, shape=(6,), dtype=int32, numpy=array([ 2, 3, 5, 7, 11, 13], dtype=int32)>)\n('ones:', <tf.Tensor: id=5, shape=(6,), dtype=int32, numpy=array([1, 1, 1, 1, 1, 1], dtype=int32)>)\n('just_beyond_primes:', <tf.Tensor: id=7, shape=(6,), dtype=int32, numpy=array([ 3, 4, 6, 8, 12, 14], dtype=int32)>)\n('primes_doubled:', <tf.Tensor: id=10, shape=(6,), dtype=int32, numpy=array([ 4, 6, 10, 14, 22, 26], dtype=int32)>)\n"
]
],
[
[
"Printing a tensor returns not only its value, but also its shape (discussed in the next section) and the type of value stored in the tensor. Calling the `numpy` method of a tensor returns the value of the tensor as a numpy array:",
"_____no_output_____"
]
],
[
[
"some_matrix = tf.constant([[1, 2, 3], [4, 5, 6]], dtype=tf.int32)\nprint(some_matrix)\nprint(\"\\nvalue of some_matrix is:\\n\", some_matrix.numpy())",
"tf.Tensor(\n[[1 2 3]\n [4 5 6]], shape=(2, 3), dtype=int32)\n('\\nvalue of some_matrix is:\\n', array([[1, 2, 3],\n [4, 5, 6]], dtype=int32))\n"
]
],
[
[
"### Tensor Shapes\n\nShapes are used to characterize the size and number of dimensions of a tensor. The shape of a tensor is expressed as `list`, with the `i`th element representing the size along dimension `i`. The length of the list then indicates the rank of the tensor (i.e., the number of dimensions).\n\nFor more information, see the [TensorFlow documentation](https://www.tensorflow.org/programmers_guide/tensors#shape).\n\nA few basic examples:",
"_____no_output_____"
]
],
[
[
"# A scalar (0-D tensor).\nscalar = tf.zeros([])\n\n# A vector with 3 elements.\nvector = tf.zeros([3])\n\n# A matrix with 2 rows and 3 columns.\nmatrix = tf.zeros([2, 3])\n\nprint('scalar has shape', scalar.get_shape(), 'and value:\\n', scalar.numpy())\nprint('vector has shape', vector.get_shape(), 'and value:\\n', vector.numpy())\nprint('matrix has shape', matrix.get_shape(), 'and value:\\n', matrix.numpy())",
"('scalar has shape', TensorShape([]), 'and value:\\n', 0.0)\n('vector has shape', TensorShape([Dimension(3)]), 'and value:\\n', array([0., 0., 0.], dtype=float32))\n('matrix has shape', TensorShape([Dimension(2), Dimension(3)]), 'and value:\\n', array([[0., 0., 0.],\n [0., 0., 0.]], dtype=float32))\n"
]
],
[
[
"### Broadcasting\n\nIn mathematics, you can only perform element-wise operations (e.g. *add* and *equals*) on tensors of the same shape. In TensorFlow, however, you may perform operations on tensors that would traditionally have been incompatible. TensorFlow supports **broadcasting** (a concept borrowed from numpy), where the smaller array in an element-wise operation is enlarged to have the same shape as the larger array. For example, via broadcasting:\n\n* If an operand requires a size `[6]` tensor, a size `[1]` or a size `[]` tensor can serve as an operand.\n* If an operation requires a size `[4, 6]` tensor, any of the following sizes can serve as an operand:\n * `[1, 6]`\n * `[6]`\n * `[]`\n* If an operation requires a size `[3, 5, 6]` tensor, any of the following sizes can serve as an operand:\n\n * `[1, 5, 6]`\n * `[3, 1, 6]`\n * `[3, 5, 1]`\n * `[1, 1, 1]`\n * `[5, 6]`\n * `[1, 6]`\n * `[6]`\n * `[1]`\n * `[]`\n\n**NOTE:** When a tensor is broadcast, its entries are conceptually **copied**. (They are not actually copied for performance reasons. Broadcasting was invented as a performance optimization.)\n\nThe full broadcasting ruleset is well described in the easy-to-read [numpy broadcasting documentation](http://docs.scipy.org/doc/numpy-1.10.1/user/basics.broadcasting.html).\n\nThe following code performs the same tensor arithmetic as before, but instead uses scalar values (instead of vectors containing all `1`s or all `2`s) and broadcasting.",
"_____no_output_____"
]
],
[
[
"primes = tf.constant([2, 3, 5, 7, 11, 13], dtype=tf.int32)\nprint(\"primes:\", primes)\n\none = tf.constant(1, dtype=tf.int32)\nprint(\"one:\", one)\n\njust_beyond_primes = tf.add(primes, one)\nprint(\"just_beyond_primes:\", just_beyond_primes)\n\ntwo = tf.constant(2, dtype=tf.int32)\nprimes_doubled = primes * two\nprint(\"primes_doubled:\", primes_doubled)",
"('primes:', <tf.Tensor: id=25, shape=(6,), dtype=int32, numpy=array([ 2, 3, 5, 7, 11, 13], dtype=int32)>)\n('one:', <tf.Tensor: id=27, shape=(), dtype=int32, numpy=1>)\n('just_beyond_primes:', <tf.Tensor: id=29, shape=(6,), dtype=int32, numpy=array([ 3, 4, 6, 8, 12, 14], dtype=int32)>)\n('primes_doubled:', <tf.Tensor: id=32, shape=(6,), dtype=int32, numpy=array([ 4, 6, 10, 14, 22, 26], dtype=int32)>)\n"
]
],
[
[
"### Exercise #1: Arithmetic over vectors.\n\nPerform vector arithmetic to create a \"just_under_primes_squared\" vector, where the `i`th element is equal to the `i`th element in `primes` squared, minus 1. For example, the second element would be equal to `3 * 3 - 1 = 8`.\n\nMake use of either the `tf.multiply` or `tf.pow` ops to square the value of each element in the `primes` vector.",
"_____no_output_____"
]
],
[
[
"# Write your code for Task 1 here.\njust_under_primes_squared = tf.subtract(tf.pow(primes, 2), one)\nprint(\"just_under_primes_squared:\", just_under_primes_squared)",
"('just_under_primes_squared:', <tf.Tensor: id=36, shape=(6,), dtype=int32, numpy=array([ 3, 8, 24, 48, 120, 168], dtype=int32)>)\n"
]
],
[
[
"### Solution\n\nClick below for a solution.",
"_____no_output_____"
]
],
[
[
"# Task: Square each element in the primes vector, then subtract 1.\n\ndef solution(primes):\n primes_squared = tf.multiply(primes, primes)\n neg_one = tf.constant(-1, dtype=tf.int32)\n just_under_primes_squared = tf.add(primes_squared, neg_one)\n return just_under_primes_squared\n\ndef alternative_solution(primes):\n primes_squared = tf.pow(primes, 2)\n one = tf.constant(1, dtype=tf.int32)\n just_under_primes_squared = tf.subtract(primes_squared, one)\n return just_under_primes_squared\n\nprimes = tf.constant([2, 3, 5, 7, 11, 13], dtype=tf.int32)\njust_under_primes_squared = solution(primes)\nprint(\"just_under_primes_squared:\", just_under_primes_squared)",
"('just_under_primes_squared:', <tf.Tensor: id=41, shape=(6,), dtype=int32, numpy=array([ 3, 8, 24, 48, 120, 168], dtype=int32)>)\n"
]
],
[
[
"## Matrix Multiplication\n\nIn linear algebra, when multiplying two matrices, the number of *columns* of the first matrix must\nequal the number of *rows* in the second matrix.\n\n- It is **_valid_** to multiply a `3x4` matrix by a `4x2` matrix. This will result in a `3x2` matrix.\n- It is **_invalid_** to multiply a `4x2` matrix by a `3x4` matrix.",
"_____no_output_____"
]
],
[
[
"# A 3x4 matrix (2-d tensor).\nx = tf.constant([[5, 2, 4, 3], [5, 1, 6, -2], [-1, 3, -1, -2]],\n dtype=tf.int32)\n\n# A 4x2 matrix (2-d tensor).\ny = tf.constant([[2, 2], [3, 5], [4, 5], [1, 6]], dtype=tf.int32)\n\n# Multiply `x` by `y`; result is 3x2 matrix.\nmatrix_multiply_result = tf.matmul(x, y)\n\nprint(matrix_multiply_result)",
"tf.Tensor(\n[[35 58]\n [35 33]\n [ 1 -4]], shape=(3, 2), dtype=int32)\n"
]
],
[
[
"## Tensor Reshaping\n\nWith tensor addition and matrix multiplication each imposing constraints\non operands, TensorFlow programmers must frequently reshape tensors. \n\nYou can use the `tf.reshape` method to reshape a tensor. \nFor example, you can reshape a 8x2 tensor into a 2x8 tensor or a 4x4 tensor:",
"_____no_output_____"
]
],
[
[
"# Create an 8x2 matrix (2-D tensor).\nmatrix = tf.constant(\n [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]],\n dtype=tf.int32)\n\nreshaped_2x8_matrix = tf.reshape(matrix, [2, 8])\nreshaped_4x4_matrix = tf.reshape(matrix, [4, 4])\n\nprint(\"Original matrix (8x2):\")\nprint(matrix.numpy())\nprint(\"Reshaped matrix (2x8):\")\nprint(reshaped_2x8_matrix.numpy())\nprint(\"Reshaped matrix (4x4):\")\nprint(reshaped_4x4_matrix.numpy())",
"Original matrix (8x2):\n[[ 1 2]\n [ 3 4]\n [ 5 6]\n [ 7 8]\n [ 9 10]\n [11 12]\n [13 14]\n [15 16]]\nReshaped matrix (2x8):\n[[ 1 2 3 4 5 6 7 8]\n [ 9 10 11 12 13 14 15 16]]\nReshaped matrix (4x4):\n[[ 1 2 3 4]\n [ 5 6 7 8]\n [ 9 10 11 12]\n [13 14 15 16]]\n"
]
],
[
[
"\nYou can also use `tf.reshape` to change the number of dimensions (the \"rank\") of the tensor.\nFor example, you could reshape that 8x2 tensor into a 3-D 2x2x4 tensor or a 1-D 16-element tensor.",
"_____no_output_____"
]
],
[
[
"# Create an 8x2 matrix (2-D tensor).\nmatrix = tf.constant(\n [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]],\n dtype=tf.int32)\n\nreshaped_2x2x4_tensor = tf.reshape(matrix, [2, 2, 4])\none_dimensional_vector = tf.reshape(matrix, [16])\n\nprint(\"Original matrix (8x2):\")\nprint(matrix.numpy())\nprint(\"Reshaped 3-D tensor (2x2x4):\")\nprint(reshaped_2x2x4_tensor.numpy())\nprint(\"1-D vector:\")\nprint(one_dimensional_vector.numpy())",
"Original matrix (8x2):\n[[ 1 2]\n [ 3 4]\n [ 5 6]\n [ 7 8]\n [ 9 10]\n [11 12]\n [13 14]\n [15 16]]\nReshaped 3-D tensor (2x2x4):\n[[[ 1 2 3 4]\n [ 5 6 7 8]]\n\n [[ 9 10 11 12]\n [13 14 15 16]]]\n1-D vector:\n[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]\n"
]
],
[
[
"### Exercise #2: Reshape two tensors in order to multiply them.\n\nThe following two vectors are incompatible for matrix multiplication:\n\n * `a = tf.constant([5, 3, 2, 7, 1, 4])`\n * `b = tf.constant([4, 6, 3])`\n\nReshape these vectors into compatible operands for matrix multiplication.\nThen, invoke a matrix multiplication operation on the reshaped tensors.",
"_____no_output_____"
]
],
[
[
"# Write your code for Task 2 here.\n\na = tf.constant([5, 3, 2, 7, 1, 4], dtype=tf.int32)\nb = tf.constant([4, 6, 3], dtype=tf.int32)\n\na_reshaped = tf.reshape(a, [6, 1])\nb_reshaped = tf.reshape(b, [1, 3])\n\nproduct_a_b = tf.matmul(a_reshaped, b_reshaped)\n\nprint('Tensor a:')\nprint(a.numpy())\nprint('Tensor b:')\nprint(b.numpy())\nprint('Reshaped Tensor a:')\nprint(a_reshaped.numpy())\nprint('Reshaped Tensor b:')\nprint(b_reshaped.numpy())\nprint('Matrix multiplication product:')\nprint(product_a_b.numpy())",
"Tensor a:\n[5 3 2 7 1 4]\nTensor b:\n[4 6 3]\nReshaped Tensor a:\n[[5]\n [3]\n [2]\n [7]\n [1]\n [4]]\nReshaped Tensor b:\n[[4 6 3]]\nMatrix multiplication product:\n[[20 30 15]\n [12 18 9]\n [ 8 12 6]\n [28 42 21]\n [ 4 6 3]\n [16 24 12]]\n"
]
],
[
[
"### Solution\n\nClick below for a solution.",
"_____no_output_____"
],
[
"Remember, when multiplying two matrices, the number of *columns* of the first matrix must equal the number of *rows* in the second matrix.\n\nOne possible solution is to reshape `a` into a 2x3 matrix and reshape `b` into a a 3x1 matrix, resulting in a 2x1 matrix after multiplication:",
"_____no_output_____"
]
],
[
[
"# Task: Reshape two tensors in order to multiply them\n\na = tf.constant([5, 3, 2, 7, 1, 4])\nb = tf.constant([4, 6, 3])\n\nreshaped_a = tf.reshape(a, [2, 3])\nreshaped_b = tf.reshape(b, [3, 1])\nc = tf.matmul(reshaped_a, reshaped_b)\n\nprint(\"reshaped_a (2x3):\")\nprint(reshaped_a.numpy())\nprint(\"reshaped_b (3x1):\")\nprint(reshaped_b.numpy())\nprint(\"reshaped_a x reshaped_b (2x1):\")\nprint(c.numpy())",
"reshaped_a (2x3):\n[[5 3 2]\n [7 1 4]]\nreshaped_b (3x1):\n[[4]\n [6]\n [3]]\nreshaped_a x reshaped_b (2x1):\n[[44]\n [46]]\n"
]
],
[
[
"An alternative solution would be to reshape `a` into a 6x1 matrix and `b` into a 1x3 matrix, resulting in a 6x3 matrix after multiplication.",
"_____no_output_____"
],
[
"## Variables, Initialization and Assignment\n\nSo far, all the operations we performed were on static values (`tf.constant`); calling `numpy()` always returned the same result. TensorFlow allows you to define `Variable` objects, whose values can be changed.\n\nWhen creating a variable, you can set an initial value explicitly, or you can use an initializer (like a distribution):",
"_____no_output_____"
]
],
[
[
"# Create a scalar variable with the initial value 3.\nv = tf.contrib.eager.Variable([3])\n\n# Create a vector variable of shape [1, 4], with random initial values,\n# sampled from a normal distribution with mean 1 and standard deviation 0.35.\nw = tf.contrib.eager.Variable(tf.random_normal([1, 4], mean=1.0, stddev=0.35))\n\nprint(\"v:\", v.numpy())\nprint(\"w:\", w.numpy())",
"('v:', array([3], dtype=int32))\n('w:', array([[0.40924168, 0.73674554, 1.332316 , 0.8713621 ]], dtype=float32))\n"
]
],
[
[
"To change the value of a variable, use the `assign` op:",
"_____no_output_____"
]
],
[
[
"v = tf.contrib.eager.Variable([3])\nprint(v.numpy())\n\ntf.assign(v, [7])\nprint(v.numpy())\n\nv.assign([5])\nprint(v.numpy())",
"[3]\n[7]\n[5]\n"
]
],
[
[
"When assigning a new value to a variable, its shape must be equal to its previous shape:",
"_____no_output_____"
]
],
[
[
"v = tf.contrib.eager.Variable([[1, 2, 3], [4, 5, 6]])\nprint(v.numpy())\n\ntry:\n print(\"Assigning [7, 8, 9] to v\")\n v.assign([7, 8, 9])\nexcept ValueError as e:\n print(\"Exception:\", e)",
"[[1 2 3]\n [4 5 6]]\nAssigning [7, 8, 9] to v\n('Exception:', ValueError('Shapes (2, 3) and (3,) are incompatible',))\n"
]
],
[
[
"There are many more topics about variables that we didn't cover here, such as loading and storing. To learn more, see the [TensorFlow docs](https://www.tensorflow.org/programmers_guide/variables).",
"_____no_output_____"
],
[
"### Exercise #3: Simulate 10 rolls of two dice.\n\nCreate a dice simulation, which generates a `10x3` 2-D tensor in which:\n\n * Columns `1` and `2` each hold one throw of one six-sided die (with values 1–6).\n * Column `3` holds the sum of Columns `1` and `2` on the same row.\n\nFor example, the first row might have the following values:\n\n * Column `1` holds `4`\n * Column `2` holds `3`\n * Column `3` holds `7`\n\nYou'll need to explore the [TensorFlow API reference](https://www.tensorflow.org/api_docs/python/tf) to solve this task.",
"_____no_output_____"
]
],
[
[
"# Write your code for Task 3 here.\ndie1 = tf.contrib.eager.Variable(tf.random_uniform([10, 1], minval=1, maxval=7, dtype=tf.int32, seed=None, name='die1'))\ndie2 = tf.contrib.eager.Variable(tf.random_uniform([10, 1], minval=1, maxval=7, dtype=tf.int32, seed=None, name='die2')) \nsum_d1_d2 = tf.add(die1, die2)\n\ndice_sim = tf.concat(values=[die1, die2, sum_d1_d2], axis=1)\n\nprint(dice_sim.numpy())",
"[[ 2 2 4]\n [ 2 3 5]\n [ 4 6 10]\n [ 6 3 9]\n [ 4 5 9]\n [ 3 2 5]\n [ 3 5 8]\n [ 5 4 9]\n [ 1 6 7]\n [ 3 5 8]]\n"
]
],
[
[
"### Solution\n\nClick below for a solution.",
"_____no_output_____"
],
[
"We're going to place dice throws inside two separate 10x1 matrices, `die1` and `die2`. The summation of the dice rolls will be stored in `dice_sum`, then the resulting 10x3 matrix will be created by *concatenating* the three 10x1 matrices together into a single matrix.\n\nAlternatively, we could have placed dice throws inside a single 10x2 matrix, but adding different columns of the same matrix would be more complicated. We also could have placed dice throws inside two 1-D tensors (vectors), but doing so would require transposing the result.",
"_____no_output_____"
]
],
[
[
"# Task: Simulate 10 throws of two dice. Store the results in a 10x3 matrix.\n\ndie1 = tf.contrib.eager.Variable(\n tf.random_uniform([10, 1], minval=1, maxval=7, dtype=tf.int32))\ndie2 = tf.contrib.eager.Variable(\n tf.random_uniform([10, 1], minval=1, maxval=7, dtype=tf.int32))\n\ndice_sum = tf.add(die1, die2)\nresulting_matrix = tf.concat(values=[die1, die2, dice_sum], axis=1)\n\nprint(resulting_matrix.numpy())",
"[[ 1 3 4]\n [ 1 2 3]\n [ 1 3 4]\n [ 5 3 8]\n [ 2 4 6]\n [ 5 3 8]\n [ 5 2 7]\n [ 6 5 11]\n [ 2 5 7]\n [ 2 2 4]]\n"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
]
]
|
cb6ba2d32d4819eb9c98547dc458680138950af1 | 26,234 | ipynb | Jupyter Notebook | mortgage/E2E.ipynb | dantegd/notebooks | b7e4da815980d928b7b5d4941dae6d2af2b23524 | [
"Apache-2.0"
]
| null | null | null | mortgage/E2E.ipynb | dantegd/notebooks | b7e4da815980d928b7b5d4941dae6d2af2b23524 | [
"Apache-2.0"
]
| null | null | null | mortgage/E2E.ipynb | dantegd/notebooks | b7e4da815980d928b7b5d4941dae6d2af2b23524 | [
"Apache-2.0"
]
| null | null | null | 38.922849 | 163 | 0.550812 | [
[
[
"### Imports and Helper Functions",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport dask_xgboost as dxgb_gpu\nimport dask\nimport dask_cudf\nfrom dask.delayed import delayed\nfrom dask.distributed import Client, wait\nimport xgboost as xgb\nimport cudf\nfrom cudf.dataframe import DataFrame\nfrom collections import OrderedDict\nimport gc\nfrom glob import glob\nimport os",
"_____no_output_____"
],
[
"import subprocess\n\ncmd = \"hostname --all-ip-addresses\"\nprocess = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)\noutput, error = process.communicate()\nIPADDR = str(output.decode()).split()[0]\n\ncmd = \"../utils/dask-setup.sh 0\"\nprocess = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)\noutput, error = process.communicate()\n\ncmd = \"../utils/dask-setup.sh cudf 8 8786 8787 8790 \" + str(IPADDR) + \" MASTER\"\nprocess = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)\noutput, error = process.communicate()\n\nprint(output.decode())",
"_____no_output_____"
],
[
"import dask\nfrom dask.delayed import delayed\nfrom dask.distributed import Client, wait\n\n_client = IPADDR + str(\":8786\")\n \nclient = dask.distributed.Client(_client)\nclient",
"_____no_output_____"
],
[
"# to download data for this notebook, visit https://rapidsai.github.io/demos/datasets/mortgage-data and update the following paths accordingly\nacq_data_path = \"/path/to/mortgage/acq\"\nperf_data_path = \"/path/to/mortgage/perf\"\ncol_names_path = \"/path/to/mortgage/names.csv\"\nstart_year = 2000\nend_year = 2016 # end_year is inclusive\npart_count = 16 # the number of data files to train against",
"_____no_output_____"
],
[
"def initialize_rmm_pool():\n from librmm_cffi import librmm_config as rmm_cfg\n\n rmm_cfg.use_pool_allocator = True\n #rmm_cfg.initial_pool_size = 2<<30 # set to 2GiB. Default is 1/2 total GPU memory\n import cudf\n return cudf._gdf.rmm_initialize()\n\ndef initialize_rmm_no_pool():\n from librmm_cffi import librmm_config as rmm_cfg\n \n rmm_cfg.use_pool_allocator = False\n import cudf\n return cudf._gdf.rmm_initialize()",
"_____no_output_____"
],
[
"client.run(initialize_rmm_pool)",
"_____no_output_____"
],
[
"def run_dask_task(func, **kwargs):\n task = func(**kwargs)\n return task\n\ndef process_quarter_gpu(year=2000, quarter=1, perf_file=\"\"):\n ml_arrays = run_dask_task(delayed(run_gpu_workflow),\n quarter=quarter,\n year=year,\n perf_file=perf_file)\n return client.compute(ml_arrays,\n optimize_graph=False,\n fifo_timeout=\"0ms\")\n\ndef null_workaround(df, **kwargs):\n for column, data_type in df.dtypes.items():\n if str(data_type) == \"category\":\n df[column] = df[column].astype('int32').fillna(-1)\n if str(data_type) in ['int8', 'int16', 'int32', 'int64', 'float32', 'float64']:\n df[column] = df[column].fillna(-1)\n return df\n\ndef run_gpu_workflow(quarter=1, year=2000, perf_file=\"\", **kwargs):\n names = gpu_load_names()\n acq_gdf = gpu_load_acquisition_csv(acquisition_path= acq_data_path + \"/Acquisition_\"\n + str(year) + \"Q\" + str(quarter) + \".txt\")\n acq_gdf = acq_gdf.merge(names, how='left', on=['seller_name'])\n acq_gdf.drop_column('seller_name')\n acq_gdf['seller_name'] = acq_gdf['new']\n acq_gdf.drop_column('new')\n perf_df_tmp = gpu_load_performance_csv(perf_file)\n gdf = perf_df_tmp\n everdf = create_ever_features(gdf)\n delinq_merge = create_delinq_features(gdf)\n everdf = join_ever_delinq_features(everdf, delinq_merge)\n del(delinq_merge)\n joined_df = create_joined_df(gdf, everdf)\n testdf = create_12_mon_features(joined_df)\n joined_df = combine_joined_12_mon(joined_df, testdf)\n del(testdf)\n perf_df = final_performance_delinquency(gdf, joined_df)\n del(gdf, joined_df)\n final_gdf = join_perf_acq_gdfs(perf_df, acq_gdf)\n del(perf_df)\n del(acq_gdf)\n final_gdf = last_mile_cleaning(final_gdf)\n return final_gdf\n\ndef gpu_load_performance_csv(performance_path, **kwargs):\n \"\"\" Loads performance data\n\n Returns\n -------\n GPU DataFrame\n \"\"\"\n \n cols = [\n \"loan_id\", \"monthly_reporting_period\", \"servicer\", \"interest_rate\", \"current_actual_upb\",\n \"loan_age\", \"remaining_months_to_legal_maturity\", \"adj_remaining_months_to_maturity\",\n \"maturity_date\", \"msa\", \"current_loan_delinquency_status\", \"mod_flag\", \"zero_balance_code\",\n \"zero_balance_effective_date\", \"last_paid_installment_date\", \"foreclosed_after\",\n \"disposition_date\", \"foreclosure_costs\", \"prop_preservation_and_repair_costs\",\n \"asset_recovery_costs\", \"misc_holding_expenses\", \"holding_taxes\", \"net_sale_proceeds\",\n \"credit_enhancement_proceeds\", \"repurchase_make_whole_proceeds\", \"other_foreclosure_proceeds\",\n \"non_interest_bearing_upb\", \"principal_forgiveness_upb\", \"repurchase_make_whole_proceeds_flag\",\n \"foreclosure_principal_write_off_amount\", \"servicing_activity_indicator\"\n ]\n \n dtypes = OrderedDict([\n (\"loan_id\", \"int64\"),\n (\"monthly_reporting_period\", \"date\"),\n (\"servicer\", \"category\"),\n (\"interest_rate\", \"float64\"),\n (\"current_actual_upb\", \"float64\"),\n (\"loan_age\", \"float64\"),\n (\"remaining_months_to_legal_maturity\", \"float64\"),\n (\"adj_remaining_months_to_maturity\", \"float64\"),\n (\"maturity_date\", \"date\"),\n (\"msa\", \"float64\"),\n (\"current_loan_delinquency_status\", \"int32\"),\n (\"mod_flag\", \"category\"),\n (\"zero_balance_code\", \"category\"),\n (\"zero_balance_effective_date\", \"date\"),\n (\"last_paid_installment_date\", \"date\"),\n (\"foreclosed_after\", \"date\"),\n (\"disposition_date\", \"date\"),\n (\"foreclosure_costs\", \"float64\"),\n (\"prop_preservation_and_repair_costs\", \"float64\"),\n (\"asset_recovery_costs\", \"float64\"),\n (\"misc_holding_expenses\", \"float64\"),\n (\"holding_taxes\", \"float64\"),\n (\"net_sale_proceeds\", \"float64\"),\n (\"credit_enhancement_proceeds\", \"float64\"),\n (\"repurchase_make_whole_proceeds\", \"float64\"),\n (\"other_foreclosure_proceeds\", \"float64\"),\n (\"non_interest_bearing_upb\", \"float64\"),\n (\"principal_forgiveness_upb\", \"float64\"),\n (\"repurchase_make_whole_proceeds_flag\", \"category\"),\n (\"foreclosure_principal_write_off_amount\", \"float64\"),\n (\"servicing_activity_indicator\", \"category\")\n ])\n\n print(performance_path)\n \n return cudf.read_csv(performance_path, names=cols, delimiter='|', dtype=list(dtypes.values()), skiprows=1)\n\ndef gpu_load_acquisition_csv(acquisition_path, **kwargs):\n \"\"\" Loads acquisition data\n\n Returns\n -------\n GPU DataFrame\n \"\"\"\n \n cols = [\n 'loan_id', 'orig_channel', 'seller_name', 'orig_interest_rate', 'orig_upb', 'orig_loan_term', \n 'orig_date', 'first_pay_date', 'orig_ltv', 'orig_cltv', 'num_borrowers', 'dti', 'borrower_credit_score', \n 'first_home_buyer', 'loan_purpose', 'property_type', 'num_units', 'occupancy_status', 'property_state',\n 'zip', 'mortgage_insurance_percent', 'product_type', 'coborrow_credit_score', 'mortgage_insurance_type', \n 'relocation_mortgage_indicator'\n ]\n \n dtypes = OrderedDict([\n (\"loan_id\", \"int64\"),\n (\"orig_channel\", \"category\"),\n (\"seller_name\", \"category\"),\n (\"orig_interest_rate\", \"float64\"),\n (\"orig_upb\", \"int64\"),\n (\"orig_loan_term\", \"int64\"),\n (\"orig_date\", \"date\"),\n (\"first_pay_date\", \"date\"),\n (\"orig_ltv\", \"float64\"),\n (\"orig_cltv\", \"float64\"),\n (\"num_borrowers\", \"float64\"),\n (\"dti\", \"float64\"),\n (\"borrower_credit_score\", \"float64\"),\n (\"first_home_buyer\", \"category\"),\n (\"loan_purpose\", \"category\"),\n (\"property_type\", \"category\"),\n (\"num_units\", \"int64\"),\n (\"occupancy_status\", \"category\"),\n (\"property_state\", \"category\"),\n (\"zip\", \"int64\"),\n (\"mortgage_insurance_percent\", \"float64\"),\n (\"product_type\", \"category\"),\n (\"coborrow_credit_score\", \"float64\"),\n (\"mortgage_insurance_type\", \"float64\"),\n (\"relocation_mortgage_indicator\", \"category\")\n ])\n \n print(acquisition_path)\n \n return cudf.read_csv(acquisition_path, names=cols, delimiter='|', dtype=list(dtypes.values()), skiprows=1)\n\ndef gpu_load_names(**kwargs):\n \"\"\" Loads names used for renaming the banks\n \n Returns\n -------\n GPU DataFrame\n \"\"\"\n\n cols = [\n 'seller_name', 'new'\n ]\n \n dtypes = OrderedDict([\n (\"seller_name\", \"category\"),\n (\"new\", \"category\"),\n ])\n\n return cudf.read_csv(col_names_path, names=cols, delimiter='|', dtype=list(dtypes.values()), skiprows=1)",
"_____no_output_____"
]
],
[
[
"### GPU ETL and Feature Engineering Functions",
"_____no_output_____"
]
],
[
[
"def create_ever_features(gdf, **kwargs):\n everdf = gdf[['loan_id', 'current_loan_delinquency_status']]\n everdf = everdf.groupby('loan_id', method='hash').max()\n del(gdf)\n everdf['ever_30'] = (everdf['max_current_loan_delinquency_status'] >= 1).astype('int8')\n everdf['ever_90'] = (everdf['max_current_loan_delinquency_status'] >= 3).astype('int8')\n everdf['ever_180'] = (everdf['max_current_loan_delinquency_status'] >= 6).astype('int8')\n everdf.drop_column('max_current_loan_delinquency_status')\n return everdf",
"_____no_output_____"
],
[
"def create_delinq_features(gdf, **kwargs):\n delinq_gdf = gdf[['loan_id', 'monthly_reporting_period', 'current_loan_delinquency_status']]\n del(gdf)\n delinq_30 = delinq_gdf.query('current_loan_delinquency_status >= 1')[['loan_id', 'monthly_reporting_period']].groupby('loan_id', method='hash').min()\n delinq_30['delinquency_30'] = delinq_30['min_monthly_reporting_period']\n delinq_30.drop_column('min_monthly_reporting_period')\n delinq_90 = delinq_gdf.query('current_loan_delinquency_status >= 3')[['loan_id', 'monthly_reporting_period']].groupby('loan_id', method='hash').min()\n delinq_90['delinquency_90'] = delinq_90['min_monthly_reporting_period']\n delinq_90.drop_column('min_monthly_reporting_period')\n delinq_180 = delinq_gdf.query('current_loan_delinquency_status >= 6')[['loan_id', 'monthly_reporting_period']].groupby('loan_id', method='hash').min()\n delinq_180['delinquency_180'] = delinq_180['min_monthly_reporting_period']\n delinq_180.drop_column('min_monthly_reporting_period')\n del(delinq_gdf)\n delinq_merge = delinq_30.merge(delinq_90, how='left', on=['loan_id'], type='hash')\n delinq_merge['delinquency_90'] = delinq_merge['delinquency_90'].fillna(np.dtype('datetime64[ms]').type('1970-01-01').astype('datetime64[ms]'))\n delinq_merge = delinq_merge.merge(delinq_180, how='left', on=['loan_id'], type='hash')\n delinq_merge['delinquency_180'] = delinq_merge['delinquency_180'].fillna(np.dtype('datetime64[ms]').type('1970-01-01').astype('datetime64[ms]'))\n del(delinq_30)\n del(delinq_90)\n del(delinq_180)\n return delinq_merge",
"_____no_output_____"
],
[
"def join_ever_delinq_features(everdf_tmp, delinq_merge, **kwargs):\n everdf = everdf_tmp.merge(delinq_merge, on=['loan_id'], how='left', type='hash')\n del(everdf_tmp)\n del(delinq_merge)\n everdf['delinquency_30'] = everdf['delinquency_30'].fillna(np.dtype('datetime64[ms]').type('1970-01-01').astype('datetime64[ms]'))\n everdf['delinquency_90'] = everdf['delinquency_90'].fillna(np.dtype('datetime64[ms]').type('1970-01-01').astype('datetime64[ms]'))\n everdf['delinquency_180'] = everdf['delinquency_180'].fillna(np.dtype('datetime64[ms]').type('1970-01-01').astype('datetime64[ms]'))\n return everdf",
"_____no_output_____"
],
[
"def create_joined_df(gdf, everdf, **kwargs):\n test = gdf[['loan_id', 'monthly_reporting_period', 'current_loan_delinquency_status', 'current_actual_upb']]\n del(gdf)\n test['timestamp'] = test['monthly_reporting_period']\n test.drop_column('monthly_reporting_period')\n test['timestamp_month'] = test['timestamp'].dt.month\n test['timestamp_year'] = test['timestamp'].dt.year\n test['delinquency_12'] = test['current_loan_delinquency_status']\n test.drop_column('current_loan_delinquency_status')\n test['upb_12'] = test['current_actual_upb']\n test.drop_column('current_actual_upb')\n test['upb_12'] = test['upb_12'].fillna(999999999)\n test['delinquency_12'] = test['delinquency_12'].fillna(-1)\n \n joined_df = test.merge(everdf, how='left', on=['loan_id'], type='hash')\n del(everdf)\n del(test)\n \n joined_df['ever_30'] = joined_df['ever_30'].fillna(-1)\n joined_df['ever_90'] = joined_df['ever_90'].fillna(-1)\n joined_df['ever_180'] = joined_df['ever_180'].fillna(-1)\n joined_df['delinquency_30'] = joined_df['delinquency_30'].fillna(-1)\n joined_df['delinquency_90'] = joined_df['delinquency_90'].fillna(-1)\n joined_df['delinquency_180'] = joined_df['delinquency_180'].fillna(-1)\n \n joined_df['timestamp_year'] = joined_df['timestamp_year'].astype('int32')\n joined_df['timestamp_month'] = joined_df['timestamp_month'].astype('int32')\n \n return joined_df",
"_____no_output_____"
],
[
"def create_12_mon_features(joined_df, **kwargs):\n testdfs = []\n n_months = 12\n for y in range(1, n_months + 1):\n tmpdf = joined_df[['loan_id', 'timestamp_year', 'timestamp_month', 'delinquency_12', 'upb_12']]\n tmpdf['josh_months'] = tmpdf['timestamp_year'] * 12 + tmpdf['timestamp_month']\n tmpdf['josh_mody_n'] = ((tmpdf['josh_months'].astype('float64') - 24000 - y) / 12).floor()\n tmpdf = tmpdf.groupby(['loan_id', 'josh_mody_n'], method='hash').agg({'delinquency_12': 'max','upb_12': 'min'})\n tmpdf['delinquency_12'] = (tmpdf['max_delinquency_12']>3).astype('int32')\n tmpdf['delinquency_12'] +=(tmpdf['min_upb_12']==0).astype('int32')\n tmpdf.drop_column('max_delinquency_12')\n tmpdf['upb_12'] = tmpdf['min_upb_12']\n tmpdf.drop_column('min_upb_12')\n tmpdf['timestamp_year'] = (((tmpdf['josh_mody_n'] * n_months) + 24000 + (y - 1)) / 12).floor().astype('int16')\n tmpdf['timestamp_month'] = np.int8(y)\n tmpdf.drop_column('josh_mody_n')\n testdfs.append(tmpdf)\n del(tmpdf)\n del(joined_df)\n\n return cudf.concat(testdfs)",
"_____no_output_____"
],
[
"def combine_joined_12_mon(joined_df, testdf, **kwargs):\n joined_df.drop_column('delinquency_12')\n joined_df.drop_column('upb_12')\n joined_df['timestamp_year'] = joined_df['timestamp_year'].astype('int16')\n joined_df['timestamp_month'] = joined_df['timestamp_month'].astype('int8')\n return joined_df.merge(testdf, how='left', on=['loan_id', 'timestamp_year', 'timestamp_month'], type='hash')",
"_____no_output_____"
],
[
"def final_performance_delinquency(gdf, joined_df, **kwargs):\n merged = null_workaround(gdf)\n joined_df = null_workaround(joined_df)\n merged['timestamp_month'] = merged['monthly_reporting_period'].dt.month\n merged['timestamp_month'] = merged['timestamp_month'].astype('int8')\n merged['timestamp_year'] = merged['monthly_reporting_period'].dt.year\n merged['timestamp_year'] = merged['timestamp_year'].astype('int16')\n merged = merged.merge(joined_df, how='left', on=['loan_id', 'timestamp_year', 'timestamp_month'], type='hash')\n merged.drop_column('timestamp_year')\n merged.drop_column('timestamp_month')\n return merged",
"_____no_output_____"
],
[
"def join_perf_acq_gdfs(perf, acq, **kwargs):\n perf = null_workaround(perf)\n acq = null_workaround(acq)\n return perf.merge(acq, how='left', on=['loan_id'], type='hash')",
"_____no_output_____"
],
[
"def last_mile_cleaning(df, **kwargs):\n drop_list = [\n 'loan_id', 'orig_date', 'first_pay_date', 'seller_name',\n 'monthly_reporting_period', 'last_paid_installment_date', 'maturity_date', 'ever_30', 'ever_90', 'ever_180',\n 'delinquency_30', 'delinquency_90', 'delinquency_180', 'upb_12',\n 'zero_balance_effective_date','foreclosed_after', 'disposition_date','timestamp'\n ]\n for column in drop_list:\n df.drop_column(column)\n for col, dtype in df.dtypes.iteritems():\n if str(dtype)=='category':\n df[col] = df[col].cat.codes\n df[col] = df[col].astype('float32')\n df['delinquency_12'] = df['delinquency_12'] > 0\n df['delinquency_12'] = df['delinquency_12'].fillna(False).astype('int32')\n for column in df.columns:\n df[column] = df[column].fillna(-1)\n return df.to_arrow(index=False)",
"_____no_output_____"
]
],
[
[
"## Process the data using the functions",
"_____no_output_____"
],
[
"### Dask + cuDF multi-year",
"_____no_output_____"
]
],
[
[
"%%time\n\n# NOTE: The ETL calculates additional features which are then dropped before creating the XGBoost DMatrix.\n# This can be optimized to avoid calculating the dropped features.\n\ngpu_dfs = []\ngpu_time = 0\nquarter = 1\nyear = start_year\ncount = 0\nwhile year <= end_year:\n for file in glob(os.path.join(perf_data_path + \"/Performance_\" + str(year) + \"Q\" + str(quarter) + \"*\")):\n gpu_dfs.append(process_quarter_gpu(year=year, quarter=quarter, perf_file=file))\n count += 1\n quarter += 1\n if quarter == 5:\n year += 1\n quarter = 1\nwait(gpu_dfs)",
"_____no_output_____"
],
[
"client.run(cudf._gdf.rmm_finalize)",
"_____no_output_____"
],
[
"client.run(initialize_rmm_no_pool)",
"_____no_output_____"
]
],
[
[
"### GPU Machine Learning",
"_____no_output_____"
]
],
[
[
"dxgb_gpu_params = {\n 'nround': 100,\n 'max_depth': 8,\n 'max_leaves': 2**8,\n 'alpha': 0.9,\n 'eta': 0.1,\n 'gamma': 0.1,\n 'learning_rate': 0.1,\n 'subsample': 1,\n 'reg_lambda': 1,\n 'scale_pos_weight': 2,\n 'min_child_weight': 30,\n 'tree_method': 'gpu_hist',\n 'n_gpus': 1,\n 'distributed_dask': True,\n 'loss': 'ls',\n 'objective': 'gpu:reg:linear',\n 'max_features': 'auto',\n 'criterion': 'friedman_mse',\n 'grow_policy': 'lossguide',\n 'verbose': True\n}",
"_____no_output_____"
],
[
"%%time\n\ngpu_dfs = [delayed(DataFrame.from_arrow)(gpu_df) for gpu_df in gpu_dfs[:part_count]]\ngpu_dfs = [gpu_df for gpu_df in gpu_dfs]\nwait(gpu_dfs)\n\ntmp_map = [(gpu_df, list(client.who_has(gpu_df).values())[0]) for gpu_df in gpu_dfs]\nnew_map = {}\nfor key, value in tmp_map:\n if value not in new_map:\n new_map[value] = [key]\n else:\n new_map[value].append(key)\n\ndel(tmp_map)\ngpu_dfs = []\nfor list_delayed in new_map.values():\n gpu_dfs.append(delayed(cudf.concat)(list_delayed))\n\ndel(new_map)\ngpu_dfs = [(gpu_df[['delinquency_12']], gpu_df[delayed(list)(gpu_df.columns.difference(['delinquency_12']))]) for gpu_df in gpu_dfs]\ngpu_dfs = [(gpu_df[0].persist(), gpu_df[1].persist()) for gpu_df in gpu_dfs]\n\ngpu_dfs = [dask.delayed(xgb.DMatrix)(gpu_df[1], gpu_df[0]) for gpu_df in gpu_dfs]\ngpu_dfs = [gpu_df.persist() for gpu_df in gpu_dfs]\ngc.collect()\nwait(gpu_dfs)",
"_____no_output_____"
],
[
"%%time\nlabels = None\nbst = dxgb_gpu.train(client, dxgb_gpu_params, gpu_dfs, labels, num_boost_round=dxgb_gpu_params['nround'])",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
]
|
cb6ba3ad4080b5fcc0cc23cfe13d5a36b5768a55 | 51,772 | ipynb | Jupyter Notebook | demo/notebooks/demo.ipynb | ShkarupaDC/parallel-gradient-descent | 269c0e0fcb2272a25f69a4656e2b0d369f7b7b63 | [
"MIT"
]
| null | null | null | demo/notebooks/demo.ipynb | ShkarupaDC/parallel-gradient-descent | 269c0e0fcb2272a25f69a4656e2b0d369f7b7b63 | [
"MIT"
]
| null | null | null | demo/notebooks/demo.ipynb | ShkarupaDC/parallel-gradient-descent | 269c0e0fcb2272a25f69a4656e2b0d369f7b7b63 | [
"MIT"
]
| null | null | null | 73.227723 | 30,960 | 0.791277 | [
[
[
"## Import modules",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\nimport os\nimport time\n\nfrom sklearn.linear_model import SGDRegressor, LinearRegression\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.metrics import mean_squared_error",
"_____no_output_____"
]
],
[
[
"## Utils",
"_____no_output_____"
]
],
[
[
"def load_matrix(path: str, verbose: bool = True, num_to_print: int = 3) -> np.ndarray:\n matrix = np.loadtxt(path, delimiter=\",\")\n if verbose:\n print(\"Loaded matrix from\", os.path.basename(path))\n print(\"Shape:\", matrix.shape)\n num_to_print = min(num_to_print, len(matrix))\n print(\"Example:\\n\", matrix[:num_to_print], end=\"\\n\\n\")\n return matrix",
"_____no_output_____"
],
[
"%cd ../../",
"/home/shkarupa/Documents/Semester6/Coursework/parallel-gradient-descent\n"
]
],
[
[
"## Generate data",
"_____no_output_____"
]
],
[
[
"!python demo/gen_data.py --help",
"Generate train and test data for linear regression model\n\noptions:\n -h, --help show this help message and exit\n -t , --num-train number of train samples (default: 1000)\n -e , --num-eval number of evaluation samples (default: 0)\n -f , --num-features number of per sample features (default: 10)\n -s , --seed seed that make data generation deterministic (default:\n None)\n -o , --out-dir path to directory where generated data will be stored\n (default: ./data)\n"
],
[
"!python demo/gen_data.py --num-train 10000 --num-eval 1000 --num-features 50 --seed 42 --out-dir data",
"_____no_output_____"
]
],
[
[
"## Look at data",
"_____no_output_____"
]
],
[
[
"!ls data",
"x_eval.csv x_train.csv y_eval.csv y_train.csv\n"
],
[
"x_train = load_matrix(\"data/x_train.csv\")\ny_train = load_matrix(\"data/y_train.csv\")\n\nx_eval = load_matrix(\"data/x_eval.csv\")\ny_eval = load_matrix(\"data/y_eval.csv\")",
"Loaded matrix from x_train.csv\nShape: (10000, 50)\nExample:\n [[ 2.95968714 -1.55389604 -0.48789272 -1.36831184 -0.20263477 1.41635756\n -0.90313868 -0.95597179 -0.12810009 -0.02263904 1.93091826 -0.32607787\n 0.98447725 0.20676263 0.98023936 -0.03414261 -0.87678792 -0.74727258\n -0.89908933 0.09703152 0.45763206 -0.30576507 0.63384171 0.33568143\n 1.48803568 -1.18529753 0.84500771 -0.67708658 -0.83827108 1.77233907\n 1.20185808 -1.35613327 0.02696155 -0.07453549 -0.11018498 -1.02105208\n 1.313818 -0.50045726 -1.38283007 -0.25538025 1.10290659 -0.43155701\n -1.78457899 -1.02707377 0.63928598 0.25682739 -0.99758205 -0.7624109\n 0.236132 0.39076224]\n [-0.27781133 -0.91610651 0.42757895 -0.10941617 0.51962799 1.59734786\n 0.0355245 -0.30976788 1.09694687 -0.95203685 0.23673151 -0.83714568\n 0.57837305 -0.10084802 0.13556278 0.93543662 0.26276161 -0.35659344\n 1.11567523 -0.00508411 0.91885756 1.30832185 -2.06085119 -0.1050777\n 2.12520861 1.56262663 -0.51122999 -0.85091136 0.80528771 0.08362684\n 1.86880646 0.7885003 -0.19058115 0.57807018 -1.59670416 -1.45176702\n 1.16182033 -1.38150176 0.23989988 -0.35705069 1.31480371 -0.15677553\n -0.25698486 0.05513496 -1.23361284 -0.89909624 -0.46245376 -0.13605804\n 0.51942191 -1.70974109]\n [-0.52162039 2.82117892 -1.59373366 0.32953399 0.34217847 -0.09104095\n 0.18360542 1.16961333 0.75111788 2.15366115 0.61281111 0.69574614\n 0.7033284 0.24774934 1.03586473 0.46017247 0.95866222 -0.10530401\n -1.1408589 -0.42394369 -0.50004125 0.22344324 1.7238002 -0.30851688\n -0.62188257 -0.29822032 -1.14413797 1.40813834 1.32985575 0.41604872\n 0.86768434 -2.48159185 -0.09535557 -0.54298951 0.35574247 -0.37982841\n -1.50727081 0.79739274 0.65365459 -0.49908585 0.12073553 -1.73174332\n 1.36930683 -0.39245976 0.09473062 -1.7253573 0.52616931 -0.39378155\n -1.88633428 1.09857467]]\n\nLoaded matrix from y_train.csv\nShape: (10000,)\nExample:\n [-478.16198111 169.86932909 -161.55624699]\n\nLoaded matrix from x_eval.csv\nShape: (1000, 50)\nExample:\n [[ 0.96175829 0.58674452 1.24284055 -0.67560564 -0.20178574 0.13750195\n 2.98968055 -0.8750105 -0.30803252 0.29253507 0.96502323 1.33490191\n -0.30126831 -0.39092628 0.52863209 1.88597908 0.76955121 -0.78925808\n -0.76781061 -0.48755244 0.84054724 0.36686101 0.69165782 0.03405319\n 0.13032699 0.68289451 0.65191006 0.75894884 -1.37628076 0.39589519\n 0.37445745 -0.66989844 0.32097845 -0.9247938 0.54259753 -0.50472029\n 1.80665931 -0.44083257 1.04498691 -0.30364496 0.34523431 -0.37263832\n 1.37882768 -0.18970554 -0.70744278 0.12286005 -1.07113758 1.30073969\n 0.46906829 1.41200961]\n [-0.84767884 -0.5780314 0.70219714 -0.85377402 -0.27160273 -1.53550898\n 0.3870383 -1.08936027 0.85549836 -0.26445369 -0.13930625 0.6150146\n -1.80464433 0.23357835 1.42287475 0.25344012 -0.89050652 -0.34798843\n -0.41624342 -1.58452954 -0.03977255 -2.04352498 -2.04639122 -1.32748915\n -0.53215475 -0.70188121 0.29829602 -0.56154095 -0.55590129 -0.75903841\n -0.25011691 -1.70742559 0.07346474 0.49848529 1.22606954 0.4486427\n -0.73838372 -0.36016235 -0.17144902 1.26586246 -0.02935448 -0.85773525\n 0.541882 -0.02313764 0.649756 -1.20399586 -2.32447559 1.04854907\n 0.18747526 -0.50677887]\n [ 0.77123601 0.31731032 1.45111757 -2.46339721 0.34453965 0.09734524\n 1.24875322 -0.47318678 -0.05857757 -0.24646401 -1.59746159 -1.68887239\n -0.57699149 1.01553297 0.36085937 1.22906066 0.47988233 -1.08425592\n 0.23792322 -0.2551666 -0.6363233 -0.72418166 1.64136659 1.83495479\n -1.03512218 2.0672147 0.12050157 -0.18971534 -0.01421435 -0.37907946\n -0.34346848 0.53243529 -0.03749473 0.52751645 0.01870016 1.53381005\n -1.1790435 0.02307377 -0.19013916 1.01850551 0.26322146 -0.01280206\n 0.59938889 -0.0870314 0.34252829 -1.3019677 0.19906294 -1.17852783\n 0.72235672 -0.51196368]]\n\nLoaded matrix from y_eval.csv\nShape: (1000,)\nExample:\n [ 250.62927075 -743.17397433 216.12060663]\n\n"
]
],
[
[
"## Run Linear regression",
"_____no_output_____"
]
],
[
[
"!./build/bin/gradient_descent -h",
"Linear regression config:\n\nCLI options:\n -h [ --help ] produce help message\n -c [ --config ] arg path to config file\n\nAlgorithm options:\n -i [ --input-path ] arg path to input CSV file\n -t [ --target-path ] arg path to target CSV file\n -e [ --eval-path ] arg path to evaluation CSV file\n -o [ --out-path ] arg (=output.csv) path to output CSV file\n --cost-path arg path to cost CSV file\n -p [ --parallel ] wether to use parallel or serial SGD\n -n [ --num-epochs ] arg (=1000) number of training epochs\n -l [ --lr ] arg (=0.001) learning rate\n -w [ --weight-decay ] arg (=0.01) L2 regularization lambda term\n --normalize wether to normalize input\n --num-threads arg (=11) number of threads to use for parallel \n SGD\n --num-step-epochs arg (=1) number of epochs to compute in each \n thread before weight sharing\n\n"
]
],
[
[
"### SGD",
"_____no_output_____"
]
],
[
[
"!cat examples/serial_config.cfg",
"input-path = data/x_train.csv\ntarget-path = data/y_train.csv\neval-path = data/x_eval.csv\nout-path = output/serial_pred.csv\ncost-path = output/serial_cost.csv\nparallel = false\nnum-epochs = 10000\nlr = 0.001\nweight-decay = 0.01\nnormalize = true\n"
],
[
"!./build/bin/gradient_descent --config examples/serial_config.cfg",
"Time: 2026 ms\n"
],
[
"y_pred_sgd = load_matrix(\"output/serial_pred.csv\", verbose=False)",
"_____no_output_____"
],
[
"print(\"MSE:\", mean_squared_error(y_pred_sgd.squeeze(), y_eval))",
"MSE: 16.35216516327586\n"
]
],
[
[
"### Parallel SGD",
"_____no_output_____"
]
],
[
[
"!cat examples/parallel_config.cfg",
"input-path = data/x_train.csv\ntarget-path = data/y_train.csv\neval-path = data/x_eval.csv\nout-path = output/parallel_pred.csv\ncost-path = output/parallel_cost.csv\nparallel = true\nnum-epochs = 10000\nlr = 0.001\nweight-decay = 0.01\nnormalize = true\nnum-threads = 11\nnum-step-epochs = 100\n"
],
[
"!./build/bin/gradient_descent --config examples/parallel_config.cfg",
"Time: 484 ms\n"
],
[
"y_pred_parallel_sgd = load_matrix(\"output/parallel_pred.csv\", verbose=False)",
"_____no_output_____"
],
[
"print(\"MSE:\", mean_squared_error(y_pred_parallel_sgd, y_eval))",
"MSE: 16.621072667443595\n"
]
],
[
[
"### Sklearn",
"_____no_output_____"
]
],
[
[
"regressor = make_pipeline(StandardScaler(), LinearRegression())\n# regressor = make_pipeline(\n# StandardScaler(), \n# SGDRegressor(alpha=0.01, learning_rate=\"constant\", eta0=0.001),\n# )\n# start = time.perf_counter_ns()\nregressor.fit(x_train, y_train.squeeze())\n# end = time.perf_counter_ns()\n# print(\"SGD:\", (end - start) / 1e6, \"ms\")",
"_____no_output_____"
],
[
"y_pred = regressor.predict(x_eval)",
"_____no_output_____"
],
[
"print(\"MSE:\", mean_squared_error(y_pred, y_eval))",
"MSE: 16.351442080312363\n"
]
],
[
[
"## Cost decay comparison",
"_____no_output_____"
],
[
"### Prepare data",
"_____no_output_____"
]
],
[
[
"parallel_cost = load_matrix(\"output/parallel_cost.csv\", verbose=False)\nserial_cost = load_matrix(\"output/serial_cost.csv\", verbose=False)\n\nnum_parallel = parallel_cost.shape[0]\nnum_serial = serial_cost.shape[0]\n\nserial_idxs = np.arange(num_serial)\nparallel_idxs = np.linspace(0, num_serial, num_parallel)",
"_____no_output_____"
]
],
[
[
"### Plot",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(18, 9))\nplt.plot(parallel_idxs, parallel_cost, color=\"red\", label=\"parallel\")\nplt.plot(serial_idxs, serial_cost, color=\"blue\", label=\"serial\")\nplt.legend()\nplt.xlabel(\"Epoch\")\nplt.ylabel(\"Cost\")\nplt.show()",
"_____no_output_____"
]
],
[
[
"## Benchmark",
"_____no_output_____"
]
],
[
[
"!python demo/benchmark.py -h",
"SGD benchmark\n\npositional arguments:\n binary path to C++ gradient descent project executable\n\noptions:\n -h, --help show this help message and exit\n -c , --config path to benchmark JSON config file (default: None)\n -s , --serial-config \n path to serial SGD INI config file (default: None)\n -p , --parallel-config \n path to parallel SGD INI config file (default: None)\n -t , --temp-dir path to temporary dir that will be removed after\n extection (default: benchmark_data)\n"
],
[
"!cat examples/benchmark_config.json",
"{\n \"data\": {\n \"param_set\": [\n {\"num-train\": 2000, \"num-features\": 25},\n {\"num-train\": 5000, \"num-features\": 50},\n {\"num-train\": 10000, \"num-features\": 100}\n ]\n },\n \"sgd\": {\n \"param_set\": [\n {\"num-threads\": 15, \"num-step-epochs\": 100},\n {\"num-threads\": 23, \"num-step-epochs\": 100}\n ],\n \"param_space\": {\n \"num-threads\": [3, 7, 11],\n \"num-step-epochs\": [10, 100]\n }\n }\n}"
],
[
"!python demo/benchmark.py build/bin/gradient_descent \\\n --serial-config examples/serial_config.cfg \\\n --parallel-config examples/parallel_config.cfg \\\n --config examples/benchmark_config.json",
"Data params: num-train=2000, num-features=25\nSerial (): 243.0\nParallel (num-threads=15, num-step-epochs=100): 78.0\nParallel (num-threads=23, num-step-epochs=100): 68.0\nParallel (num-threads=3, num-step-epochs=10): 173.0\nParallel (num-threads=3, num-step-epochs=100): 137.0\nParallel (num-threads=7, num-step-epochs=10): 124.0\nParallel (num-threads=7, num-step-epochs=100): 104.0\nParallel (num-threads=11, num-step-epochs=10): 275.0\nParallel (num-threads=11, num-step-epochs=100): 59.0\nData params: num-train=5000, num-features=50\nSerial (): 993.0\nParallel (num-threads=15, num-step-epochs=100): 267.0\nParallel (num-threads=23, num-step-epochs=100): 210.0\nParallel (num-threads=3, num-step-epochs=10): 444.0\nParallel (num-threads=3, num-step-epochs=100): 372.0\nParallel (num-threads=7, num-step-epochs=10): 436.0\nParallel (num-threads=7, num-step-epochs=100): 349.0\nParallel (num-threads=11, num-step-epochs=10): 431.0\nParallel (num-threads=11, num-step-epochs=100): 237.0\nData params: num-train=10000, num-features=100\nSerial (): 7676.0\nParallel (num-threads=15, num-step-epochs=100): 1263.0\nParallel (num-threads=23, num-step-epochs=100): 1146.0\nParallel (num-threads=3, num-step-epochs=10): 3919.0\nParallel (num-threads=3, num-step-epochs=100): 2683.0\nParallel (num-threads=7, num-step-epochs=10): 2633.0\nParallel (num-threads=7, num-step-epochs=100): 1736.0\nParallel (num-threads=11, num-step-epochs=10): 2321.0\nParallel (num-threads=11, num-step-epochs=100): 1425.0\n"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
]
|
cb6bb731f72b936451f15d946c6fec34b648c097 | 25,419 | ipynb | Jupyter Notebook | workspace/02-exploration.ipynb | QuantumDamage/AQIP | cab2ffb63e8512d9f4977c42687eefdbfa06afeb | [
"Apache-2.0"
]
| null | null | null | workspace/02-exploration.ipynb | QuantumDamage/AQIP | cab2ffb63e8512d9f4977c42687eefdbfa06afeb | [
"Apache-2.0"
]
| null | null | null | workspace/02-exploration.ipynb | QuantumDamage/AQIP | cab2ffb63e8512d9f4977c42687eefdbfa06afeb | [
"Apache-2.0"
]
| null | null | null | 28.211987 | 156 | 0.406035 | [
[
[
"import pandas as pd\nimport numpy as np",
"_____no_output_____"
],
[
"%matplotlib inline",
"_____no_output_____"
],
[
"if 'bigDataFrame' in globals():\n print(\"Exist, do nothing!\")\nelse:\n print(\"Read data.\")\n bigDataFrame = pd.read_pickle(\"../output/bigDataFrame.pkl\")\n bigDataFrame.rename(columns={\"PM2.5\": \"PM25\"}, inplace=True)",
"Exist, do nothing!\n"
],
[
"bigDataFrame.head()",
"_____no_output_____"
],
[
"pollutedPlaces = bigDataFrame['2015-01-01 00:00:00':'2015-12-31 23:00:00'].idxmax()\nprint(pollutedPlaces)\npollutedPlaces = set([x[1] for x in pollutedPlaces])",
"C6H6 (2015-10-28 06:00:00, OpKKozBSmial)\nCO (2015-02-15 00:00:00, SlRybniBorki)\nNO2 (2015-11-07 10:00:00, PmStaGdaLubi)\nO3 (2015-07-04 12:00:00, LuZarySzyman)\nPM10 (2015-12-31 20:00:00, SlRybniBorki)\nPM25 (2015-03-22 23:00:00, MzLegZegrzyn)\nSO2 (2015-05-21 23:00:00, MzPlocKroJad)\ndtype: object\n"
],
[
"pollutedPlaces",
"_____no_output_____"
],
[
"#reducedDataFrame = bigDataFrame['2015-01-01 00:00:00':'2015-12-31 23:00:00'].loc[(slice(None),pollutedPlaces), :]",
"_____no_output_____"
],
[
"reducedDataFrame = bigDataFrame['2015-01-01 00:00:00':'2015-12-31 23:00:00'].loc[(slice(None), slice(None)), :]",
"_____no_output_____"
],
[
"hours = len(reducedDataFrame.index.get_level_values(\"Hour\").unique())",
"_____no_output_____"
],
[
"def C6H6qual (value):\n if (value < 0.0):\n return np.NaN\n elif (value >= 0.0 and value <= 5.0):\n return \"1 Very good\"\n elif (value > 5.0 and value <= 10.0):\n return \"2 Good\"\n elif (value > 10.0 and value <= 15.0):\n return \"3 Moderate\"\n elif (value > 15.0 and value <= 20.0):\n return \"4 Sufficient\"\n elif (value > 20.0 and value <= 50.0):\n return \"5 Bad\"\n elif (value > 50.0):\n return \"6 Very bad\"\n else:\n return value\n\ndef COqual (value):\n if (value < 0.0):\n return np.NaN\n elif (value >= 0.0 and value <= 2.0):\n return \"1 Very good\"\n elif (value > 2.0 and value <= 6.0):\n return \"2 Good\"\n elif (value > 6.0 and value <= 10.0):\n return \"3 Moderate\"\n elif (value > 10.0 and value <= 14.0):\n return \"4 Sufficient\"\n elif (value > 14.0 and value <= 20.0):\n return \"5 Bad\"\n elif (value > 20.0):\n return \"6 Very bad\"\n else:\n return value\n \ndef NO2qual (value):\n if (value < 0.0):\n return np.NaN\n elif (value >= 0.0 and value <= 40.0):\n return \"1 Very good\"\n elif (value > 40.0 and value <= 100.0):\n return \"2 Good\"\n elif (value > 100.0 and value <= 150.0):\n return \"3 Moderate\"\n elif (value > 150.0 and value <= 200.0):\n return \"4 Sufficient\"\n elif (value > 200.0 and value <= 400.0):\n return \"5 Bad\"\n elif (value > 400.0):\n return \"6 Very bad\"\n else:\n return value \n\ndef O3qual (value):\n if (value < 0.0):\n return np.NaN\n elif (value >= 0.0 and value <= 30.0):\n return \"1 Very good\"\n elif (value > 30.0 and value <= 70.0):\n return \"2 Good\"\n elif (value > 70.0 and value <= 120.0):\n return \"3 Moderate\"\n elif (value > 120.0 and value <= 160.0):\n return \"4 Sufficient\"\n elif (value > 160.0 and value <= 240.0):\n return \"5 Bad\"\n elif (value > 240.0):\n return \"6 Very bad\"\n else:\n return value\n \ndef PM10qual (value):\n if (value < 0.0):\n return np.NaN\n elif (value >= 0.0 and value <= 20.0):\n return \"1 Very good\"\n elif (value > 20.0 and value <= 60.0):\n return \"2 Good\"\n elif (value > 60.0 and value <= 100.0):\n return \"3 Moderate\"\n elif (value > 100.0 and value <= 140.0):\n return \"4 Sufficient\"\n elif (value > 140.0 and value <= 200.0):\n return \"5 Bad\"\n elif (value > 200.0):\n return \"6 Very bad\"\n else:\n return value\n \ndef PM25qual (value):\n if (value < 0.0):\n return np.NaN\n elif (value >= 0.0 and value <= 12.0):\n return \"1 Very good\"\n elif (value > 12.0 and value <= 36.0):\n return \"2 Good\"\n elif (value > 36.0 and value <= 60.0):\n return \"3 Moderate\"\n elif (value > 60.0 and value <= 84.0):\n return \"4 Sufficient\"\n elif (value > 84.0 and value <= 120.0):\n return \"5 Bad\"\n elif (value > 120.0):\n return \"6 Very bad\"\n else:\n return value\n \ndef SO2qual (value):\n if (value < 0.0):\n return np.NaN\n elif (value >= 0.0 and value <= 50.0):\n return \"1 Very good\"\n elif (value > 50.0 and value <= 100.0):\n return \"2 Good\"\n elif (value > 100.0 and value <= 200.0):\n return \"3 Moderate\"\n elif (value > 200.0 and value <= 350.0):\n return \"4 Sufficient\"\n elif (value > 350.0 and value <= 500.0):\n return \"5 Bad\"\n elif (value > 500.0):\n return \"6 Very bad\"\n else:\n return value",
"_____no_output_____"
],
[
"descriptiveFrame = pd.DataFrame()",
"_____no_output_____"
],
[
"for pollutant in bigDataFrame.columns:\n reducedDataFrame[pollutant+\".desc\"] = reducedDataFrame[pollutant].apply(lambda x: globals()[pollutant+\"qual\"](x))\n tmpseries = reducedDataFrame.groupby(level=\"Station\")[pollutant+\".desc\"].value_counts(dropna = False).apply(lambda x: (x/float(hours))*100)\n descriptiveFrame = pd.concat([descriptiveFrame, tmpseries], axis=1)",
"_____no_output_____"
],
[
"qualities = sorted(descriptiveFrame.index.get_level_values(1).unique().tolist())",
"_____no_output_____"
],
[
"for quality in qualities:\n reducedDataFrame.loc[(reducedDataFrame[[\"C6H6.desc\", \"CO.desc\", \"NO2.desc\", \"O3.desc\", \"PM10.desc\", \n \"PM25.desc\", \"SO2.desc\"]] == quality).any(axis=1),\"overall\"] = quality",
"_____no_output_____"
],
[
"descriptiveFrame.columns = bigDataFrame.columns",
"_____no_output_____"
],
[
"overall = reducedDataFrame.groupby(level=\"Station\")[\"overall\"].value_counts(dropna = \n False).apply(lambda x: (x/float(hours))*100)\ndescriptiveFrame = pd.concat([descriptiveFrame, overall], axis=1)\ndescriptiveFrame.rename(columns={0: \"overall\"}, inplace=True)",
"_____no_output_____"
],
[
"worstPlace = descriptiveFrame.xs('6 Very bad', level=1)[\"overall\"].idxmax()\nbestPlace = descriptiveFrame.xs('1 Very good', level=1)[\"overall\"].idxmax()",
"_____no_output_____"
],
[
"descriptiveFrame.xs(worstPlace, level=0)",
"_____no_output_____"
],
[
"descriptiveFrame.xs(bestPlace, level=0)",
"_____no_output_____"
],
[
"worstPlace, bestPlace",
"_____no_output_____"
]
],
[
[
"# Part for Tricity and Kashubia",
"_____no_output_____"
]
],
[
[
"stations = pd.read_excel(\"../input/Metadane_wer20160914.xlsx\")\ncoolStation = [u'Gdańsk', u'Gdynia', u'Sopot', u'Kościerzyna']\nselectedStations = stations[stations[u'Miejscowość'].isin(coolStation)]\nstationCodes = set(list(selected_stations[u'Kod stacji'].values) + list(selected_stations[u'Stary Kod stacji'].values))",
"_____no_output_____"
],
[
"reducedDataFrame = bigDataFrame['2015-01-01 01:00:00':'2016-01-01 00:00:00'].loc[(slice(None),stationCodes), :]",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb6bba71d0fe366bebe5cdfc47cf1603daafc079 | 8,242 | ipynb | Jupyter Notebook | practice/graphs/Longest Palindromic Sequence.ipynb | ssi112/data-structures-algorithms | e9bdfa4f41b5dd68b3227151084a8c0115bac8b8 | [
"MIT"
]
| 15 | 2019-10-09T16:59:43.000Z | 2022-03-25T22:35:56.000Z | practice/graphs/Longest Palindromic Sequence.ipynb | adad20/data-structures-algorithms | e9bdfa4f41b5dd68b3227151084a8c0115bac8b8 | [
"MIT"
]
| null | null | null | practice/graphs/Longest Palindromic Sequence.ipynb | adad20/data-structures-algorithms | e9bdfa4f41b5dd68b3227151084a8c0115bac8b8 | [
"MIT"
]
| 13 | 2019-10-09T15:27:02.000Z | 2021-04-17T10:00:53.000Z | 30.639405 | 324 | 0.543679 | [
[
[
"# Longest Palindromic Subsequence\n\nIn this notebook, you'll be tasked with finding the length of the *Longest Palindromic Subsequence* (LPS) given a string of characters.\n\nAs an example:\n* With an input string, `ABBDBCACB`\n* The LPS is `BCACB`, which has `length = 5`\n\nIn this notebook, we'll focus on finding an optimal solution to the LPS task, using dynamic programming. There will be some similarities to the Longest Common Subsequence (LCS) task, which is outlined in detail in a previous notebook. It is recommended that you start with that notebook before trying out this task.\n\n### Hint\n**Storing pre-computed values**\n\nThe LPS algorithm depends on looking at one string and comparing letters to one another. Similar to how you compared two strings in the LCS (Longest Common Subsequence) task, you can compare the characters in just *one* string with one another, using a matrix to store the results of matching characters.\n\n\nFor a string on length n characters, you can create an `n x n` matrix to store the solution to subproblems. In this case, the subproblem is the length of the longest palindromic subsequence, up to a certain point in the string (up to the end of a certain substring).\n\nIt may be helpful to try filling up a matrix on paper before you start your code solution. If you get stuck with this task, you may look at some example matrices below (see the section titled **Example matrices**), before consulting the complete solution code.\n",
"_____no_output_____"
]
],
[
[
"# imports for printing a matrix, nicely\nimport pprint\npp = pprint.PrettyPrinter()\n\n# complete LPS solution\ndef lps(input_string): \n n = len(input_string) \n \n # create a lookup table to store results of subproblems \n L = [[0 for x in range(n)] for x in range(n)] \n \n # strings of length 1 have LPS length = 1\n for i in range(n): \n L[i][i] = 1 \n \n # consider all substrings\n for s_size in range(2, n+1): \n for start_idx in range(n-s_size+1): \n end_idx = start_idx + s_size - 1\n if s_size == 2 and input_string[start_idx] == input_string[end_idx]:\n # match with a substring of length 2\n L[start_idx][end_idx] = 2\n elif input_string[start_idx] == input_string[end_idx]: \n # general match case\n L[start_idx][end_idx] = L[start_idx+1][end_idx-1] + 2\n else:\n # no match case, taking the max of two values\n L[start_idx][end_idx] = max(L[start_idx][end_idx-1], L[start_idx+1][end_idx]); \n \n # debug line\n # pp.pprint(L)\n \n return L[0][n-1] # value in top right corner of matrix",
"_____no_output_____"
],
[
"def test_function(test_case):\n string = test_case[0]\n solution = test_case[1]\n output = lps(string)\n print(output)\n if output == solution:\n print(\"Pass\")\n else:\n print(\"Fail\")",
"_____no_output_____"
],
[
"string = \"TACOCAT\"\nsolution = 7\ntest_case = [string, solution]\ntest_function(test_case)",
"7\nPass\n"
],
[
"string = 'BANANA'\nsolution = 5\ntest_case = [string, solution]\ntest_function(test_case)",
"5\nPass\n"
],
[
"string = 'BANANO'\nsolution = 3\ntest_case = [string, solution]\ntest_function(test_case)",
"3\nPass\n"
]
],
[
[
"### Example matrices\n\nExample LPS Subproblem matrix 1:\n\n```\ninput_string = 'BANANO'\n\nLPS subproblem matrix:\n \n B A N A N O\nB [[1, 1, 1, 3, 3, 3],\nA [0, 1, 1, 3, 3, 3],\nN [0, 0, 1, 1, 3, 3],\nA [0, 0, 0, 1, 1, 1],\nN [0, 0, 0, 0, 1, 1],\nO [0, 0, 0, 0, 0, 1]]\n\nLPS length: 3\n```\n\nExample LPS Subproblem matrix 2:\n```\ninput_string = 'TACOCAT'\n\nLPS subproblem matrix:\n\n T A C O C A T\nT [[1, 1, 1, 1, 3, 5, 7],\nA [0, 1, 1, 1, 3, 5, 5],\nC [0, 0, 1, 1, 3, 3, 3],\nO [0, 0, 0, 1, 1, 1, 1],\nC [0, 0, 0, 0, 1, 1, 1],\nA [0, 0, 0, 0, 0, 1, 1],\nT [0, 0, 0, 0, 0, 0, 1]]\n\nLPS length: 7\n```\n\nNote: The lower diagonal values will remain 0 in all cases.\n\n### The matrix rules\n\nYou can efficiently fill up this matrix one cell at a time. Each grid cell only depends on the values in the grid cells that are directly on bottom and to the left of it, or on the diagonal/bottom-left. The rules are as follows:\n* Start with an `n x n ` matrix where n is the number of characters in a given string; the diagonal should all have the value 1 for the base case, the rest can be zeros.\n* As you traverse your string:\n * If there is a match, fill that grid cell with the value to the bottom-left of that cell *plus* two.\n * If there is not a match, take the *maximum* value from either directly to the left or the bottom cell, and carry that value over to the non-match cell.\n* After completely filling the matrix, **the top-right cell will hold the final LPS length**.",
"_____no_output_____"
],
[
"<span class=\"graffiti-highlight graffiti-id_d28fhk7-id_3yrlf09\"><i></i><button>Show Solution</button></span>",
"_____no_output_____"
],
[
"### Complexity\n\nWhat was the complexity of this?\n\nIn the solution, we are looping over the elements of our `input_string` using two `for` loops; these are each of $O(N)$ and nested this becomes $O(N^2)$. This behavior dominates our optimized solution.",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
]
]
|
cb6bd26df14dbcbe57740e89dc42c5cdf60fb72e | 118,924 | ipynb | Jupyter Notebook | tutorials/00_pool_getting_started.ipynb | LukasLuehrs/scikit-activeml | 04d7107272ef0438070808475599131d8726f547 | [
"BSD-3-Clause"
]
| null | null | null | tutorials/00_pool_getting_started.ipynb | LukasLuehrs/scikit-activeml | 04d7107272ef0438070808475599131d8726f547 | [
"BSD-3-Clause"
]
| null | null | null | tutorials/00_pool_getting_started.ipynb | LukasLuehrs/scikit-activeml | 04d7107272ef0438070808475599131d8726f547 | [
"BSD-3-Clause"
]
| null | null | null | 417.277193 | 27,763 | 0.940517 | [
[
[
"# Pool-based Active Learning - Getting Started",
"_____no_output_____"
],
[
"The main purpose of this tutorial is to ease the implementation of our library `scikit-activeml` to new users. `scikit-activeml` is a library that executes the most important query strategies. It is built upon the well-known machine learning frame-work `scikit-learn`, which makes it user-friendly. For better understanding, we show an exemplary active learning cycle here. Let's start by importing the relevant packages from both `scikit-learn` and `scikit-activeml`.",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.datasets import make_classification\n\nfrom skactiveml.classifier import SklearnClassifier\nfrom skactiveml.pool import UncertaintySampling\nfrom skactiveml.utils import unlabeled_indices, labeled_indices, MISSING_LABEL\nfrom skactiveml.visualization import plot_decision_boundary, plot_utilities\n\nimport warnings\nwarnings.filterwarnings(\"ignore\")",
"_____no_output_____"
]
],
[
[
"## Data Set Generation\nWe generate a data set of 100 data points with two clusters from the `make_classification` method of `scikit-learn`. This method also returns the true labels of each data point. In practice, however, we do not know these labels unless we ask an oracle. The labels are stored in `y_true`, which acts as an oracle.",
"_____no_output_____"
]
],
[
[
"X, y_true = make_classification(n_features=2, n_redundant=0, random_state=0)\nbound = [[min(X[:, 0]), min(X[:, 1])], [max(X[:, 0]), max(X[:, 1])]]\nplt.scatter(X[:, 0], X[:, 1], c=y_true, cmap='jet')\nplt.xlabel('Feature 1')\nplt.ylabel('Feature 2')\nplt.title('Data set');",
"_____no_output_____"
]
],
[
[
"## Classification\nOur goal is to classify the data points into two classes. To do so, we introduce a vector `y` to store the labels that we acquire from the oracle (`y_true`). As shown below, the vector `y` is unlabeled at the beginning.",
"_____no_output_____"
]
],
[
[
"y = np.full(shape=y_true.shape, fill_value=MISSING_LABEL)\nprint(y)",
"[nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan\n nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan\n nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan\n nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan\n nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan\n nan nan nan nan nan nan nan nan nan nan]\n"
]
],
[
[
"There are many easy-to-use classification algorithms in `scikit-learn`. In this example, we use the logistic regression classifier. Details of other classifiers can be accessed from here: https://scikit-activeml.readthedocs.io/en/latest/api/classifier.html. As `scikit-learn` classifiers cannot cope with missing labels, we need to wrap these with the `SklearnClassifier`.",
"_____no_output_____"
]
],
[
[
"clf = SklearnClassifier(LogisticRegression(), classes=np.unique(y_true))",
"_____no_output_____"
]
],
[
[
"## Query Strategy\nThe query strategies are the central part of our library. In this example, we use uncertainty sampling with entropy to determine the most uncertain data points. All implemented strategies can be accessed from here: https://scikit-activeml.readthedocs.io/en/latest/api/pool.html.",
"_____no_output_____"
]
],
[
[
"qs = UncertaintySampling(method='entropy', random_state=42)",
"_____no_output_____"
]
],
[
[
"## Active Learning Cycle\nIn this example, we perform 20 iterations of the active learning cycle (`n_cycles=20`). In each iteration, we select one unlabeled sample to be labeled (`batch_size=1`). The sample is selected by an index (`query_idx`).\n\nThe label is acquired by assigning the label from `y_true` to `y`. Then we retrain our classifier. We continue until we reach the 20 labeled data points.\nBelow, we see the implementation of an active learning cycle. The first figure shows the decision boundary after acquiring the label of two data points. The second figure shows the decision boundary with 10 acquired labels, which shows significant improvement compared to the first figure. The last figure shows the decision boundary after acquiring labels for 20 data points. Finally, we use the accuracy score as a performance measure, which shows the accuracy of our classifier in the specified iterations.",
"_____no_output_____"
]
],
[
[
"n_cycles = 20\ny = np.full(shape=y_true.shape, fill_value=MISSING_LABEL)\nclf.fit(X, y)\nfor c in range(n_cycles):\n query_idx = qs.query(X=X, y=y, clf=clf, batch_size=1)\n y[query_idx] = y_true[query_idx]\n clf.fit(X, y)\n\n # plotting\n unlbld_idx = unlabeled_indices(y)\n lbld_idx = labeled_indices(y)\n if len(lbld_idx) in [2, 10, 20]:\n print(f'After {len(lbld_idx)} iterations:')\n print(f'The accuracy score is {clf.score(X,y_true)}.')\n plot_utilities(qs, X=X, y=y, clf=clf, feature_bound=bound)\n plot_decision_boundary(clf, feature_bound=bound)\n plt.scatter(X[unlbld_idx,0], X[unlbld_idx,1], c='gray')\n plt.scatter(X[:,0], X[:,1], c=y, cmap='jet')\n plt.show()",
"After 2 iterations:\nThe accuracy score is 0.68.\nAfter 10 iterations:\nThe accuracy score is 0.95.\nAfter 20 iterations:\nThe accuracy score is 0.94.\n"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
]
|
cb6bdaa8cee761c0bcd10b453abaa28c1c473719 | 115,784 | ipynb | Jupyter Notebook | SDE Integrator - Random Walk.ipynb | sandeshkalantre/general-physics-sims | 92289e464af011ae0ebb8b27e7480a6c7360f8f1 | [
"MIT"
]
| null | null | null | SDE Integrator - Random Walk.ipynb | sandeshkalantre/general-physics-sims | 92289e464af011ae0ebb8b27e7480a6c7360f8f1 | [
"MIT"
]
| null | null | null | SDE Integrator - Random Walk.ipynb | sandeshkalantre/general-physics-sims | 92289e464af011ae0ebb8b27e7480a6c7360f8f1 | [
"MIT"
]
| null | null | null | 516.892857 | 44,044 | 0.939301 | [
[
[
"# SDE Integrator - Random Walk\nI want to write a stochastic ODE integrator for the following differential equation,\n\n$$ \\frac{dX}{dt} = \\sigma W_t $$\n\nwhere $W_t$ is a Weiner process. Numerically, I want to reproduce $\\langle X^2 \\rangle = \\sigma^2 t$ where the averaging is over different realizations of the noise.",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\n%matplotlib inline\nfrom numba import jit,njit",
"_____no_output_____"
]
],
[
[
"## Euler-Maruyama Integrator",
"_____no_output_____"
]
],
[
[
"@njit\ndef euler_maruyama(t_vec,y_0,sigma):\n '''\n Integrate using the Euler-Maruyama first order method with the noise term\n Returns y of length len(t_vec). It is assumed that t_vec[0] = 0 for which y = y_0\n '''\n res = np.zeros(len(t_vec))\n dt = abs(t_vec[1] - t_vec[0])\n noise_terms = np.random.normal(loc=0,scale = np.sqrt(dt),size=t_vec.shape[0])\n res[0] = y_0\n for i in range(1,len(t_vec)):\n y_old = res[i-1]\n y_new = y_old + sigma*noise_terms[i]\n res[i] = y_new\n return res",
"_____no_output_____"
],
[
"t_vec = np.linspace(0,10000,1000)\nsigma = 0.1\ny_0 = 0\ny_vec= euler_maruyama(t_vec,y_0,sigma)",
"27.4 µs ± 695 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n"
],
[
"plt.figure(dpi=120)\nplt.plot(t_vec,y_vec,'b')\nplt.xlabel(r\"Time $(t)$\",fontsize=14)\nplt.ylabel(r\"$X(t)$\",fontsize=14)\nplt.title(r\"$\\sigma = $\" + \"{:.1e}\".format(sigma))\nplt.grid(True)",
"_____no_output_____"
]
],
[
[
"## Averaging over Sim. Runs",
"_____no_output_____"
]
],
[
[
"N_runs = 10000\nsigma = 0.5\ny_0 = 0\n\nt_vec = np.linspace(0,100,1000)\nX_arr = np.zeros((N_runs,len(t_vec)))\n\nfor ind in range(N_runs):\n y_vec= euler_maruyama(t_vec,y_0,sigma)\n X_arr[ind] = y_vec",
"_____no_output_____"
],
[
"X_avg = np.mean(X_arr,axis=0)\nX_var = np.std(X_arr,axis=0)**2",
"_____no_output_____"
],
[
"plt.figure(dpi=120)\nplt.plot(t_vec,X_avg,'b')\nplt.xlabel(r\"Time $(t)$\",fontsize=14)\nplt.ylabel(r\"$\\langle X(t) \\rangle$\",fontsize=14)\nplt.title(r\"$\\sigma = $\" + \"{:.1e}\".format(sigma))\nplt.grid(True)",
"_____no_output_____"
],
[
"plt.figure(dpi=100)\nplt.plot(t_vec,X_var,'b')\nplt.plot(t_vec,sigma**2*t_vec,color='orchid',linestyle='--')\nplt.xlabel(r\"Time $(t)$\",fontsize=14)\nplt.ylabel(r\"$\\langle X^2(t) \\rangle$\",fontsize=14)\nplt.title(r\"$\\sigma = $\" + \"{:.1e}\".format(sigma))\nplt.grid(True)",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
]
]
|
cb6bdf0daad4620b9671c5bca3b5072fe0bd9167 | 5,615 | ipynb | Jupyter Notebook | notebooks/1_anslag_c.ipynb | datastory-org/budgets-sweden | b74280dc6c712e0a99e010e88eb870337a6c0aa9 | [
"MIT"
]
| 6 | 2021-11-10T19:22:58.000Z | 2021-11-27T04:37:57.000Z | notebooks/1_anslag_c.ipynb | datastory-org/budgets-sweden | b74280dc6c712e0a99e010e88eb870337a6c0aa9 | [
"MIT"
]
| null | null | null | notebooks/1_anslag_c.ipynb | datastory-org/budgets-sweden | b74280dc6c712e0a99e010e88eb870337a6c0aa9 | [
"MIT"
]
| null | null | null | 28.358586 | 106 | 0.524488 | [
[
[
"# Centerpartiets budgetmotion 2022\n\nhttps://www.riksdagen.se/sv/dokument-lagar/dokument/motion/centerpartiets-budgetmotion-2022_H9024121",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport requests\n\npd.options.mode.chained_assignment = None",
"_____no_output_____"
],
[
"multiplier = 1_000_000",
"_____no_output_____"
],
[
"docs = [\n {'utgiftsområde': 1, 'dok_id': 'H9024141'},\n {'utgiftsområde': 2, 'dok_id': 'H9024140'},\n {'utgiftsområde': 3, 'dok_id': 'H9024142'},\n {'utgiftsområde': 4, 'dok_id': 'H9024143'},\n {'utgiftsområde': 5, 'dok_id': 'H9024144'},\n {'utgiftsområde': 6, 'dok_id': 'H9024145'},\n {'utgiftsområde': 7, 'dok_id': 'H9024146'},\n {'utgiftsområde': 8, 'dok_id': 'H9024147'},\n {'utgiftsområde': 9, 'dok_id': 'H9024128'},\n {'utgiftsområde': 10, 'dok_id': 'H9024148'},\n {'utgiftsområde': 11, 'dok_id': 'H9024149'},\n {'utgiftsområde': 12, 'dok_id': 'H9024150'},\n {'utgiftsområde': 13, 'dok_id': 'H9024127'},\n {'utgiftsområde': 14, 'dok_id': 'H9024129'},\n {'utgiftsområde': 15, 'dok_id': 'H9024125'},\n {'utgiftsområde': 16, 'dok_id': 'H9024126'},\n {'utgiftsområde': 17, 'dok_id': 'H9024130'},\n {'utgiftsområde': 18, 'dok_id': 'H9024122'},\n {'utgiftsområde': 19, 'dok_id': 'H9024123'},\n {'utgiftsområde': 20, 'dok_id': 'H9024124'},\n {'utgiftsområde': 21, 'dok_id': 'H9024136'},\n {'utgiftsområde': 22, 'dok_id': 'H9024135'},\n {'utgiftsområde': 23, 'dok_id': 'H9024134'},\n {'utgiftsområde': 24, 'dok_id': 'H9024133'},\n {'utgiftsområde': 25, 'dok_id': 'H9024132'}]",
"_____no_output_____"
],
[
"def find_matching_table(tables, loc=None):\n if loc:\n return tables[loc]\n for table in tables:\n if table.columns.shape == (5,):\n break\n return table",
"_____no_output_____"
],
[
"def fetch_table(url, area):\n tables = pd.read_html(url, encoding='utf8', header=2)\n cols = ['Anslag', 'Namn', '2022', '2023', '2024']\n loc = 3 if area in [14, 24] else None\n df = find_matching_table(tables, loc)\n df.columns = cols\n df = df.dropna(how='all')\n df = df[~df.Anslag.str.startswith('Summa', na=False)]\n df['Utgiftsområde'] = area\n return df",
"_____no_output_____"
],
[
"tables = []\n\nfor doc in docs:\n url = f'http://data.riksdagen.se/dokument/{doc[\"dok_id\"]}.html'\n table = fetch_table(url, area=doc['utgiftsområde'])\n tables.append(table)",
"_____no_output_____"
],
[
"df = pd.concat(tables, sort=False)",
"_____no_output_____"
],
[
"df = df.dropna(how='all')",
"_____no_output_____"
],
[
"for col in ['2022', '2023', '2024']:\n df[col] = df[col].astype(str)\n df[col] = df[col].str.split('.', expand=True)[0]\n df[col] = df[col].str.replace('±0', '0', regex=False)\n df[col] = df[col].str.replace('\\s+', '', regex=True)\n df[col] = df[col].str.replace('−', '-')\n df[col] = df[col].astype(int) * multiplier",
"_____no_output_____"
],
[
"df.to_csv('../data/budgetmotion-2022-c.csv', index=False)",
"_____no_output_____"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6bdf75a95e750935a8c4ff30d9d3263332aa02 | 177,433 | ipynb | Jupyter Notebook | ch10.ipynb | jazzlly/pydata-book | 3298740cbfb5bdb10b73486fa80a23fbf6b5c085 | [
"MIT"
]
| null | null | null | ch10.ipynb | jazzlly/pydata-book | 3298740cbfb5bdb10b73486fa80a23fbf6b5c085 | [
"MIT"
]
| null | null | null | ch10.ipynb | jazzlly/pydata-book | 3298740cbfb5bdb10b73486fa80a23fbf6b5c085 | [
"MIT"
]
| null | null | null | 49.150416 | 2,779 | 0.463493 | [
[
[
"empty"
]
]
]
| [
"empty"
]
| [
[
"empty"
]
]
|
cb6be6f3e997ca5e8dbb228f617786af025080e7 | 800,436 | ipynb | Jupyter Notebook | notebooks/GUAM/GUAM/02_Nearshore/05_HySwash.ipynb | teslakit/teslak | 3f3dda08c5c5998cb2a7debbf22f2be675a4ff8b | [
"MIT"
]
| 12 | 2019-11-14T22:19:12.000Z | 2022-03-04T01:25:33.000Z | notebooks/GUAM/GUAM/02_Nearshore/05_HySwash.ipynb | anderdyl/teslaCoSMoS | 1495bfa2364ddbacb802d145b456a35213abfb7c | [
"MIT"
]
| 5 | 2020-03-24T18:21:41.000Z | 2021-08-23T20:39:43.000Z | notebooks/GUAM/GUAM/02_Nearshore/05_HySwash.ipynb | anderdyl/teslaCoSMoS | 1495bfa2364ddbacb802d145b456a35213abfb7c | [
"MIT"
]
| 2 | 2021-03-06T07:54:41.000Z | 2021-06-30T14:33:22.000Z | 295.363838 | 424,240 | 0.907347 | [
[
[
"## Plotting of profile results",
"_____no_output_____"
]
],
[
[
"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# common\nimport os\nimport os.path as op\n\n# pip\nimport numpy as np\nimport pandas as pd\nimport math\nimport xarray as xr\nimport matplotlib.pyplot as plt\nfrom matplotlib import gridspec\n\n# DEV: override installed teslakit\nimport sys\nsys.path.insert(0, op.join(os.path.abspath(''), '..', '..', '..'))\n\n# teslakit\nfrom teslakit.database import Database, hyswan_db\n\n# interactive widgets\nfrom ipywidgets import interact, interact_manual, interactive, HBox, Layout, VBox\nfrom ipywidgets import widgets\nfrom natsort import natsorted, ns\nfrom moviepy.editor import *\nfrom IPython.display import display, Image, Video\n\nsys.path.insert(0, op.join(os.getcwd(),'..'))\n\n# bluemath swash module (bluemath.DD.swash\n\npath_swash='/media/administrador/HD/Dropbox/Guam/wrapswash-1d'\nsys.path.append(path_swash)\nfrom lib.wrap import SwashProject, SwashWrap\nfrom lib.plots import SwashPlot\nfrom lib.io import SwashIO\nfrom lib.MDA import *\nfrom lib.RBF import *\n",
"_____no_output_____"
],
[
"def Plot_profile(profile):\n colors=['royalblue','crimson','gold','darkmagenta','darkgreen','darkorange','mediumpurple','coral','pink','lightgreen','darkgreen','darkorange']\n fig=plt.figure(figsize=[17,4])\n gs1=gridspec.GridSpec(1,1)\n ax=fig.add_subplot(gs1[0])\n\n ax.plot(profile.Distance_profile, -profile.Elevation,linewidth=3,color=colors[prf],alpha=0.7,label='Profile: ' + str(prf))\n s=np.where(profile.Elevation<0)[0][0]\n ax.plot(profile.Distance_profile[s],-profile.Elevation[s],'s',color=colors[prf],markersize=10)\n s=np.argmin(profile.Elevation.values)\n ax.plot(profile.Distance_profile[s],-profile.Elevation[s],'d',color=colors[prf],markersize=10)\n ax.plot([0,1500],[0,0],':',color='plum',alpha=0.7)\n \n ax.set_xlabel(r'Distance (m)', fontsize=14)\n ax.set_ylabel(r'Elevation (m)', fontsize=14)\n ax.legend()\n ax.set_xlim([0,np.nanmax(profile.Distance_profile)])\n ax.set_ylim(-profile.Elevation[0], -np.nanmin(profile.Elevation)+3)\n \ndef get_bearing(lat1,lon1,lat2,lon2):\n dLon = np.deg2rad(lon2) - np.deg2rad(lon1);\n y = math.sin(dLon) * math.cos(np.deg2rad(lat2));\n x = math.cos(np.deg2rad(lat1))*math.sin(np.deg2rad(lat2)) - math.sin(np.deg2rad(lat1))*math.cos(np.deg2rad(lat2))*math.cos(dLon);\n brng = np.rad2deg(math.atan2(y, x));\n if brng < 0: brng+= 360\n return brng",
"_____no_output_____"
],
[
"# --------------------------------------\n# Teslakit database\n\np_data = r'/media/administrador/HD/Dropbox/Guam/teslakit/data'\n# p_data=r'/Users/laurac/Dropbox/Guam/teslakit/data'\ndb = Database(p_data)\n\n# set site\ndb.SetSite('GUAM')\n\n#Define profile to run\nprf=11\n# sl=0 #Sea level",
"_____no_output_____"
],
[
"p_out = os.path.join(p_data, 'sites', 'GUAM','HYSWASH')\nif not os.path.exists(p_out): os.mkdir(p_out)\n\np_dataset = op.join(p_out, 'dataset_prf'+str(prf)+'.pkl')\np_subset = op.join(p_out, 'subset_prf'+str(prf)+'.pkl')\np_waves = op.join(p_out, 'waves_prf'+str(prf)+'.pkl')\nds_output = op.join(p_out, 'reconstruction_p{0}.nc'.format(prf))\n",
"_____no_output_____"
],
[
"# Create the project directory \np_proj = op.join(p_out, 'projects') # swash projects main directory\nn_proj = 'Guam_prf_{0}'.format(prf) # project name\n\nsp = SwashProject(p_proj, n_proj)\nsw = SwashWrap(sp)\nsi = SwashIO(sp)\nsm = SwashPlot(sp)",
"_____no_output_____"
]
],
[
[
"### Set profile and load data",
"_____no_output_____"
]
],
[
[
"min_depth=-20\n\nprofiles=xr.open_dataset('/media/administrador/HD/Dropbox/Guam/bati guam/Profiles_Guam_curt.nc')\nprofile=profiles.sel(profile=prf)\nprofile['Orientation']=get_bearing(profile.Lat[0],profile.Lon[0],profile.Lat[-1],profile.Lon[-1])\ns=np.where(profile.Elevation>min_depth)[0]\nprofile = xr.Dataset({'Lon': (['number_points'],np.flipud(profile.Lon[s])),\n 'Lat': (['number_points'],np.flipud(profile.Lat[s])),\n 'Elevation': (['number_points'],-np.flipud(profile.Elevation[s])),\n 'Distance_profile': (['number_points'],(profile.Distance_profile[s])),\n 'Rep_coast_distance': (profile.Rep_coast_distance),\n 'Orientation': (profile.Orientation),\n }, \n coords={'number_points': range(len(s)), \n })\nprint(profile)\nPlot_profile(profile)\n",
"<xarray.Dataset>\nDimensions: (number_points: 417)\nCoordinates:\n profile int64 11\n * number_points (number_points) int64 0 1 2 3 4 ... 412 413 414 415 416\nData variables:\n Lon (number_points) float64 144.7 144.7 ... 144.7 144.7\n Lat (number_points) float64 13.47 13.47 ... 13.47 13.47\n Elevation (number_points) float64 19.91 19.66 ... -1.259 -1.251\n Distance_profile (number_points) float64 0.0 0.7798 1.56 ... 323.6 324.4\n Rep_coast_distance int64 ...\n Orientation float64 353.5\n"
]
],
[
[
"### Cut profile after maximum",
"_____no_output_____"
]
],
[
[
"extra_positions=[25,28,7,25,-30,-9,-10,15,-22,12,20,18] #Cut profile at maximum + extra_positions\n\ns=np.argmin(profile.Elevation.values)\nprofile=profile.isel(number_points=range(s+extra_positions[prf]))\nprint(profile)\nPlot_profile(profile)\nprofile.to_netcdf(path=os.path.join(p_out,'Prf_'+str(prf)+'.nc'))",
"<xarray.Dataset>\nDimensions: (number_points: 327)\nCoordinates:\n profile int64 11\n * number_points (number_points) int64 0 1 2 3 4 ... 322 323 324 325 326\nData variables:\n Lon (number_points) float64 144.7 144.7 ... 144.7 144.7\n Lat (number_points) float64 13.47 13.47 ... 13.47 13.47\n Elevation (number_points) float64 19.91 19.66 ... -2.648 -2.603\n Distance_profile (number_points) float64 0.0 0.7798 1.56 ... 253.4 254.2\n Rep_coast_distance int64 ...\n Orientation float64 353.5\n"
]
],
[
[
"### Load waves",
"_____no_output_____"
],
[
"<span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">\nIn the following cell, the input paths are defined. The user must specified the path to the hydraulic boundary conditions, considering the wind forcing and sea conditions. For simplicity, those files must be in NetCDF format. </span>\n\n* `profile` <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> : profile id </span><br>\n\n* `sl`: <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> sea level (sl) with respect to msl</span> \n\n* `orientation`: <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> angle (º) between the</span> \n\n* `waves` <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> : significant wave height (Hs) and peak period (Tp). </span><br>\n\n* `wind`: <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> wind speed (W), wind direction (B) </span> \n",
"_____no_output_____"
]
],
[
[
"tp_lim=3\nSIM=pd.read_pickle(os.path.join(db.paths.site.SIMULATION.nearshore,'Simulations_profile_'+str(prf)))\nprint(len(SIM['Tp'][np.where(SIM['Tp']<=tp_lim)[0]]))\nSIM['Tp'][np.where(SIM['Tp']<=tp_lim)[0]]=tp_lim",
"4770962\n"
]
],
[
[
"## Keep 200 years of simulation for MDA",
"_____no_output_____"
]
],
[
[
"SIM=SIM.loc[np.where(SIM.time<(SIM.time[0]+len(np.unique(SIM.time))/5))[0],:]\nSIM=SIM.reset_index().drop(columns=['index'])\nSIM",
"_____no_output_____"
]
],
[
[
"### Load SLR",
"_____no_output_____"
]
],
[
[
"SLR=xr.open_dataset(db.paths.site.CLIMATE_CHANGE.slr_nc)\nsl=np.tile(SLR.SLR.values, (100,1))[:len(SIM)] #We repeat the level 100 times (10simulations of 1000 years)\nSIM['slr1']=sl[:,0]\nSIM['slr2']=sl[:,1]\nSIM['slr3']=sl[:,2]\nSIM",
"_____no_output_____"
],
[
"fig=plt.figure(figsize=[18,9])\nvars=['Hs','Tp','Dir','level','wind_dir','wind_speed']\nunits=[' (m)',' (s)',' (º)',' (m)',' (º)',' (m/s)']\n\ngs1=gridspec.GridSpec(2,3)\n\nfor a in range(len(vars)):\n ax=fig.add_subplot(gs1[a])\n ax.hist(SIM[vars[a]][:np.int(len(SIM)/100)],50,density=True,color='navy') #Plot a small fraction of data\n ax.set_xlabel(vars[a] + units[a],fontsize=13)",
"_____no_output_____"
]
],
[
[
"## **1. Clustering and selection method MDA**",
"_____no_output_____"
],
[
"<span style=\"font-family: times, Times New Roman; font-size:12pt; color:black; text-align: justify\">\nThe high computational cost of propagating the entire hindcast dataset requires statistical tools to reduce the set of data to a number of representative cases to perform hybrid downscaling. The maximum dissimilarity algorithm (MDA) defined in the work of Camus et al., 2011, is implemented for this purpose.<br>\n <br>\nGiven a data sample $X=\\{x_{1},x_{2},…,x_{N}\\}$ consisting of $N$ $n$-dimensional vectors, a subset of $M$ vectors $\\{v_{1},…,v_{M}\\}$ representing the diversity of the data is obtained by applying this algorithm. The selection starts initializing the subset by transferring one vector from the data sample ${v1}$. The rest of the $M-1$ elements are selected iteratively, calculating the dissimilarity between each remaining data in the database and the elements of the subset and transferring the most dissimilar one to the subset. The process finishes when the algorithm reaches $M$ iterations. \n\n \nThe MDA will be applied to 2 data sets, on the one hand, to the aggregated spectrum parameters and on the other hand to the spectrum partitions, differentiating seas and swells. In this way, the wind sea will have two added dimensions, wind speed and wind direction. \n<br> \nRepresentative variables for the different hydraulic boundary conditions:<br>\n <br>\n(1) Waves $H_{s}$, $T_p$<br>\n(2) Wind $W_{x}$<br>\n\n</span><br>",
"_____no_output_____"
],
[
"### **1.1 Data preproccesing**",
"_____no_output_____"
],
[
"<span style=\"font-family: times, Times New Roman; font-size:12pt; color:black; text-align: justify\">\n Select $H_{s}$, $T_p$, $W$, $W_{dir}$ from waves dataset and proyect wind velocity over the shore-cross profile (Wx). Unlike not being able to model the direction of the waves, Swash allows to model the wind direction. In order to reduce the MDA dimensions, working with the projected wind is desirable.\n</span><br>",
"_____no_output_____"
]
],
[
[
"# Dataset \n# waves = waves.squeeze()\nSIM = pd.DataFrame(\n {\n 'time': SIM.time.values,\n 'hs': SIM.Hs.values, \n 'tp': SIM.Tp.values, \n 'w':SIM.wind_speed.values,\n 'wdir': SIM.wind_dir.values,\n 'sl':SIM.level.values,\n 'slr1':SIM.slr1.values,\n 'slr2':SIM.slr2.values,\n 'slr3':SIM.slr3.values\n }\n)",
"_____no_output_____"
],
[
"#TEST WIND PROJECTION",
"_____no_output_____"
],
[
"# rel_beta=np.nanmin([np.abs(xds_states.wdir- profile.Orientation.values),np.abs(xds_states.wdir+360-profile.Orientation.values)],axis=0)\n# rel_beta[np.where(rel_beta>=90)[0]]=np.nan\n# rad_beta = (rel_beta*np.pi)/180\n# xds_states['wx'] = xds_states.w.values*np.cos(rad_beta)",
"_____no_output_____"
],
[
"# #Test that wind projection is right\n# pos_test=86281\n# print('Orientation: ' + str(profile.Orientation.values))\n# print('Wind speed: ' + str(xds_states.w[pos_test]))\n# print('Wind dir: ' + str(xds_states.wdir[pos_test]))\n# print('Beta relativo: ' + str(rel_beta[pos_test]))\n# print('Wind proyected: ' + str(xds_states.wx[pos_test]))",
"_____no_output_____"
],
[
"# Proyect wind direction over bathymetry orientation\n\n#Check wind is correctily projected\nSIM = proy_wind(profile.Orientation.values, SIM)",
"_____no_output_____"
],
[
"SIM=SIM.drop(columns=['time', 'w', 'wdir']).dropna().reset_index()\nSIM",
"_____no_output_____"
],
[
"dataset = pd.DataFrame(\n {\n 'hs': np.tile(SIM.hs,4),\n 'tp': np.tile(SIM.tp,4), \n 'wx': np.tile(SIM.wx,4), \n 'level':np.concatenate((SIM.sl,SIM.slr1+SIM.sl,SIM.slr2+SIM.sl,SIM.slr3+SIM.sl))\n }\n)",
"_____no_output_____"
],
[
"# dataset=np.column_stack((np.tile(SIM.hs,4),np.tile(SIM.tp,4),np.tile(SIM.wx,4),np.concatenate((SIM.sl,SIM.slr1+SIM.sl,SIM.slr2+SIM.sl,SIM.slr3+SIM.sl))))\n# print(len(dataset))\n# dataset",
"_____no_output_____"
],
[
"fig=plt.figure(figsize=[25,6])\ngs1=gridspec.GridSpec(1,1)\nax=fig.add_subplot(gs1[0])\n\nax.plot(SIM.slr3+SIM.sl,linewidth=0.4)\nax.plot(SIM.slr2+SIM.sl,linewidth=0.4)\nax.plot(SIM.slr1+SIM.sl,linewidth=0.4)\nax.plot(SIM.sl,linewidth=0.4)",
"_____no_output_____"
]
],
[
[
"### **1.2 MDA algorithm**",
"_____no_output_____"
]
],
[
[
"# dataset = SIM.drop(columns=['time', 'sl', 'w', 'wdir'])\n\n# data = np.array(dataset.dropna())[:,:]\n\n# subset, scalar and directional indexes\nix_scalar = [0, 1, 2, 3] # hs, tp, wx, level\nix_directional = [] # \nn_subset = 1500 # subset size\n\n# MDA algorithm\nout = MaxDiss_Simplified_NoThreshold(\n np.array(dataset), \n n_subset, \n ix_scalar, ix_directional\n)\n\nsubset = pd.DataFrame({'hs':out[:, 0],'tp':out[:, 1],'wx':out[:, 2],'level':out[:, 3]})\n\nprint(subset.info())\n\n# store dataset and subset\nSIM.to_pickle(p_dataset)\nsubset.to_pickle(p_subset)",
"\nMaxDiss waves parameters: 70126680 --> 1500\n\n MDA centroids: 1500/1500\n\n<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 1500 entries, 0 to 1499\nData columns (total 4 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 hs 1500 non-null float64\n 1 tp 1500 non-null float64\n 2 wx 1500 non-null float64\n 3 level 1500 non-null float64\ndtypes: float64(4)\nmemory usage: 47.0 KB\nNone\n"
],
[
"# Plot subset-dataset\nfig = scatter_mda(dataset.loc[np.arange(1,len(dataset),100),:], subset, names = ['Hs(m)', 'Tp(s)', 'Wx(m/s)', 'Level (m)'], figsize=(15,15))\nfig.savefig(op.join(p_out, 'mda_profile_'+str(prf)+'.png'),facecolor='w')",
"_____no_output_____"
]
],
[
[
"## **2. Numerical model SWASH**",
"_____no_output_____"
],
[
"### **2.1 Data preprocessing**",
"_____no_output_____"
],
[
"<span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">\n In this section, the computational grid is defined from the bathymetric data and, optionally, wave dissipation characteristics due to the bottom friction or vegetation. The input grids will be considered uniform and rectangular, with the computational grid covering the whole bathymetric region. <br>",
"_____no_output_____"
],
[
"#### **2.1.1 Cross-shore profile**",
"_____no_output_____"
],
[
"<span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">\n Model boundaries should be far enough from the area of interest and away from steep topography to avoid unrealistic frictional or numerical dispersion effects but close enough to remain computationally feasible </span> <span style=\"font-family: times, Times New Roman; font-size:11pt; color:black; background:whitesmoke\"> kh < 5. </span> </span> <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> As a recommendation, the area of interest should be kept at least two wave lengths away from the boundary. In the following cells, different input choices for defining the cross-shore profile will be given. </span>\n \n* `dxL` <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> : number of nodes per wavelength. This command sets the grid resolution from the number of nodes desired per wavelength in 1m depth (assuming that in the beach due to the infragravigity waves the water colum can reach 1m heigh). </span><br><br>\n\n* `dxinp`: <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> The resolution of the bathymetric grid is not the same as that of the computational grid. It is advised to avoid extremely steep bottom slopes or sharp obstacles as much as posible. </span> ",
"_____no_output_____"
],
[
"<span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">\n Land points are defined as negative while wet points are defined as positive.\n </span>",
"_____no_output_____"
]
],
[
[
"# Import depth FILE\nsp.dxL = 30 # nº nodes per wavelength\nsp.dxinp = np.abs(profile.Distance_profile.values[0]- profile.Distance_profile.values[1]) \nsp.depth=profile.Elevation.values\n\nfig = sm.plot_depthfile() ",
"_____no_output_____"
]
],
[
[
"#### **2.1.2 Friction** ",
"_____no_output_____"
],
[
"<p style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">\nWith this option the user can activate the bottom friction controlled by the Manning formula. As the friction coefficient may vary over the computational region, the friction data can be read from file or defined by specifyng the start and end point along it is defined the frictional area (e.g. reef). \n </p>",
"_____no_output_____"
]
],
[
[
"# Set a constant friction between two points of the profile \nsp.friction_file = False\nsp.friction = True\nsp.Cf = 0.02 # manning frictional coefficient (m^-1/3 s)\nsp.cf_ini = 0 # first point along the profile \nsp.cf_fin = sp.dxinp*np.where(profile.Elevation<0)[0][0]+5 # last point along the profile \nfig = sm.plot_depthfile()\nplt.savefig(op.join(p_out, 'profile_'+str(prf)+'.png'),facecolor='w')",
"_____no_output_____"
]
],
[
[
"### **2.2 Boundary conditions**<br>\n<p style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">\n The boundaries of the computational grid in SWASH are either land, beach or water. The wave condition is imposed on the west boundary of the computational domain, so that the wave propagation is pointing eastward. To simulate entering waves without some reflections at the wavemaker boundary, a weakly-reflective boundary condition allowing outgoing waves is adopted. For this test case, a time series synthesized from parametric information (wave height, period, etc.) will be given as wavemaker. Here, the wavemaker must be defined as irregular unidirectional waves by means of 1D spectrum. Both the initial water level and velocity components are set to zero.\n</p>",
"_____no_output_____"
]
],
[
[
"# Set the simulation period and grid resolution\nsp.tendc = 3600 # simulation period (SEC)\nsp.warmup = 0.15 * sp.tendc # spin-up time (s) (default 15%)",
"_____no_output_____"
]
],
[
[
"#### **2.2.1 Sea state**<br>",
"_____no_output_____"
],
[
"<p style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">\nThe input wave forcing is set as a 1D Jonswap spectrum with $\\gamma$ parameter 3. As the water level is a deterministic variable, it can be included considering different disccrete values in the range of low-high tide.\n</p> ",
"_____no_output_____"
],
[
"<p style=\"font-family: times, Times New Roman; font-size:12pt; font-style:italic; font-weight:bold; color:royalblue;\">\nWater level\n</p> ",
"_____no_output_____"
]
],
[
[
"low_level = 0\nhigh_level = 0\nstep = 0.5\n\nwl = np.arange(low_level, high_level+step, step) # water level (m)\nprint('Water levels: {0}'.format(wl))",
"Water levels: [0.]\n"
],
[
"subset",
"_____no_output_____"
]
],
[
[
"<p style=\"font-family: times, Times New Roman; font-size:12pt; font-style:italic; font-weight:bold; color:royalblue;\">\nJonswap spectrum\n</p> ",
"_____no_output_____"
]
],
[
[
"dir_wx = np.full([len(subset.wx)],0)\ndir_wx = np.where(subset.wx<=0,180,0)\nprint(dir_wx)",
"[180 0 180 ... 180 180 0]\n"
],
[
"# Define JONSWAP spectrum by means of the following spectral parameters \n\nsp.gamma = 10\nwaves = pd.DataFrame(\n {\n \"forcing\": ['Jonswap'] * n_subset,\n \"WL\": subset.level,\n \"Hs\": subset.hs,\n \"Tp\": subset.tp,\n 'Wx': np.abs(subset.wx),\n 'Wdir': dir_wx, \n \"gamma\": np.full([n_subset],sp.gamma),\n \"warmup\": np.full([n_subset],sp.warmup)\n }\n )\nwaves",
"_____no_output_____"
],
[
"# Create wave series and save 'waves.bnd' file\nsp.deltat = 0.5 # delta time over which the wave series is defined\nseries = sw.make_waves_series(waves) ",
"_____no_output_____"
]
],
[
[
"#### **2.2.2 Wind**",
"_____no_output_____"
],
[
"<p style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> \nThe user can optionally specify wind speed, direction and wind drag assuming constant values in the domain. As the test case is using cartesian coordinates, please set the direction where the wind cames from.\n</p>",
"_____no_output_____"
]
],
[
[
"# Define wind parameters\nsp.wind = True\nsp.Wdir = waves.Wdir # wind direction at 10 m height (º)\nsp.Vel = waves.Wx # wind speed at 10 m height (m/s)Distance_profileÇ\nsp.Ca = 0.0026 # dimensionless coefficient (default 0.002)",
"_____no_output_____"
]
],
[
[
"### **2.3. Run**",
"_____no_output_____"
],
[
"<span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> \nIn the following, a series of predefined options have been choosen: <br></span>\n\n* <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;font-weight:bold; background:khaki;\">Grid resolution</span> <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> is determined through a number of points per wavelength criteria: Courant number for numerical stability, number of points per wavelength, and manual upper and lower limits for grid cell sizes.<br></span>\n\n* <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">The default value for the maximun </span><span style=\"font-family: times, Times New Roman; font-size:12pt; color:black; background:khaki; font-weight:bold;\">wave breaking steepness</span> <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">parameter is $ \\alpha = 0.6$<br></span>\n\n* <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> For high, nonlinear waves, or wave interaction with structures with steep slopes (e.g. jetties, quays), a Courant number of 0.5 is advised. Here, a dynamically adjusted </span><span style=\"font-family: times, Times New Roman; color:black; font-size:12pt; background:khaki; font-weight:bold;\">time step</span> <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\"> controlled by a Courant number range of (0.1 - 0.5) is implemented<br></span>\n\n\n<span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">\nUser parametes:<br></span>\n\n* `Nonhydrostatic` <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">to include the non-hydrostatic pressure in the shallow water equations. Hydrostatic pressure assumption can be made in case of propagation of long waves, such as large-scale ocean circulations, tides and storm surges. This assumption does not hold in case of propagation of short waves, flows over a steep bottom, unstable stratified flows, and other small-scale applications where vertical acceleration is dominant </span>\n* `vert` <span style=\"font-family: times, Times New Roman; font-size:12pt; color:black;\">this command set the number of vertical layers in case that the run will be in multi-layered mode </span><br><br>\n",
"_____no_output_____"
]
],
[
[
"# Create swash wrap \nsp.Nonhydrostatic = True # True or False\nsp.vert = 1 # vertical layers\nsp.delttbl = 1 # time between output fields (s)\n\nsw = SwashWrap(sp)\nwaves = sw.build_cases(waves)\nwaves.to_pickle(p_waves)",
"_____no_output_____"
],
[
"# Run cases\nsw.run_cases()",
"SWASH CASE: 0000 SOLVED\nSWASH CASE: 0001 SOLVED\nSWASH CASE: 0002 SOLVED\nSWASH CASE: 0003 SOLVED\nSWASH CASE: 0004 SOLVED\nSWASH CASE: 0005 SOLVED\nSWASH CASE: 0006 SOLVED\nSWASH CASE: 0007 SOLVED\nSWASH CASE: 0008 SOLVED\nSWASH CASE: 0009 SOLVED\nSWASH CASE: 0010 SOLVED\nSWASH CASE: 0011 SOLVED\nSWASH CASE: 0012 SOLVED\nSWASH CASE: 0013 SOLVED\nSWASH CASE: 0014 SOLVED\nSWASH CASE: 0015 SOLVED\nSWASH CASE: 0016 SOLVED\nSWASH CASE: 0017 SOLVED\nSWASH CASE: 0018 SOLVED\nSWASH CASE: 0019 SOLVED\nSWASH CASE: 0020 SOLVED\nSWASH CASE: 0021 SOLVED\nSWASH CASE: 0022 SOLVED\nSWASH CASE: 0023 SOLVED\nSWASH CASE: 0024 SOLVED\nSWASH CASE: 0025 SOLVED\nSWASH CASE: 0026 SOLVED\nSWASH CASE: 0027 SOLVED\nSWASH CASE: 0028 SOLVED\nSWASH CASE: 0029 SOLVED\nSWASH CASE: 0030 SOLVED\nSWASH CASE: 0031 SOLVED\nSWASH CASE: 0032 SOLVED\nSWASH CASE: 0033 SOLVED\nSWASH CASE: 0034 SOLVED\nSWASH CASE: 0035 SOLVED\nSWASH CASE: 0036 SOLVED\nSWASH CASE: 0037 SOLVED\nSWASH CASE: 0038 SOLVED\nSWASH CASE: 0039 SOLVED\nSWASH CASE: 0040 SOLVED\nSWASH CASE: 0041 SOLVED\nSWASH CASE: 0042 SOLVED\nSWASH CASE: 0043 SOLVED\nSWASH CASE: 0044 SOLVED\nSWASH CASE: 0045 SOLVED\nSWASH CASE: 0046 SOLVED\nSWASH CASE: 0047 SOLVED\nSWASH CASE: 0048 SOLVED\nSWASH CASE: 0049 SOLVED\nSWASH CASE: 0050 SOLVED\nSWASH CASE: 0051 SOLVED\nSWASH CASE: 0052 SOLVED\nSWASH CASE: 0053 SOLVED\nSWASH CASE: 0054 SOLVED\nSWASH CASE: 0055 SOLVED\nSWASH CASE: 0056 SOLVED\nSWASH CASE: 0057 SOLVED\nSWASH CASE: 0058 SOLVED\nSWASH CASE: 0059 SOLVED\nSWASH CASE: 0060 SOLVED\nSWASH CASE: 0061 SOLVED\nSWASH CASE: 0062 SOLVED\nSWASH CASE: 0063 SOLVED\nSWASH CASE: 0064 SOLVED\nSWASH CASE: 0065 SOLVED\nSWASH CASE: 0066 SOLVED\nSWASH CASE: 0067 SOLVED\nSWASH CASE: 0068 SOLVED\nSWASH CASE: 0069 SOLVED\nSWASH CASE: 0070 SOLVED\nSWASH CASE: 0071 SOLVED\nSWASH CASE: 0072 SOLVED\nSWASH CASE: 0073 SOLVED\nSWASH CASE: 0074 SOLVED\nSWASH CASE: 0075 SOLVED\nSWASH CASE: 0076 SOLVED\nSWASH CASE: 0077 SOLVED\nSWASH CASE: 0078 SOLVED\nSWASH CASE: 0079 SOLVED\nSWASH CASE: 0080 SOLVED\nSWASH CASE: 0081 SOLVED\nSWASH CASE: 0082 SOLVED\nSWASH CASE: 0083 SOLVED\nSWASH CASE: 0084 SOLVED\nSWASH CASE: 0085 SOLVED\nSWASH CASE: 0086 SOLVED\nSWASH CASE: 0087 SOLVED\nSWASH CASE: 0088 SOLVED\nSWASH CASE: 0089 SOLVED\nSWASH CASE: 0090 SOLVED\nSWASH CASE: 0091 SOLVED\nSWASH CASE: 0092 SOLVED\nSWASH CASE: 0093 SOLVED\nSWASH CASE: 0094 SOLVED\nSWASH CASE: 0095 SOLVED\nSWASH CASE: 0096 SOLVED\nSWASH CASE: 0097 SOLVED\nSWASH CASE: 0098 SOLVED\nSWASH CASE: 0099 SOLVED\nSWASH CASE: 0100 SOLVED\nSWASH CASE: 0101 SOLVED\nSWASH CASE: 0102 SOLVED\nSWASH CASE: 0103 SOLVED\nSWASH CASE: 0104 SOLVED\nSWASH CASE: 0105 SOLVED\nSWASH CASE: 0106 SOLVED\nSWASH CASE: 0107 SOLVED\nSWASH CASE: 0108 SOLVED\nSWASH CASE: 0109 SOLVED\nSWASH CASE: 0110 SOLVED\nSWASH CASE: 0111 SOLVED\nSWASH CASE: 0112 SOLVED\nSWASH CASE: 0113 SOLVED\nSWASH CASE: 0114 SOLVED\nSWASH CASE: 0115 SOLVED\nSWASH CASE: 0116 SOLVED\nSWASH CASE: 0117 SOLVED\nSWASH CASE: 0118 SOLVED\nSWASH CASE: 0119 SOLVED\nSWASH CASE: 0120 SOLVED\nSWASH CASE: 0121 SOLVED\nSWASH CASE: 0122 SOLVED\nSWASH CASE: 0123 SOLVED\nSWASH CASE: 0124 SOLVED\nSWASH CASE: 0125 SOLVED\nSWASH CASE: 0126 SOLVED\nSWASH CASE: 0127 SOLVED\nSWASH CASE: 0128 SOLVED\nSWASH CASE: 0129 SOLVED\nSWASH CASE: 0130 SOLVED\nSWASH CASE: 0131 SOLVED\nSWASH CASE: 0132 SOLVED\nSWASH CASE: 0133 SOLVED\nSWASH CASE: 0134 SOLVED\nSWASH CASE: 0135 SOLVED\nSWASH CASE: 0136 SOLVED\nSWASH CASE: 0137 SOLVED\nSWASH CASE: 0138 SOLVED\nSWASH CASE: 0139 SOLVED\nSWASH CASE: 0140 SOLVED\nSWASH CASE: 0141 SOLVED\nSWASH CASE: 0142 SOLVED\nSWASH CASE: 0143 SOLVED\nSWASH CASE: 0144 SOLVED\nSWASH CASE: 0145 SOLVED\nSWASH CASE: 0146 SOLVED\nSWASH CASE: 0147 SOLVED\nSWASH CASE: 0148 SOLVED\nSWASH CASE: 0149 SOLVED\nSWASH CASE: 0150 SOLVED\nSWASH CASE: 0151 SOLVED\nSWASH CASE: 0152 SOLVED\nSWASH CASE: 0153 SOLVED\nSWASH CASE: 0154 SOLVED\nSWASH CASE: 0155 SOLVED\nSWASH CASE: 0156 SOLVED\nSWASH CASE: 0157 SOLVED\nSWASH CASE: 0158 SOLVED\nSWASH CASE: 0159 SOLVED\nSWASH CASE: 0160 SOLVED\nSWASH CASE: 0161 SOLVED\nSWASH CASE: 0162 SOLVED\nSWASH CASE: 0163 SOLVED\nSWASH CASE: 0164 SOLVED\nSWASH CASE: 0165 SOLVED\nSWASH CASE: 0166 SOLVED\nSWASH CASE: 0167 SOLVED\nSWASH CASE: 0168 SOLVED\nSWASH CASE: 0169 SOLVED\nSWASH CASE: 0170 SOLVED\nSWASH CASE: 0171 SOLVED\nSWASH CASE: 0172 SOLVED\nSWASH CASE: 0173 SOLVED\nSWASH CASE: 0174 SOLVED\nSWASH CASE: 0175 SOLVED\nSWASH CASE: 0176 SOLVED\nSWASH CASE: 0177 SOLVED\nSWASH CASE: 0178 SOLVED\nSWASH CASE: 0179 SOLVED\nSWASH CASE: 0180 SOLVED\nSWASH CASE: 0181 SOLVED\nSWASH CASE: 0182 SOLVED\nSWASH CASE: 0183 SOLVED\nSWASH CASE: 0184 SOLVED\nSWASH CASE: 0185 SOLVED\nSWASH CASE: 0186 SOLVED\nSWASH CASE: 0187 SOLVED\nSWASH CASE: 0188 SOLVED\nSWASH CASE: 0189 SOLVED\nSWASH CASE: 0190 SOLVED\nSWASH CASE: 0191 SOLVED\nSWASH CASE: 0192 SOLVED\nSWASH CASE: 0193 SOLVED\nSWASH CASE: 0194 SOLVED\nSWASH CASE: 0195 SOLVED\nSWASH CASE: 0196 SOLVED\nSWASH CASE: 0197 SOLVED\nSWASH CASE: 0198 SOLVED\nSWASH CASE: 0199 SOLVED\nSWASH CASE: 0200 SOLVED\nSWASH CASE: 0201 SOLVED\nSWASH CASE: 0202 SOLVED\nSWASH CASE: 0203 SOLVED\nSWASH CASE: 0204 SOLVED\nSWASH CASE: 0205 SOLVED\nSWASH CASE: 0206 SOLVED\nSWASH CASE: 0207 SOLVED\nSWASH CASE: 0208 SOLVED\nSWASH CASE: 0209 SOLVED\nSWASH CASE: 0210 SOLVED\nSWASH CASE: 0211 SOLVED\nSWASH CASE: 0212 SOLVED\nSWASH CASE: 0213 SOLVED\nSWASH CASE: 0214 SOLVED\nSWASH CASE: 0215 SOLVED\nSWASH CASE: 0216 SOLVED\nSWASH CASE: 0217 SOLVED\nSWASH CASE: 0218 SOLVED\nSWASH CASE: 0219 SOLVED\nSWASH CASE: 0220 SOLVED\nSWASH CASE: 0221 SOLVED\nSWASH CASE: 0222 SOLVED\nSWASH CASE: 0223 SOLVED\nSWASH CASE: 0224 SOLVED\nSWASH CASE: 0225 SOLVED\nSWASH CASE: 0226 SOLVED\nSWASH CASE: 0227 SOLVED\nSWASH CASE: 0228 SOLVED\nSWASH CASE: 0229 SOLVED\nSWASH CASE: 0230 SOLVED\nSWASH CASE: 0231 SOLVED\nSWASH CASE: 0232 SOLVED\nSWASH CASE: 0233 SOLVED\nSWASH CASE: 0234 SOLVED\nSWASH CASE: 0235 SOLVED\nSWASH CASE: 0236 SOLVED\nSWASH CASE: 0237 SOLVED\nSWASH CASE: 0238 SOLVED\nSWASH CASE: 0239 SOLVED\nSWASH CASE: 0240 SOLVED\nSWASH CASE: 0241 SOLVED\nSWASH CASE: 0242 SOLVED\nSWASH CASE: 0243 SOLVED\nSWASH CASE: 0244 SOLVED\nSWASH CASE: 0245 SOLVED\nSWASH CASE: 0246 SOLVED\nSWASH CASE: 0247 SOLVED\nSWASH CASE: 0248 SOLVED\nSWASH CASE: 0249 SOLVED\nSWASH CASE: 0250 SOLVED\nSWASH CASE: 0251 SOLVED\nSWASH CASE: 0252 SOLVED\nSWASH CASE: 0253 SOLVED\nSWASH CASE: 0254 SOLVED\nSWASH CASE: 0255 SOLVED\nSWASH CASE: 0256 SOLVED\nSWASH CASE: 0257 SOLVED\nSWASH CASE: 0258 SOLVED\nSWASH CASE: 0259 SOLVED\nSWASH CASE: 0260 SOLVED\nSWASH CASE: 0261 SOLVED\nSWASH CASE: 0262 SOLVED\nSWASH CASE: 0263 SOLVED\nSWASH CASE: 0264 SOLVED\nSWASH CASE: 0265 SOLVED\nSWASH CASE: 0266 SOLVED\nSWASH CASE: 0267 SOLVED\nSWASH CASE: 0268 SOLVED\nSWASH CASE: 0269 SOLVED\nSWASH CASE: 0270 SOLVED\nSWASH CASE: 0271 SOLVED\nSWASH CASE: 0272 SOLVED\nSWASH CASE: 0273 SOLVED\nSWASH CASE: 0274 SOLVED\nSWASH CASE: 0275 SOLVED\nSWASH CASE: 0276 SOLVED\nSWASH CASE: 0277 SOLVED\nSWASH CASE: 0278 SOLVED\nSWASH CASE: 0279 SOLVED\nSWASH CASE: 0280 SOLVED\nSWASH CASE: 0281 SOLVED\nSWASH CASE: 0282 SOLVED\nSWASH CASE: 0283 SOLVED\nSWASH CASE: 0284 SOLVED\nSWASH CASE: 0285 SOLVED\nSWASH CASE: 0286 SOLVED\nSWASH CASE: 0287 SOLVED\nSWASH CASE: 0288 SOLVED\nSWASH CASE: 0289 SOLVED\nSWASH CASE: 0290 SOLVED\nSWASH CASE: 0291 SOLVED\nSWASH CASE: 0292 SOLVED\nSWASH CASE: 0293 SOLVED\nSWASH CASE: 0294 SOLVED\nSWASH CASE: 0295 SOLVED\nSWASH CASE: 0296 SOLVED\nSWASH CASE: 0297 SOLVED\nSWASH CASE: 0298 SOLVED\nSWASH CASE: 0299 SOLVED\nSWASH CASE: 0300 SOLVED\nSWASH CASE: 0301 SOLVED\nSWASH CASE: 0302 SOLVED\nSWASH CASE: 0303 SOLVED\nSWASH CASE: 0304 SOLVED\nSWASH CASE: 0305 SOLVED\nSWASH CASE: 0306 SOLVED\nSWASH CASE: 0307 SOLVED\nSWASH CASE: 0308 SOLVED\nSWASH CASE: 0309 SOLVED\nSWASH CASE: 0310 SOLVED\nSWASH CASE: 0311 SOLVED\nSWASH CASE: 0312 SOLVED\nSWASH CASE: 0313 SOLVED\nSWASH CASE: 0314 SOLVED\nSWASH CASE: 0315 SOLVED\nSWASH CASE: 0316 SOLVED\nSWASH CASE: 0317 SOLVED\nSWASH CASE: 0318 SOLVED\nSWASH CASE: 0319 SOLVED\nSWASH CASE: 0320 SOLVED\nSWASH CASE: 0321 SOLVED\nSWASH CASE: 0322 SOLVED\nSWASH CASE: 0323 SOLVED\nSWASH CASE: 0324 SOLVED\nSWASH CASE: 0325 SOLVED\nSWASH CASE: 0326 SOLVED\nSWASH CASE: 0327 SOLVED\nSWASH CASE: 0328 SOLVED\nSWASH CASE: 0329 SOLVED\nSWASH CASE: 0330 SOLVED\nSWASH CASE: 0331 SOLVED\nSWASH CASE: 0332 SOLVED\nSWASH CASE: 0333 SOLVED\nSWASH CASE: 0334 SOLVED\nSWASH CASE: 0335 SOLVED\nSWASH CASE: 0336 SOLVED\nSWASH CASE: 0337 SOLVED\nSWASH CASE: 0338 SOLVED\nSWASH CASE: 0339 SOLVED\nSWASH CASE: 0340 SOLVED\nSWASH CASE: 0341 SOLVED\nSWASH CASE: 0342 SOLVED\nSWASH CASE: 0343 SOLVED\nSWASH CASE: 0344 SOLVED\nSWASH CASE: 0345 SOLVED\nSWASH CASE: 0346 SOLVED\nSWASH CASE: 0347 SOLVED\nSWASH CASE: 0348 SOLVED\nSWASH CASE: 0349 SOLVED\nSWASH CASE: 0350 SOLVED\nSWASH CASE: 0351 SOLVED\nSWASH CASE: 0352 SOLVED\nSWASH CASE: 0353 SOLVED\nSWASH CASE: 0354 SOLVED\nSWASH CASE: 0355 SOLVED\nSWASH CASE: 0356 SOLVED\nSWASH CASE: 0357 SOLVED\nSWASH CASE: 0358 SOLVED\nSWASH CASE: 0359 SOLVED\nSWASH CASE: 0360 SOLVED\nSWASH CASE: 0361 SOLVED\nSWASH CASE: 0362 SOLVED\nSWASH CASE: 0363 SOLVED\nSWASH CASE: 0364 SOLVED\nSWASH CASE: 0365 SOLVED\nSWASH CASE: 0366 SOLVED\nSWASH CASE: 0367 SOLVED\nSWASH CASE: 0368 SOLVED\nSWASH CASE: 0369 SOLVED\nSWASH CASE: 0370 SOLVED\nSWASH CASE: 0371 SOLVED\nSWASH CASE: 0372 SOLVED\nSWASH CASE: 0373 SOLVED\nSWASH CASE: 0374 SOLVED\nSWASH CASE: 0375 SOLVED\nSWASH CASE: 0376 SOLVED\nSWASH CASE: 0377 SOLVED\nSWASH CASE: 0378 SOLVED\nSWASH CASE: 0379 SOLVED\nSWASH CASE: 0380 SOLVED\nSWASH CASE: 0381 SOLVED\nSWASH CASE: 0382 SOLVED\nSWASH CASE: 0383 SOLVED\nSWASH CASE: 0384 SOLVED\nSWASH CASE: 0385 SOLVED\nSWASH CASE: 0386 SOLVED\nSWASH CASE: 0387 SOLVED\nSWASH CASE: 0388 SOLVED\nSWASH CASE: 0389 SOLVED\nSWASH CASE: 0390 SOLVED\nSWASH CASE: 0391 SOLVED\nSWASH CASE: 0392 SOLVED\nSWASH CASE: 0393 SOLVED\nSWASH CASE: 0394 SOLVED\nSWASH CASE: 0395 SOLVED\nSWASH CASE: 0396 SOLVED\nSWASH CASE: 0397 SOLVED\nSWASH CASE: 0398 SOLVED\nSWASH CASE: 0399 SOLVED\nSWASH CASE: 0400 SOLVED\nSWASH CASE: 0401 SOLVED\nSWASH CASE: 0402 SOLVED\nSWASH CASE: 0403 SOLVED\nSWASH CASE: 0404 SOLVED\nSWASH CASE: 0405 SOLVED\nSWASH CASE: 0406 SOLVED\nSWASH CASE: 0407 SOLVED\nSWASH CASE: 0408 SOLVED\nSWASH CASE: 0409 SOLVED\nSWASH CASE: 0410 SOLVED\nSWASH CASE: 0411 SOLVED\nSWASH CASE: 0412 SOLVED\nSWASH CASE: 0413 SOLVED\nSWASH CASE: 0414 SOLVED\nSWASH CASE: 0415 SOLVED\nSWASH CASE: 0416 SOLVED\nSWASH CASE: 0417 SOLVED\nSWASH CASE: 0418 SOLVED\nSWASH CASE: 0419 SOLVED\nSWASH CASE: 0420 SOLVED\nSWASH CASE: 0421 SOLVED\nSWASH CASE: 0422 SOLVED\nSWASH CASE: 0423 SOLVED\nSWASH CASE: 0424 SOLVED\nSWASH CASE: 0425 SOLVED\nSWASH CASE: 0426 SOLVED\nSWASH CASE: 0427 SOLVED\nSWASH CASE: 0428 SOLVED\nSWASH CASE: 0429 SOLVED\nSWASH CASE: 0430 SOLVED\nSWASH CASE: 0431 SOLVED\nSWASH CASE: 0432 SOLVED\nSWASH CASE: 0433 SOLVED\nSWASH CASE: 0434 SOLVED\nSWASH CASE: 0435 SOLVED\nSWASH CASE: 0436 SOLVED\nSWASH CASE: 0437 SOLVED\nSWASH CASE: 0438 SOLVED\nSWASH CASE: 0439 SOLVED\nSWASH CASE: 0440 SOLVED\nSWASH CASE: 0441 SOLVED\nSWASH CASE: 0442 SOLVED\nSWASH CASE: 0443 SOLVED\nSWASH CASE: 0444 SOLVED\nSWASH CASE: 0445 SOLVED\nSWASH CASE: 0446 SOLVED\nSWASH CASE: 0447 SOLVED\nSWASH CASE: 0448 SOLVED\nSWASH CASE: 0449 SOLVED\nSWASH CASE: 0450 SOLVED\nSWASH CASE: 0451 SOLVED\nSWASH CASE: 0452 SOLVED\nSWASH CASE: 0453 SOLVED\nSWASH CASE: 0454 SOLVED\nSWASH CASE: 0455 SOLVED\nSWASH CASE: 0456 SOLVED\nSWASH CASE: 0457 SOLVED\nSWASH CASE: 0458 SOLVED\nSWASH CASE: 0459 SOLVED\nSWASH CASE: 0460 SOLVED\nSWASH CASE: 0461 SOLVED\nSWASH CASE: 0462 SOLVED\nSWASH CASE: 0463 SOLVED\nSWASH CASE: 0464 SOLVED\nSWASH CASE: 0465 SOLVED\nSWASH CASE: 0466 SOLVED\nSWASH CASE: 0467 SOLVED\nSWASH CASE: 0468 SOLVED\nSWASH CASE: 0469 SOLVED\nSWASH CASE: 0470 SOLVED\nSWASH CASE: 0471 SOLVED\nSWASH CASE: 0472 SOLVED\nSWASH CASE: 0473 SOLVED\nSWASH CASE: 0474 SOLVED\nSWASH CASE: 0475 SOLVED\nSWASH CASE: 0476 SOLVED\nSWASH CASE: 0477 SOLVED\nSWASH CASE: 0478 SOLVED\nSWASH CASE: 0479 SOLVED\nSWASH CASE: 0480 SOLVED\nSWASH CASE: 0481 SOLVED\nSWASH CASE: 0482 SOLVED\nSWASH CASE: 0483 SOLVED\nSWASH CASE: 0484 SOLVED\nSWASH CASE: 0485 SOLVED\nSWASH CASE: 0486 SOLVED\nSWASH CASE: 0487 SOLVED\nSWASH CASE: 0488 SOLVED\nSWASH CASE: 0489 SOLVED\nSWASH CASE: 0490 SOLVED\nSWASH CASE: 0491 SOLVED\nSWASH CASE: 0492 SOLVED\nSWASH CASE: 0493 SOLVED\nSWASH CASE: 0494 SOLVED\nSWASH CASE: 0495 SOLVED\nSWASH CASE: 0496 SOLVED\nSWASH CASE: 0497 SOLVED\nSWASH CASE: 0498 SOLVED\nSWASH CASE: 0499 SOLVED\nSWASH CASE: 0500 SOLVED\nSWASH CASE: 0501 SOLVED\nSWASH CASE: 0502 SOLVED\nSWASH CASE: 0503 SOLVED\nSWASH CASE: 0504 SOLVED\nSWASH CASE: 0505 SOLVED\nSWASH CASE: 0506 SOLVED\nSWASH CASE: 0507 SOLVED\nSWASH CASE: 0508 SOLVED\nSWASH CASE: 0509 SOLVED\nSWASH CASE: 0510 SOLVED\nSWASH CASE: 0511 SOLVED\nSWASH CASE: 0512 SOLVED\nSWASH CASE: 0513 SOLVED\nSWASH CASE: 0514 SOLVED\nSWASH CASE: 0515 SOLVED\nSWASH CASE: 0516 SOLVED\nSWASH CASE: 0517 SOLVED\nSWASH CASE: 0518 SOLVED\nSWASH CASE: 0519 SOLVED\nSWASH CASE: 0520 SOLVED\nSWASH CASE: 0521 SOLVED\nSWASH CASE: 0522 SOLVED\nSWASH CASE: 0523 SOLVED\nSWASH CASE: 0524 SOLVED\nSWASH CASE: 0525 SOLVED\nSWASH CASE: 0526 SOLVED\nSWASH CASE: 0527 SOLVED\nSWASH CASE: 0528 SOLVED\nSWASH CASE: 0529 SOLVED\nSWASH CASE: 0530 SOLVED\nSWASH CASE: 0531 SOLVED\nSWASH CASE: 0532 SOLVED\nSWASH CASE: 0533 SOLVED\nSWASH CASE: 0534 SOLVED\nSWASH CASE: 0535 SOLVED\nSWASH CASE: 0536 SOLVED\nSWASH CASE: 0537 SOLVED\nSWASH CASE: 0538 SOLVED\nSWASH CASE: 0539 SOLVED\nSWASH CASE: 0540 SOLVED\nSWASH CASE: 0541 SOLVED\nSWASH CASE: 0542 SOLVED\nSWASH CASE: 0543 SOLVED\nSWASH CASE: 0544 SOLVED\nSWASH CASE: 0545 SOLVED\nSWASH CASE: 0546 SOLVED\nSWASH CASE: 0547 SOLVED\nSWASH CASE: 0548 SOLVED\nSWASH CASE: 0549 SOLVED\nSWASH CASE: 0550 SOLVED\nSWASH CASE: 0551 SOLVED\nSWASH CASE: 0552 SOLVED\nSWASH CASE: 0553 SOLVED\nSWASH CASE: 0554 SOLVED\nSWASH CASE: 0555 SOLVED\nSWASH CASE: 0556 SOLVED\nSWASH CASE: 0557 SOLVED\nSWASH CASE: 0558 SOLVED\nSWASH CASE: 0559 SOLVED\nSWASH CASE: 0560 SOLVED\nSWASH CASE: 0561 SOLVED\nSWASH CASE: 0562 SOLVED\nSWASH CASE: 0563 SOLVED\nSWASH CASE: 0564 SOLVED\nSWASH CASE: 0565 SOLVED\nSWASH CASE: 0566 SOLVED\nSWASH CASE: 0567 SOLVED\nSWASH CASE: 0568 SOLVED\nSWASH CASE: 0569 SOLVED\nSWASH CASE: 0570 SOLVED\nSWASH CASE: 0571 SOLVED\nSWASH CASE: 0572 SOLVED\nSWASH CASE: 0573 SOLVED\nSWASH CASE: 0574 SOLVED\nSWASH CASE: 0575 SOLVED\nSWASH CASE: 0576 SOLVED\nSWASH CASE: 0577 SOLVED\nSWASH CASE: 0578 SOLVED\nSWASH CASE: 0579 SOLVED\nSWASH CASE: 0580 SOLVED\nSWASH CASE: 0581 SOLVED\nSWASH CASE: 0582 SOLVED\nSWASH CASE: 0583 SOLVED\nSWASH CASE: 0584 SOLVED\nSWASH CASE: 0585 SOLVED\nSWASH CASE: 0586 SOLVED\nSWASH CASE: 0587 SOLVED\nSWASH CASE: 0588 SOLVED\nSWASH CASE: 0589 SOLVED\nSWASH CASE: 0590 SOLVED\nSWASH CASE: 0591 SOLVED\nSWASH CASE: 0592 SOLVED\nSWASH CASE: 0593 SOLVED\nSWASH CASE: 0594 SOLVED\nSWASH CASE: 0595 SOLVED\nSWASH CASE: 0596 SOLVED\nSWASH CASE: 0597 SOLVED\nSWASH CASE: 0598 SOLVED\nSWASH CASE: 0599 SOLVED\nSWASH CASE: 0600 SOLVED\nSWASH CASE: 0601 SOLVED\nSWASH CASE: 0602 SOLVED\nSWASH CASE: 0603 SOLVED\nSWASH CASE: 0604 SOLVED\nSWASH CASE: 0605 SOLVED\nSWASH CASE: 0606 SOLVED\nSWASH CASE: 0607 SOLVED\nSWASH CASE: 0608 SOLVED\nSWASH CASE: 0609 SOLVED\nSWASH CASE: 0610 SOLVED\nSWASH CASE: 0611 SOLVED\nSWASH CASE: 0612 SOLVED\nSWASH CASE: 0613 SOLVED\nSWASH CASE: 0614 SOLVED\nSWASH CASE: 0615 SOLVED\nSWASH CASE: 0616 SOLVED\nSWASH CASE: 0617 SOLVED\nSWASH CASE: 0618 SOLVED\nSWASH CASE: 0619 SOLVED\nSWASH CASE: 0620 SOLVED\nSWASH CASE: 0621 SOLVED\nSWASH CASE: 0622 SOLVED\nSWASH CASE: 0623 SOLVED\nSWASH CASE: 0624 SOLVED\nSWASH CASE: 0625 SOLVED\nSWASH CASE: 0626 SOLVED\nSWASH CASE: 0627 SOLVED\nSWASH CASE: 0628 SOLVED\nSWASH CASE: 0629 SOLVED\nSWASH CASE: 0630 SOLVED\nSWASH CASE: 0631 SOLVED\nSWASH CASE: 0632 SOLVED\nSWASH CASE: 0633 SOLVED\nSWASH CASE: 0634 SOLVED\nSWASH CASE: 0635 SOLVED\nSWASH CASE: 0636 SOLVED\nSWASH CASE: 0637 SOLVED\nSWASH CASE: 0638 SOLVED\nSWASH CASE: 0639 SOLVED\nSWASH CASE: 0640 SOLVED\nSWASH CASE: 0641 SOLVED\nSWASH CASE: 0642 SOLVED\nSWASH CASE: 0643 SOLVED\nSWASH CASE: 0644 SOLVED\nSWASH CASE: 0645 SOLVED\nSWASH CASE: 0646 SOLVED\nSWASH CASE: 0647 SOLVED\nSWASH CASE: 0648 SOLVED\nSWASH CASE: 0649 SOLVED\nSWASH CASE: 0650 SOLVED\nSWASH CASE: 0651 SOLVED\nSWASH CASE: 0652 SOLVED\nSWASH CASE: 0653 SOLVED\nSWASH CASE: 0654 SOLVED\nSWASH CASE: 0655 SOLVED\nSWASH CASE: 0656 SOLVED\nSWASH CASE: 0657 SOLVED\nSWASH CASE: 0658 SOLVED\nSWASH CASE: 0659 SOLVED\nSWASH CASE: 0660 SOLVED\nSWASH CASE: 0661 SOLVED\nSWASH CASE: 0662 SOLVED\nSWASH CASE: 0663 SOLVED\nSWASH CASE: 0664 SOLVED\nSWASH CASE: 0665 SOLVED\nSWASH CASE: 0666 SOLVED\nSWASH CASE: 0667 SOLVED\nSWASH CASE: 0668 SOLVED\nSWASH CASE: 0669 SOLVED\nSWASH CASE: 0670 SOLVED\nSWASH CASE: 0671 SOLVED\nSWASH CASE: 0672 SOLVED\nSWASH CASE: 0673 SOLVED\nSWASH CASE: 0674 SOLVED\nSWASH CASE: 0675 SOLVED\nSWASH CASE: 0676 SOLVED\nSWASH CASE: 0677 SOLVED\nSWASH CASE: 0678 SOLVED\nSWASH CASE: 0679 SOLVED\nSWASH CASE: 0680 SOLVED\nSWASH CASE: 0681 SOLVED\nSWASH CASE: 0682 SOLVED\nSWASH CASE: 0683 SOLVED\nSWASH CASE: 0684 SOLVED\nSWASH CASE: 0685 SOLVED\nSWASH CASE: 0686 SOLVED\nSWASH CASE: 0687 SOLVED\nSWASH CASE: 0688 SOLVED\nSWASH CASE: 0689 SOLVED\nSWASH CASE: 0690 SOLVED\nSWASH CASE: 0691 SOLVED\nSWASH CASE: 0692 SOLVED\nSWASH CASE: 0693 SOLVED\nSWASH CASE: 0694 SOLVED\nSWASH CASE: 0695 SOLVED\nSWASH CASE: 0696 SOLVED\nSWASH CASE: 0697 SOLVED\nSWASH CASE: 0698 SOLVED\nSWASH CASE: 0699 SOLVED\nSWASH CASE: 0700 SOLVED\nSWASH CASE: 0701 SOLVED\nSWASH CASE: 0702 SOLVED\n"
],
[
"## TARGET: Extract output from files\n#do_extract=1\n#if do_extract==1:\n# target = sw.metaoutput(waves)\n# target = target.rename({'dim_0': 'case'})\n# print(target)\n# target.to_netcdf(op.join(p_out, 'xds_out_prf'+str(prf)+'.nc'))\n#else:\n# target = xr.open_dataset(op.join(p_out, 'xds_out_prf'+str(prf)+'.nc'))\n#df_target = pd.DataFrame({'ru2':target.Ru2.values, 'q': target.q.values}) \n#print(df_target)",
"_____no_output_____"
],
[
"#df_dataset=subset\n#df_dataset['Ru2']=target.Ru2.values\n#df_dataset['q']=target.q.values\n#print(df_dataset)",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
]
]
|
cb6be9e979643caee5a18bd08db7a743b3d71c95 | 12,983 | ipynb | Jupyter Notebook | In Progress - Deep Learning - The Straight Dope/03 - Deep Neural Networks/04 - Dropout regularization with gluon.ipynb | maraboinavamshi/courses | 48f255ffb1903ba20865c2b91b488758d5cb1a09 | [
"Apache-2.0"
]
| 15 | 2017-09-19T08:09:01.000Z | 2019-04-29T00:37:51.000Z | In Progress - Deep Learning - The Straight Dope/03 - Deep Neural Networks/04 - Dropout regularization with gluon.ipynb | chitrita/Courses-1 | 7713267ee5c92e488086588ac41490c44b4f7350 | [
"Apache-2.0"
]
| null | null | null | In Progress - Deep Learning - The Straight Dope/03 - Deep Neural Networks/04 - Dropout regularization with gluon.ipynb | chitrita/Courses-1 | 7713267ee5c92e488086588ac41490c44b4f7350 | [
"Apache-2.0"
]
| 17 | 2018-02-27T03:15:54.000Z | 2019-04-24T09:26:46.000Z | 23.350719 | 111 | 0.490719 | [
[
[
"# Dropout regularization with gluon",
"_____no_output_____"
]
],
[
[
"import mxnet as mx\nimport numpy as np\nfrom mxnet import gluon\nfrom tqdm import tqdm_notebook as tqdm",
"_____no_output_____"
]
],
[
[
"## Context",
"_____no_output_____"
]
],
[
[
"ctx = mx.cpu()",
"_____no_output_____"
]
],
[
[
"## The MNIST Dataset",
"_____no_output_____"
]
],
[
[
"batch_size = 64\nnum_inputs = 784\nnum_outputs = 10",
"_____no_output_____"
],
[
"def transform(data, label):\n return data.astype(np.float32) / 255, label.astype(np.float32)",
"_____no_output_____"
],
[
"train_data = gluon.data.DataLoader(dataset=gluon.data.vision.MNIST(train=True, transform=transform),\n batch_size=batch_size,\n shuffle=True)\ntest_data = gluon.data.DataLoader(dataset=gluon.data.vision.MNIST(train=False, transform=transform),\n batch_size=batch_size,\n shuffle=False)",
"_____no_output_____"
]
],
[
[
"## Define the model",
"_____no_output_____"
]
],
[
[
"num_hidden = 256",
"_____no_output_____"
],
[
"net = gluon.nn.Sequential()\nwith net.name_scope():\n ###########################\n # Adding first hidden layer\n ###########################\n net.add(gluon.nn.Dense(units=num_hidden,\n activation=\"relu\"))\n ###########################\n # Adding dropout with rate .5 to the first hidden layer\n ###########################\n net.add(gluon.nn.Dropout(rate=0.5))\n\n ###########################\n # Adding first hidden layer\n ###########################\n net.add(gluon.nn.Dense(units=num_hidden,\n activation=\"relu\"))\n ###########################\n # Adding dropout with rate .5 to the second hidden layer\n ###########################\n net.add(gluon.nn.Dropout(rate=0.5))\n ###########################\n # Adding the output layer\n ###########################\n net.add(gluon.nn.Dense(units=num_outputs))",
"_____no_output_____"
]
],
[
[
"## Parameter initialization",
"_____no_output_____"
]
],
[
[
"net.collect_params().initialize(mx.init.Xavier(magnitude=2.24), ctx=ctx)",
"_____no_output_____"
],
[
"softmax_cross_entropy = gluon.loss.SoftmaxCrossEntropyLoss()",
"_____no_output_____"
],
[
"trainer = gluon.Trainer(net.collect_params(), 'sgd', {'learning_rate': .1})",
"_____no_output_____"
]
],
[
[
"## Evaluation",
"_____no_output_____"
]
],
[
[
"def evaluate_accuracy(data_iterator, net, mode='train'):\n acc = mx.metric.Accuracy()\n for i, (data, label) in enumerate(data_iterator):\n data = data.as_in_context(ctx).reshape([-1, 784])\n label = label.as_in_context(ctx)\n if mode == 'train':\n with mx.autograd.train_mode():\n output = net(data)\n else: \n with mx.autograd.predict_mode():\n output = net(data)\n predictions = mx.nd.argmax(output, axis=1)\n acc.update(preds=predictions, labels=label)\n return acc.get()[1]",
"_____no_output_____"
]
],
[
[
"## Training",
"_____no_output_____"
]
],
[
[
"epochs = 10\nsmoothing_constant = .01",
"_____no_output_____"
],
[
"for e in tqdm(range(epochs)):\n for i, (data, label) in tqdm(enumerate(train_data)):\n data = data.as_in_context(ctx).reshape([-1, 784])\n label = label.as_in_context(ctx)\n with mx.autograd.record():\n output = net(data)\n loss = softmax_cross_entropy(output, label)\n loss.backward()\n trainer.step(data.shape[0])\n\n ##########################\n # Keep a moving average of the losses\n ##########################\n curr_loss = mx.nd.mean(loss).asscalar()\n moving_loss = (curr_loss if ((i == 0) and (e == 0))\n else (1 - smoothing_constant) * moving_loss + (smoothing_constant) * curr_loss)\n\n test_accuracy = evaluate_accuracy(test_data, net, mode='test')\n train_accuracy = evaluate_accuracy(train_data, net, mode='train')\n print(\"Epoch %s. Loss: %s, Train_acc %s, Test_acc %s\" %\n (e, moving_loss, train_accuracy, test_accuracy))",
"_____no_output_____"
]
],
[
[
"## Predict for the first batch",
"_____no_output_____"
]
],
[
[
"for i, (data, label) in enumerate(test_data):\n data = data[0].as_in_context(ctx).reshape([-1, 784])\n label = label[0].as_in_context(ctx)\n with mx.autograd.record(train_mode=False):\n output = net(data)\n predictions = mx.nd.argmax(output, axis=1)\n print(predictions)\n break",
"\n[7.]\n<NDArray 1 @cpu(0)>\n"
]
],
[
[
"## Testing if the accuracy is calculated correctly",
"_____no_output_____"
]
],
[
[
"test_accuracy = evaluate_accuracy(test_data, net, mode='test')",
"_____no_output_____"
],
[
"test_accuracy",
"_____no_output_____"
],
[
"test_accuracy = evaluate_accuracy(test_data, net, mode='test')",
"_____no_output_____"
],
[
"test_accuracy",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
]
]
|
cb6bf4f4d4cd3b0c85e8cc3c9c1b4592bc852699 | 2,844 | ipynb | Jupyter Notebook | sdks/python/apache_beam/runners/interactive/testing/integration/test_notebooks/dataframes.ipynb | Snowflake-Labs/beam | 9317462f73cd3aeb42145ba41ba3b1ef0f72674b | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause"
]
| 5,279 | 2016-12-29T04:00:44.000Z | 2022-03-31T22:56:45.000Z | sdks/python/apache_beam/runners/interactive/testing/integration/test_notebooks/dataframes.ipynb | Snowflake-Labs/beam | 9317462f73cd3aeb42145ba41ba3b1ef0f72674b | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause"
]
| 14,149 | 2016-12-28T00:43:50.000Z | 2022-03-31T23:50:22.000Z | sdks/python/apache_beam/runners/interactive/testing/integration/test_notebooks/dataframes.ipynb | Snowflake-Labs/beam | 9317462f73cd3aeb42145ba41ba3b1ef0f72674b | [
"PSF-2.0",
"Apache-2.0",
"BSD-3-Clause"
]
| 3,763 | 2016-12-29T04:06:10.000Z | 2022-03-31T22:25:49.000Z | 26.579439 | 89 | 0.578762 | [
[
[
"<!--\n Licensed to the Apache Software Foundation (ASF) under one\n or more contributor license agreements. See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership. The ASF licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing,\n software distributed under the License is distributed on an\n \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, either express or implied. See the License for the\n specific language governing permissions and limitations\n under the License.\n-->\n\n# Interactive Beam Examples",
"_____no_output_____"
]
],
[
[
"import apache_beam as beam\nfrom apache_beam.runners.interactive.interactive_runner import InteractiveRunner\nfrom apache_beam.runners.interactive import interactive_beam as ib\nfrom apache_beam.dataframe.convert import to_dataframe\nfrom apache_beam.dataframe.convert import to_pcollection\nfrom typing import NamedTuple\n\nfrom IPython.display import display, HTML",
"_____no_output_____"
],
[
"class Record(NamedTuple):\n i: int\n a: int\n \ndata = [Record(i, i % 5) for i in range(10)]\np = beam.Pipeline(InteractiveRunner())\n\nels = p | beam.Create(data)\ndf = to_dataframe(els).set_index('i', drop=True)",
"_____no_output_____"
],
[
"ib.show(df)",
"_____no_output_____"
],
[
"ib.collect(df)",
"_____no_output_____"
],
[
"display(HTML('<div id=\"test-done\"></div>'))",
"_____no_output_____"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6bf9c04fb822e2d34d8f732df053d6a4d14561 | 385,210 | ipynb | Jupyter Notebook | 2018-2019/assignment 2 (FNN & Optimization)/Update_rule_examples.ipynb | Tudor67/Neural-Networks-Assignments | 7376e9d3b0059df2f2b21d56787c47d3c1ba6746 | [
"MIT"
]
| 1 | 2019-04-07T03:50:57.000Z | 2019-04-07T03:50:57.000Z | 2018-2019/assignment 2 (FNN & Optimization)/Update_rule_examples.ipynb | Tudor67/Neural-Networks-Assignments | 7376e9d3b0059df2f2b21d56787c47d3c1ba6746 | [
"MIT"
]
| 5 | 2018-10-16T22:46:33.000Z | 2019-02-04T20:11:41.000Z | 2018-2019/assignment 2 (FNN & Optimization)/Update_rule_examples.ipynb | Tudor67/Neural-Networks-Assignments | 7376e9d3b0059df2f2b21d56787c47d3c1ba6746 | [
"MIT"
]
| 1 | 2019-04-07T03:50:42.000Z | 2019-04-07T03:50:42.000Z | 84.346398 | 145 | 0.824244 | [
[
[
"# Update rules",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\nimport mpl_toolkits.mplot3d.axes3d as p3\nimport matplotlib.animation as animation\n\nfrom IPython.display import HTML\nfrom matplotlib import cm\nfrom matplotlib.colors import LogNorm",
"_____no_output_____"
],
[
"def sgd(f, df, x0, y0, lr, steps):\n x = np.zeros(steps + 1)\n y = np.zeros(steps + 1)\n x[0] = x0\n y[0] = y0\n \n for i in range(steps):\n (dx, dy) = df(x[i], y[i])\n x[i + 1] = x[i] - lr * dx\n y[i + 1] = y[i] - lr * dy\n \n z = f(x, y)\n return [x, y, z]",
"_____no_output_____"
],
[
"def nesterov(f, df, x0, y0, lr, steps, momentum):\n x = np.zeros(steps + 1)\n y = np.zeros(steps + 1)\n x[0] = x0\n y[0] = y0\n dx_v = 0\n dy_v = 0\n \n for i in range(steps):\n (dx_ahead, dy_ahead) = df(x[i] + momentum * dx_v, y[i] + momentum * dy_v)\n dx_v = momentum * dx_v - lr * dx_ahead\n dy_v = momentum * dy_v - lr * dy_ahead\n x[i + 1] = x[i] + dx_v\n y[i + 1] = y[i] + dy_v\n \n z = f(x, y)\n return [x, y, z]",
"_____no_output_____"
],
[
"def adagrad(f, df, x0, y0, lr, steps):\n x = np.zeros(steps + 1)\n y = np.zeros(steps + 1)\n x[0] = x0\n y[0] = y0\n dx_cache = 0\n dy_cache = 0\n \n for i in range(steps):\n (dx, dy) = df(x[i], y[i])\n dx_cache += dx ** 2\n dy_cache += dy ** 2\n x[i + 1] = x[i] - lr * dx / (1e-8 + np.sqrt(dx_cache))\n y[i + 1] = y[i] - lr * dy / (1e-8 + np.sqrt(dy_cache))\n \n z = f(x, y)\n return [x, y, z]",
"_____no_output_____"
],
[
"def rmsprop(f, df, x0, y0, lr, steps, decay_rate):\n x = np.zeros(steps + 1)\n y = np.zeros(steps + 1)\n x[0] = x0\n y[0] = y0\n dx_cache = 0\n dy_cache = 0\n \n for i in range(steps):\n (dx, dy) = df(x[i], y[i])\n dx_cache = decay_rate * dx_cache + (1 - decay_rate) * dx ** 2\n dy_cache = decay_rate * dy_cache + (1 - decay_rate) * dy ** 2\n x[i + 1] = x[i] - lr * dx / (1e-8 + np.sqrt(dx_cache))\n y[i + 1] = y[i] - lr * dy / (1e-8 + np.sqrt(dy_cache))\n \n z = f(x, y)\n return [x, y, z]",
"_____no_output_____"
],
[
"def adam(f, df, x0, y0, lr, steps, beta1, beta2):\n # adam with bias correction\n x = np.zeros(steps + 1)\n y = np.zeros(steps + 1)\n x[0] = x0\n y[0] = y0\n dx_v = 0\n dy_v = 0\n dx_cache = 0\n dy_cache = 0\n \n for i in range(steps):\n (dx, dy) = df(x[i], y[i])\n \n dx_v = beta1 * dx_v + (1 - beta1) * dx\n dx_v_hat = dx_v / (1 - beta1 ** (i + 1))\n \n dx_cache = beta2 * dx_cache + (1 - beta2) * dx ** 2\n dx_cache_hat = dx_cache / (1 - beta2 ** (i + 1))\n \n dy_v = beta1 * dy_v + (1 - beta1) * dy\n dy_v_hat = dy_v / (1 - beta1 ** (i + 1))\n \n dy_cache = beta2 * dy_cache + (1 - beta2) * dy ** 2\n dy_cache_hat = dy_cache / (1 - beta2 ** (i + 1))\n \n x[i + 1] = x[i] - lr * dx_v_hat / (1e-8 + np.sqrt(dx_cache_hat))\n y[i + 1] = y[i] - lr * dy_v_hat / (1e-8 + np.sqrt(dy_cache_hat))\n \n z = f(x, y)\n return [x, y, z]",
"_____no_output_____"
],
[
"def update_lines(num, dataLines, lines):\n for line, data in zip(lines, dataLines):\n # NOTE: there is no .set_data() for 3 dim data...\n line.set_data(data[0:2, :num])\n line.set_3d_properties(data[2, :num])\n line.set_marker('o')\n line.set_markevery([-1])\n return lines\n\ndef create_and_save_animation(func_title, f, df, params={}, plot_params={}):\n x0 = params.get('x0', 0)\n y0 = params.get('y0', 0)\n lr = params.get('lr', .1)\n steps = params.get('steps', 8)\n momentum = params.get('momentum', .9)\n decay_rate = params.get('decay_rate', .9)\n beta1 = params.get('beta1', .9)\n beta2 = params.get('beta2', .999)\n \n # sgd params\n x0_sgd = params.get('x0_sgd', x0)\n y0_sgd = params.get('y0_sgd', y0)\n lr_sgd = params.get('lr_sgd', lr)\n \n # nesterov params\n x0_nesterov = params.get('x0_nesterov', x0)\n y0_nesterov = params.get('y0_nesterov', y0)\n lr_nesterov = params.get('lr_nesterov', lr)\n \n # adagrad params\n x0_adagrad = params.get('x0_adagrad', x0)\n y0_adagrad = params.get('y0_adagrad', y0)\n lr_adagrad = params.get('lr_adagrad', lr)\n \n # rmsprop params\n x0_rmsprop = params.get('x0_rmsprop', x0)\n y0_rmsprop = params.get('y0_rmsprop', y0)\n lr_rmsprop = params.get('lr_rmsprop', lr)\n \n # adam params\n x0_adam = params.get('x0_adam', x0)\n y0_adam = params.get('y0_adam', y0)\n lr_adam = params.get('lr_adam', lr)\n \n azim = plot_params.get('azim', -29)\n elev = plot_params.get('elev', 49)\n rotation = plot_params.get('rotation', -7)\n \n # attaching 3D axis to the figure\n fig = plt.figure(figsize=(12, 8))\n ax = p3.Axes3D(fig, azim=azim, elev=elev)\n \n # plot the surface\n x = np.arange(-6.5, 6.5, 0.1)\n y = np.arange(-6.5, 6.5, 0.1)\n x, y = np.meshgrid(x, y)\n z = f(x, y)\n ax.plot_surface(x, y, z, rstride=1, cstride=1,\n norm = LogNorm(), cmap = cm.jet)\n ax.set_title(func_title, rotation=rotation)\n\n # lines to plot in 3D\n sgd_data = sgd(f, df, x0_sgd, y0_sgd, lr_sgd, steps)\n nesterov_data = nesterov(f, df, x0_nesterov, y0_nesterov, lr_nesterov, steps, momentum)\n adagrad_data = adagrad(f, df, x0_adagrad, y0_adagrad, lr_adagrad, steps)\n rmsprop_data = rmsprop(f, df, x0_rmsprop, y0_rmsprop, lr_rmsprop, steps, decay_rate)\n adam_data = adam(f, df, x0_adam, y0_adam, lr_adam, steps, beta1, beta2)\n data = np.array([sgd_data, nesterov_data, adagrad_data, rmsprop_data, adam_data])\n\n # NOTE: Can't pass empty arrays into 3d version of plot()\n lines = [ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in data]\n ax.legend(lines, ['SGD', 'Nesterov Momentum', 'Adagrad', 'RMSProp', 'Adam'])\n\n ax.set_xlabel(\"x\")\n ax.set_ylabel(\"y\")\n ax.set_zlabel(\"z\")\n plt.rcParams['animation.html'] = 'html5'\n\n line_ani = animation.FuncAnimation(fig, update_lines, steps+2, fargs=(data, lines),\n interval=500, blit=False, repeat=False)\n\n plt.close()\n line_ani.save(f'optimization_{func_title}.gif', writer='imagemagick',fps=500/100)\n \n return line_ani",
"_____no_output_____"
],
[
"func_title = 'sphere_function'\n\ndef f(x, y):\n return x ** 2 + y ** 2\n\ndef df(x, y):\n return (2 * x, 2 * y)\n\ncreate_and_save_animation(func_title, f, df,\n params={\n 'steps': 15,\n 'lr': .2,\n 'x0_sgd': -4,\n 'y0_sgd': -4,\n 'x0_nesterov': -4.2,\n 'y0_nesterov': -3.8,\n 'x0_adagrad': -4,\n 'y0_adagrad': 4,\n 'x0_rmsprop': -4.2,\n 'y0_rmsprop': 3.8,\n 'x0_adam': -4,\n 'y0_adam': 4.2,\n },\n plot_params={\n 'azim': 15,\n 'elev': 60,\n 'rotation': -7\n })",
"_____no_output_____"
],
[
"func_title = 'himmelblau_function'\n\ndef f(x, y):\n return (x ** 2 + y - 11) ** 2 + (x + y ** 2 - 7) ** 2\n\ndef df(x, y):\n return (4 * x * (x ** 2 + y - 11) + 2 * (x + y ** 2 - 7),\n 2 * (x ** 2 + y - 11) + 4 * y * (x + y ** 2 - 7))\n\ncreate_and_save_animation(func_title, f, df,\n params={\n 'steps': 25,\n 'lr': .005,\n 'x0': 0,\n 'y0': -3,\n 'lr_adagrad': .5,\n 'lr_rmsprop': .5,\n 'lr_adam': .5\n },\n plot_params={\n 'azim': -29,\n 'elev': 70,\n 'rotation': 17\n })",
"_____no_output_____"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6bfbb686990ab8268d5e3cc88fdb4f5da61db1 | 138,241 | ipynb | Jupyter Notebook | notebooks/.ipynb_checkpoints/Interest-Rate-Regression-Model-LR-checkpoint.ipynb | ashleyadrias/lending-club-interest-rate-predictor-dash-app | 2c7f0856d473028f61e19d52d4484bdf96c81a3f | [
"MIT"
]
| null | null | null | notebooks/.ipynb_checkpoints/Interest-Rate-Regression-Model-LR-checkpoint.ipynb | ashleyadrias/lending-club-interest-rate-predictor-dash-app | 2c7f0856d473028f61e19d52d4484bdf96c81a3f | [
"MIT"
]
| null | null | null | notebooks/.ipynb_checkpoints/Interest-Rate-Regression-Model-LR-checkpoint.ipynb | ashleyadrias/lending-club-interest-rate-predictor-dash-app | 2c7f0856d473028f61e19d52d4484bdf96c81a3f | [
"MIT"
]
| 1 | 2022-02-07T07:16:22.000Z | 2022-02-07T07:16:22.000Z | 59.715335 | 50,988 | 0.572732 | [
[
[
"### Interest Rate Regression Model using Linear Regression+RandomCV\n\n- Five models were created. Three Interest Rate Regression Models and two Loan Default Classification Models\n- This notebook is a deep dive into the Linear Regression Model created to predict Loan Interest Rates.\n- We will begin by exploring the top features that affect Loan Interest Rates \n- We will then split the data into train/test sets before training the model\n- The evaluation metrics will be the R2 and Mean Absolute Error (MAE)",
"_____no_output_____"
],
[
"#### Import Packages and Data",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nimport warnings\nwarnings.filterwarnings(\"ignore\", category=FutureWarning)\n\npd.options.display.max_columns = None\npd.options.display.max_rows = None\npd.options.display.float_format = '{:.2f}'.format",
"_____no_output_____"
],
[
"data = pd.read_csv(\"lending-club-subset.csv\")",
"_____no_output_____"
],
[
"data.head()",
"_____no_output_____"
],
[
"data.shape",
"_____no_output_____"
]
],
[
[
"Choose meaningful features needed to run a correlation matrix. This will be used to observe the top features that affect Interest Rates",
"_____no_output_____"
]
],
[
[
"data = data[[\n 'loan_amnt'\n , 'funded_amnt'\n , 'funded_amnt_inv'\n , 'term'\n , 'int_rate'\n , 'installment'\n , 'grade'\n , 'sub_grade'\n , 'emp_title'\n , 'emp_length'\n , 'home_ownership'\n , 'annual_inc'\n , 'verification_status'\n , 'issue_d'\n , 'loan_status'\n , 'purpose'\n , 'addr_state'\n , 'dti'\n , 'delinq_2yrs'\n , 'fico_range_low'\n , 'fico_range_high'\n , 'inq_last_6mths'\n , 'mths_since_last_delinq'\n , 'mths_since_last_record'\n , 'open_acc'\n , 'pub_rec'\n , 'revol_bal'\n , 'revol_util'\n , 'total_acc'\n , 'initial_list_status'\n , 'acc_open_past_24mths'\n , 'mort_acc'\n , 'pub_rec_bankruptcies'\n , 'tax_liens'\n , 'earliest_cr_line'\n]]",
"_____no_output_____"
],
[
"# remove % sign and set to float\ndata['int_rate'] = data['int_rate'].str.replace('%', '')\ndata['int_rate'] = data['int_rate'].astype(float)\n\ndata['revol_util'] = data['revol_util'].str.replace('%', '')\ndata['revol_util'] = data['revol_util'].astype(float)\n\ndata.head()",
"_____no_output_____"
],
[
"data.isnull().sum()",
"_____no_output_____"
]
],
[
[
"### Feature Exploration\n\nPlotting Correlation matrix is a way to understand what features are correlated with eachother for with the target variable, which in this case is the Loan Interest Rate",
"_____no_output_____"
]
],
[
[
"# Create Corelation Matrix\ncorr = data.corr()\nplt.figure(figsize = (10, 8))\nsns.heatmap(corr)\nplt.show()",
"_____no_output_____"
],
[
"# Print the correlation values for all features with respect to interest rates\ncorr_int_rate = corr[['int_rate']]\ncorr_int_rate",
"_____no_output_____"
],
[
"# Top 10 positive features\ntop_10_pos = corr_int_rate[corr_int_rate['int_rate'] > 0].sort_values(by=['int_rate'],ascending=False)\ntop_10_pos",
"_____no_output_____"
],
[
"# Top 10 negative features\ntop_10_neg = corr_int_rate[corr_int_rate['int_rate']< 0].sort_values(by=['int_rate'],ascending=False)\ntop_10_neg",
"_____no_output_____"
]
],
[
[
"### Train/Test Split\nHere we will be split the data into a train and test set. The test set will be 30% of the data set",
"_____no_output_____"
]
],
[
[
"# Split Data \nfrom sklearn.model_selection import train_test_split\ntrain, test = train_test_split(data, test_size=0.30, random_state=42)\n\ntrain.shape, test.shape",
"_____no_output_____"
],
[
"#Create Train/Test sets\ntarget = 'int_rate'\nfeatures = train.columns.drop(['int_rate'\n ,'revol_bal'\n ,'loan_status'\n ,'funded_amnt'\n ,'grade'\n ,'sub_grade'\n ,'issue_d'\n ,'installment'\n , 'fico_range_high' \n , 'funded_amnt_inv']) # Here we are removing features that are not known prior to loan dispersion\n\nX_train = train[features]\ny_train = train[target]\n\nX_test = test[features]\ny_test = test[target]",
"_____no_output_____"
]
],
[
[
"### Train Linear Regression Model\n- Next, we will build a Linear Regression Model using Sklearn's pipeline. \n- The evaluations metrics will be R2 and Mean-Absolute-Error(MAE).\n- We will print out the K Best features selected by the SelectKBest Method.",
"_____no_output_____"
]
],
[
[
"from sklearn.feature_selection import f_regression, SelectKBest\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.metrics import mean_absolute_error,r2_score\nfrom sklearn.preprocessing import StandardScaler\nimport category_encoders as ce\nfrom sklearn.pipeline import make_pipeline\nfrom sklearn.impute import SimpleImputer\n\n\npipeline = make_pipeline(\n ce.OrdinalEncoder(),\n SimpleImputer(), \n SelectKBest(score_func=f_regression),\n LinearRegression()\n)\n\npipeline.fit(X_train, y_train)\n\ny_pred = pipeline.predict(X_test)\nmae = mean_absolute_error(y_test, y_pred)\nr2 = r2_score(y_test, y_pred)\n\n#Print Results\nprint(f'Test MAE: {mae:,.2f}% \\n')\nprint(f'Test R2: {r2:,.2f} \\n')",
"Test MAE: 2.31% \n\nTest R2: 0.38 \n\n"
],
[
"# Get features chosen by the selectkbest\nfeatures = pipeline.named_steps['selectkbest'].get_support()\nselected_feats = []\nfor count, item in enumerate(features):\n if item:\n selected_feats.append(count)\n\nlist(train.columns[selected_feats])",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb6c04d06445955a6bad474e0090ff8f10743911 | 315,566 | ipynb | Jupyter Notebook | mta_mvp.ipynb | aezazi/Metis_MTA_Proj | 73ab61b58eb0d6aec6b4fa4c10a067e29f713f0f | [
"Apache-2.0"
]
| null | null | null | mta_mvp.ipynb | aezazi/Metis_MTA_Proj | 73ab61b58eb0d6aec6b4fa4c10a067e29f713f0f | [
"Apache-2.0"
]
| null | null | null | mta_mvp.ipynb | aezazi/Metis_MTA_Proj | 73ab61b58eb0d6aec6b4fa4c10a067e29f713f0f | [
"Apache-2.0"
]
| null | null | null | 41.299045 | 10,120 | 0.437943 | [
[
[
"#### MTA Project mvp\n###### Project Goal\n- Generate data to facilitate micro-targeted advertising based on time of day and demographics.\n- I am focusing on the Canal St. station with one month of data, but the methodology and \ncode can be easily be applied to other stations and time frames.\n \n###### Milestone Reached\n- Designed and implemented methodology to reliably structure data to access traffic data by time intervals as small as four hours, by line name and station entrance.\n- While this is not direct demographic information, the line routes and time of day in combination, have the potential for demographic targeting\n- The data resulting from this analysis and processing for the Canal St. station for one month is the last cell in this notebook.\n\n\n###### Key Tasks Completed\n- Examined and purged data resulting from turnstile audits and resets\n- Identified, analyzed and purged data with negative net entires or exits\n- Identified, analyzed and as appropriate purged data with anomalously large entries/exits. Chose 1,500 \n per time interval per unique turnstile identifier as the cut-off\n- Identified, analyzed and purged data with 0 entries/exits. This data indicated a station/line closure on certain days\n- Analyzed data to confirm consistency of time intervals used by the system within each turnstile unit and line name\n- Performed analysis to confirm that each unique combination of turnstile identifyers CA, UNIT,\nand SCP are associated with a single line name. Looking at a map of NYC subway routes, line names claerly match specific entrances. Refer to next to last cell\n- Please refer to comments on notebook cells for more detail on specific tasks and process\n\n",
"_____no_output_____"
]
],
[
[
"reset -fs",
"_____no_output_____"
],
[
"import pandas as pd\nimport sqlalchemy as alchem\nfrom sqlalchemy import inspect\nfrom sqlalchemy import create_engine \nimport seaborn as sns\nimport matplotlib\nfrom matplotlib import pyplot as plt",
"_____no_output_____"
],
[
"engine = create_engine(\"sqlite:///sep_21.db\")\nengine.connect()",
"_____no_output_____"
],
[
"\"\"\"\nIn the next few cells, I just experiment with sqlalchemy and syntax. Here I'm creating a variable\nto define my column selections use it as part of string literal in a query\n\"\"\"\n\ncolumns_to_select = ['CA', 'UNIT', 'SCP', 'STATION', 'DATE', 'TIME', 'DESC', 'ENTRIES', 'EXITS']\nmy_select = 'SELECT '\n\nfor name in columns_to_select:\n my_select = my_select + name +', '\nmy_select = my_select[:-2]\nmy_select",
"_____no_output_____"
],
[
"\n\"\"\"\nJust a test a test to put a query in a dataframe\n\"\"\"\n\ntest_df = pd.read_sql(f'{my_select}\\\n FROM mta_data WHERE STATION = \"CANAL ST\";', \n engine)\ntest_df.sort_values(\"DATE\").tail()",
"_____no_output_____"
],
[
"test_df.info()",
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 12170 entries, 0 to 12169\nData columns (total 9 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 CA 12170 non-null object\n 1 UNIT 12170 non-null object\n 2 SCP 12170 non-null object\n 3 STATION 12170 non-null object\n 4 DATE 12170 non-null object\n 5 TIME 12170 non-null object\n 6 DESC 12170 non-null object\n 7 ENTRIES 12170 non-null int64 \n 8 EXITS 12170 non-null int64 \ndtypes: int64(2), object(7)\nmemory usage: 855.8+ KB\n"
],
[
"test_df.columns",
"_____no_output_____"
],
[
"\"\"\"\nLooking at recovery audits with a sqlalchemy query\n\"\"\"\n\npd.read_sql('SELECT *\\\n FROM mta_data WHERE STATION = \"CANAL ST\" \\\n AND NOT DESC = \"REGULAR\" \\\n ;', \\\n engine)",
"_____no_output_____"
],
[
"\n\"\"\"\nExamining data around audit anomalies with sqlalchemey query\n\n\"\"\"\n\npd.read_sql('SELECT *\\\n FROM mta_data \\\n WHERE STATION = \"CANAL ST\" \\\n AND TIME = \"21:00:00\" \\\n AND DATE = \"10/28/2021\"\\\n ;', \\\n engine)",
"_____no_output_____"
],
[
"pd.read_sql('SELECT *\\\n FROM mta_data WHERE STATION = \"CANAL ST\" \\\n AND TIME = \"20:00:00\" \\\n AND DATE = \"09/25/2021\"\\\n ;', \\\n engine)",
"_____no_output_____"
],
[
"pd.read_sql('SELECT *\\\n FROM mta_data \\\n WHERE STATION = \"CANAL ST\" AND DESC = \"REGULAR\" \\\n GROUP BY CA,UNIT,SCP;', \\\n engine)",
"_____no_output_____"
],
[
"pd.read_sql('SELECT *, COUNT(ENTRIES)\\\n FROM mta_data \\\n WHERE STATION = \"CANAL ST\" AND DESC = \"REGULAR\" \\\n GROUP BY LINENAME, DATE, TIME \\\n ORDER BY LINENAME;', engine).drop('DIVISION', axis = 1)",
"_____no_output_____"
],
[
"\"\"\"\nAt this point I have conducted some exploration and analyis with sqlalchemey queries. I pull data\ninto a dataframe, excluding any rows where DESC is not \"REGULAR\". This exlcudes all rows with \naudit resets.\n\"\"\"\n\ndf = pd.read_sql('SELECT *\\\n FROM mta_data \\\n WHERE STATION = \"CANAL ST\" AND DESC = \"REGULAR\" '\\\n , engine).drop('DIVISION', axis = 1)\ndf",
"_____no_output_____"
],
[
"df.info()",
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 12135 entries, 0 to 12134\nData columns (total 10 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 CA 12135 non-null object\n 1 UNIT 12135 non-null object\n 2 SCP 12135 non-null object\n 3 STATION 12135 non-null object\n 4 LINENAME 12135 non-null object\n 5 DATE 12135 non-null object\n 6 TIME 12135 non-null object\n 7 DESC 12135 non-null object\n 8 ENTRIES 12135 non-null int64 \n 9 EXITS 12135 non-null int64 \ndtypes: int64(2), object(8)\nmemory usage: 948.2+ KB\n"
],
[
"\"\"\"\nCreate columns for previous entires and exits with Shift \n\"\"\"\n\ndf[['prev_ent', 'prev_ex']] = df[['ENTRIES', 'EXITS']].shift(1)\ndf",
"_____no_output_____"
],
[
"\n\"\"\"\nCalculate columns for net entries and exists for each time interval and turnstile unit\n\"\"\"\n\ndf['net_ent'] = df.ENTRIES - df.prev_ent \ndf['net_ex'] = df.EXITS - df.prev_ex\ndf",
"_____no_output_____"
],
[
"\"\"\"\nDrop first row with Nan\n\"\"\"\ndf.drop(0, inplace = True)\ndf",
"_____no_output_____"
],
[
"# df['net_entries'] = df.ENTRIES.diff()\n# df['net_exits'] = df.EXITS.diff()\n# df",
"_____no_output_____"
],
[
"df[df.net_ent < 0]",
"_____no_output_____"
],
[
"\"\"\"\nExamine negative net entries\n\"\"\"\n\ndf[df.net_ent < 0]",
"_____no_output_____"
],
[
"\"\"\"\nCreating a mask to do some investigating around the time intervals (begining of new day)\nwhen net entries are negative.\n\"\"\"\n\nmask = ((df['net_ent'] < 0) &\n ((df['TIME'] == '01:00:00')|\n (df['TIME'] == '00:00:00'))\n )\ndf[mask]",
"_____no_output_____"
],
[
"\"\"\"\ncreating a mask to investigate time intervals other than midnight and 1am for negative net enteries\n\"\"\"\n\nmask = ((df['net_ent'] < 0) &\n (df['TIME'] != '01:00:00')&\n (df['TIME'] != '00:00:00')\n )\ndf[mask]",
"_____no_output_____"
],
[
"\"\"\"\nmask to investigate specific dates with anomalous entries\n\"\"\"\n\n\n\nmask = ((df['LINENAME'] == 'ACE') &\n ((df['DATE'] == '09/25/2021')|\n (df['DATE'] == '09/24/2021'))\n )\ndf[mask]\nmask2 = ((df['LINENAME'] == '1') &\n (df['DATE'] == '09/21/2021'))\ndf[mask2]",
"_____no_output_____"
],
[
"\"\"\"\nbased on the examinations in cells above, negative entries are clearly bad data.\nSo dropping all rows with negative net entries.\n\"\"\"\n\n\ndf.drop(df[df['net_ent']< 0].index, inplace = True)\ndf",
"_____no_output_____"
],
[
"mask = ((df['LINENAME'] == 'ACE') &\n ((df['DATE'] == '09/29/2021')|\n (df['DATE'] == '09/30/2021'))\n )\ndf[mask]",
"_____no_output_____"
],
[
"\"\"\"\nPerforming same analysis as above for net_exits\n\"\"\"\n\ndf[df.net_ex < 0]",
"_____no_output_____"
],
[
"\"\"\"\nAnd dropping all rows with negative net exits. Then just a check to make sure all rows with\nnegative net enteries or exits have been dropped\n\"\"\"\ndf.drop(df[df.net_ex < 0].index, inplace = True)\n\nprint(df[df.net_ent < 0])\nprint('-'*40 + '\\n')\nprint(df[df.net_ex < 0])\n",
"Empty DataFrame\nColumns: [CA, UNIT, SCP, STATION, LINENAME, DATE, TIME, DESC, ENTRIES, EXITS, prev_ent, prev_ex, net_ent, net_ex]\nIndex: []\n----------------------------------------\n\nEmpty DataFrame\nColumns: [CA, UNIT, SCP, STATION, LINENAME, DATE, TIME, DESC, ENTRIES, EXITS, prev_ent, prev_ex, net_ent, net_ex]\nIndex: []\n"
],
[
"\"\"\"\nlooking at the spread of net_entries as a start for identifying more anomalous data. \n\"\"\"\n\ndf.net_ent.nlargest(100)\ndf.sort_values('net_ent').tail(10)\ndf.net_ent.describe()",
"_____no_output_____"
],
[
"\"\"\"\nDidn't have great success in trying to figure out Seaborne\n\"\"\"\n\nplt.figure(figsize = (10, 5))\nsns.displot(df.net_ent, bins = 50)\nplt.show()",
"_____no_output_____"
],
[
"\"\"\"\nDecided to generate my own cumlative distribution data with parameters I can set.\nI then plot with matplot lib\n\"\"\"\ncum_count = []\nfor i in range(0, 3000, 10):\n cum_count.append(df[df.net_ent > i].count()[0])\n\nprint(cum_count)\n# plt.figure(figsize = (20, 25), dpi = 60)\n# sns.displot(cum_count, bins = 10)\n# plt.show()\n\nf, axs = plt.subplots(1,1, figsize = (15, 10))\nplt.xticks(range(0, 10000, 500))\naxs.hist(cum_count, bins = 10)\nplt.show()\n\ndf[df.net_ent > 2000].count()[0]",
"[10281, 7730, 6460, 5591, 4896, 4377, 3908, 3498, 3184, 2911, 2649, 2424, 2216, 2032, 1868, 1701, 1555, 1455, 1359, 1269, 1207, 1142, 1074, 1011, 937, 884, 816, 759, 698, 644, 595, 549, 507, 470, 449, 432, 416, 395, 374, 353, 343, 324, 313, 297, 281, 266, 252, 237, 226, 220, 214, 209, 205, 199, 193, 187, 183, 182, 177, 173, 168, 166, 164, 159, 156, 151, 143, 140, 138, 138, 137, 134, 134, 133, 133, 133, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129]\n"
],
[
"\"\"\"\nBased on the above analysis, it seems reasonable to assume any data for net entries greater than \n1500 in a four hour time interval at a unique CA/UNIT/SCP turnstile is anomalous and should be dropped\n\"\"\"\n\ndf.drop(df[df.net_ent > 1500].index, inplace = True)\n",
"_____no_output_____"
],
[
"\"\"\"\nJust a check to see what the distribution looks like after I drop rows with greater than 1500 net entries\n\"\"\"\n\ncum_count = []\nfor i in range(0, 3000, 10):\n cum_count.append(df[df.net_ent > i].count()[0])\n\nprint(cum_count)\n# plt.figure(figsize = (20, 25), dpi = 60)\n# sns.displot(cum_count, bins = 10)\n# plt.show()\n\nf, axs = plt.subplots(1,1, figsize = (15, 10))\nplt.xticks(range(0, 10000, 500))\naxs.hist(cum_count, bins = 10)\nplt.show()\n\ndf[df.net_ent > 720].count()[0]",
"[10151, 7600, 6330, 5461, 4766, 4247, 3778, 3368, 3054, 2781, 2519, 2294, 2086, 1902, 1738, 1571, 1425, 1325, 1229, 1139, 1077, 1012, 944, 881, 807, 754, 686, 629, 568, 514, 465, 419, 377, 340, 319, 302, 286, 265, 244, 223, 213, 194, 183, 167, 151, 136, 122, 107, 96, 90, 84, 79, 75, 69, 63, 57, 53, 52, 47, 43, 38, 36, 34, 29, 26, 21, 13, 10, 8, 8, 7, 4, 4, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"
],
[
"\"\"\"\nNet_exit anomalies have been addressed by droping the net_entries anomalies.\nSo no further adjustment necessary\n\"\"\"\n\ncum_count = []\nfor i in range(0, 3000, 10):\n cum_count.append(df[df.net_ex > i].count()[0])\n\nprint(cum_count)\n\nf, axs = plt.subplots(1,1, figsize = (15, 10))\nplt.xticks(range(0, 10000, 500))\naxs.hist(cum_count, bins = 10)\nplt.show()\n\ndf[df.net_ex > 900].count()[0]",
"[10530, 7964, 6839, 6114, 5506, 4982, 4574, 4220, 3880, 3548, 3259, 2987, 2776, 2611, 2444, 2292, 2162, 2037, 1913, 1790, 1682, 1577, 1481, 1397, 1305, 1219, 1128, 1045, 964, 886, 817, 749, 698, 648, 597, 545, 498, 467, 423, 388, 362, 343, 312, 283, 267, 249, 227, 202, 181, 165, 150, 133, 110, 102, 100, 90, 86, 83, 78, 69, 65, 63, 58, 55, 52, 46, 42, 39, 35, 31, 28, 26, 21, 19, 18, 15, 15, 14, 13, 12, 10, 10, 9, 9, 8, 6, 6, 6, 5, 5, 5, 5, 5, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"
],
[
"\"\"\"\nNow I'm checking for days when then there were 0 entries.\nBy examining the head and tail of the data, it appears all 0 entires are associated with\nthe JNQRZ6W line and corresponding portion of the canal st. station complex. It's reasonable to assume\nthat these 0 entries are due to a station or line closure. So these data points should be dropped\n\"\"\"\nprint(df[df.ENTRIES == 0].head(10))\nprint(df[df.ENTRIES == 0].tail(10))\ndf.drop(df[df.ENTRIES == 0].index, inplace = True)\n",
" CA UNIT SCP STATION LINENAME DATE TIME DESC \\\n836 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/23/2021 05:00:00 REGULAR \n837 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/23/2021 09:00:00 REGULAR \n838 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/23/2021 13:00:00 REGULAR \n839 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/23/2021 17:00:00 REGULAR \n840 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/23/2021 21:00:00 REGULAR \n841 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/24/2021 01:00:00 REGULAR \n842 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/24/2021 05:00:00 REGULAR \n843 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/24/2021 09:00:00 REGULAR \n844 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/24/2021 13:00:00 REGULAR \n845 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/24/2021 17:00:00 REGULAR \n\n ENTRIES EXITS prev_ent prev_ex net_ent net_ex \n836 0 583 0.0 583.0 0.0 0.0 \n837 0 583 0.0 583.0 0.0 0.0 \n838 0 583 0.0 583.0 0.0 0.0 \n839 0 583 0.0 583.0 0.0 0.0 \n840 0 583 0.0 583.0 0.0 0.0 \n841 0 583 0.0 583.0 0.0 0.0 \n842 0 583 0.0 583.0 0.0 0.0 \n843 0 583 0.0 583.0 0.0 0.0 \n844 0 583 0.0 583.0 0.0 0.0 \n845 0 583 0.0 583.0 0.0 0.0 \n CA UNIT SCP STATION LINENAME DATE TIME DESC \\\n10590 A046 R463 00-05-03 CANAL ST JNQRZ6W 09/30/2021 09:00:00 REGULAR \n10591 A046 R463 00-05-03 CANAL ST JNQRZ6W 09/30/2021 13:00:00 REGULAR \n10592 A046 R463 00-05-03 CANAL ST JNQRZ6W 09/30/2021 17:00:00 REGULAR \n10593 A046 R463 00-05-03 CANAL ST JNQRZ6W 09/30/2021 21:00:00 REGULAR \n10594 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/01/2021 01:00:00 REGULAR \n10595 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/01/2021 05:00:00 REGULAR \n10596 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/01/2021 09:00:00 REGULAR \n10597 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/01/2021 13:00:00 REGULAR \n10598 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/01/2021 17:00:00 REGULAR \n10599 A046 R463 00-05-03 CANAL ST JNQRZ6W 10/01/2021 21:00:00 REGULAR \n\n ENTRIES EXITS prev_ent prev_ex net_ent net_ex \n10590 0 582 0.0 582.0 0.0 0.0 \n10591 0 582 0.0 582.0 0.0 0.0 \n10592 0 582 0.0 582.0 0.0 0.0 \n10593 0 582 0.0 582.0 0.0 0.0 \n10594 0 582 0.0 582.0 0.0 0.0 \n10595 0 582 0.0 582.0 0.0 0.0 \n10596 0 582 0.0 582.0 0.0 0.0 \n10597 0 582 0.0 582.0 0.0 0.0 \n10598 0 582 0.0 582.0 0.0 0.0 \n10599 0 582 0.0 582.0 0.0 0.0 \n"
],
[
"\"\"\"\nPerforming the same analysis as above for days with 0 exits.\nIt again appears all 0 exits are associated with the JNQRZ6W line and corresponding portion of \nthe canal st. station complex and on the same days as 0 entries thus reinforcing the hypothesis\nthat there was some sort line/station closure. So these data points should be dropped as well\n\"\"\"\nprint(df[df.EXITS == 0].head(10))\nprint(df[df.EXITS == 0].tail(10))\ndf.drop(df[df.EXITS == 0].index, inplace = True)\n",
" CA UNIT SCP STATION LINENAME DATE TIME DESC \\\n715 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/23/2021 05:00:00 REGULAR \n716 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/23/2021 09:00:00 REGULAR \n717 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/23/2021 13:00:00 REGULAR \n718 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/23/2021 17:00:00 REGULAR \n719 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/23/2021 21:00:00 REGULAR \n720 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/24/2021 01:00:00 REGULAR \n721 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/24/2021 05:00:00 REGULAR \n722 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/24/2021 09:00:00 REGULAR \n723 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/24/2021 13:00:00 REGULAR \n724 A046 R463 00-05-00 CANAL ST JNQRZ6W 10/24/2021 17:00:00 REGULAR \n\n ENTRIES EXITS prev_ent prev_ex net_ent net_ex \n715 4428 0 4428.0 0.0 0.0 0.0 \n716 4428 0 4428.0 0.0 0.0 0.0 \n717 4428 0 4428.0 0.0 0.0 0.0 \n718 4429 0 4428.0 0.0 1.0 0.0 \n719 4429 0 4429.0 0.0 0.0 0.0 \n720 4429 0 4429.0 0.0 0.0 0.0 \n721 4429 0 4429.0 0.0 0.0 0.0 \n722 4429 0 4429.0 0.0 0.0 0.0 \n723 4429 0 4429.0 0.0 0.0 0.0 \n724 4429 0 4429.0 0.0 0.0 0.0 \n CA UNIT SCP STATION LINENAME DATE TIME DESC \\\n10548 A046 R463 00-05-02 CANAL ST JNQRZ6W 09/30/2021 09:00:00 REGULAR \n10549 A046 R463 00-05-02 CANAL ST JNQRZ6W 09/30/2021 13:00:00 REGULAR \n10550 A046 R463 00-05-02 CANAL ST JNQRZ6W 09/30/2021 17:00:00 REGULAR \n10551 A046 R463 00-05-02 CANAL ST JNQRZ6W 09/30/2021 21:00:00 REGULAR \n10552 A046 R463 00-05-02 CANAL ST JNQRZ6W 10/01/2021 01:00:00 REGULAR \n10553 A046 R463 00-05-02 CANAL ST JNQRZ6W 10/01/2021 05:00:00 REGULAR \n10554 A046 R463 00-05-02 CANAL ST JNQRZ6W 10/01/2021 09:00:00 REGULAR \n10555 A046 R463 00-05-02 CANAL ST JNQRZ6W 10/01/2021 13:00:00 REGULAR \n10556 A046 R463 00-05-02 CANAL ST JNQRZ6W 10/01/2021 17:00:00 REGULAR \n10557 A046 R463 00-05-02 CANAL ST JNQRZ6W 10/01/2021 21:00:00 REGULAR \n\n ENTRIES EXITS prev_ent prev_ex net_ent net_ex \n10548 1028 0 1028.0 0.0 0.0 0.0 \n10549 1028 0 1028.0 0.0 0.0 0.0 \n10550 1028 0 1028.0 0.0 0.0 0.0 \n10551 1028 0 1028.0 0.0 0.0 0.0 \n10552 1028 0 1028.0 0.0 0.0 0.0 \n10553 1028 0 1028.0 0.0 0.0 0.0 \n10554 1028 0 1028.0 0.0 0.0 0.0 \n10555 1028 0 1028.0 0.0 0.0 0.0 \n10556 1028 0 1028.0 0.0 0.0 0.0 \n10557 1028 0 1028.0 0.0 0.0 0.0 \n"
],
[
"\"\"\"\nAnalyzing time interval consistency by line name. This is good news since there are no anomalous \ntime intervals within each line. The time intervals for the ACE lines are slightly different than the \nothers, but for the purposes of my study, this does not present an issue\n\"\"\"\n\ntime_set_ACE = set(df[df.LINENAME == 'ACE'].TIME)\ntime_set_J = set(df[df.LINENAME == 'JNQRZ6W'].TIME)\ntime_set_1 = set(df[df.LINENAME == 'JNQRZ6W'].TIME)\n\nprint(time_set_ACE)\nprint(time_set_J)\nprint(time_set_1)",
"{'16:00:00', '00:00:00', '04:00:00', '08:00:00', '20:00:00', '12:00:00'}\n{'09:00:00', '13:00:00', '17:00:00', '21:00:00', '01:00:00', '05:00:00'}\n{'09:00:00', '13:00:00', '17:00:00', '21:00:00', '01:00:00', '05:00:00'}\n"
],
[
"\"\"\" \nAdd columns:\n> calculate net_entry + net_exit. This is a good proxy for total traffic around the station\n> calculate net_entry - net_exit. This is an indication of traffic direction and perhaps a hint at demographics\n> date_time for later analyis potentiall against other data such as weather or covid news etc\n> day of week for later analysis based on day of week\n\"\"\"\n\ndf['n_ent + n_ex'] = df.net_ent + df.net_ex\ndf['n_ent - n_ex'] = df.net_ent - df.net_ex\ndf['date_time'] = pd.to_datetime(df.DATE + \" \" + df.TIME, \n format=\"%m/%d/%Y %H:%M:%S\")\n\ndf['weekday'] = df['date_time'].dt.day_name()\n\ndf",
"_____no_output_____"
],
[
"\n\"\"\"\nBased on some of the analysis above, I noticed that unique combinations of turnstile identifyers CA, UNIT,\nSCP are associated with a single line name. The code below confirms that this is the case. I loop over the \ndataframe, isolating each line name at this station, then generate a string combination of CA, UNIT,\nSCP for each row and store that in a set for that line name. \n\nI end up with a set, for each line name of unique combinations of CA, UNIT, and SCP. I then check for \nintersections between these sets which are empty. so this tells me that I can isolate traffic data by line\nname and time interval. When I look at a NYC subway map, the line names cleary match up to different enterances\nof the Canal st. complex. So his allows me to analyze data based on time intervals as small as 4 hours\nby enterance/line. This is a very good start at micro targeting advertising.\n\"\"\"\n\n\n\nstiles_id_ace = set()\nstiles_id_j = set()\nstiles_id_1 = set()\n\nfor row in df.itertuples(index = True):\n if (row.LINENAME == 'ACE'):\n stiles_id_ace.add(getattr(row, \"CA\") + getattr(row, \"UNIT\") + getattr(row, \"SCP\") )\nprint(stiles_id_ace)\nprint('-'*30 + '\\n')\n\nfor row in df.itertuples(index = True):\n if (row.LINENAME == 'JNQRZ6W'):\n stiles_id_j.add(getattr(row, \"CA\") + getattr(row, \"UNIT\") + getattr(row, \"SCP\") )\nprint(stiles_id_j)\nprint('-'*30 + '\\n')\n\nfor row in df.itertuples(index = True):\n if (row.LINENAME == '1'):\n stiles_id_1.add(getattr(row, \"CA\") + getattr(row, \"UNIT\") + getattr(row, \"SCP\") )\nprint(stiles_id_1)\nprint('-'*30 + '\\n')\n\n\nprint(stiles_id_ace.intersection(stiles_id_j))\nprint(stiles_id_ace.intersection(stiles_id_1))\nprint(stiles_id_j.intersection(stiles_id_1))\n",
"{'N089R13900-04-01', 'N089R13900-00-00', 'N090R13901-00-01', 'N090R13901-05-00', 'N089R13900-06-01', 'N089R13900-03-00', 'N089R13900-04-02', 'N089R13900-06-02', 'N089R13900-06-00', 'N089R13900-03-01', 'N090R13901-00-02', 'N090R13901-06-00', 'N089R13900-03-02', 'N089R13900-00-01', 'N090R13901-03-00', 'N089R13900-04-00', 'N090R13901-00-00', 'N090R13901-06-01', 'N089R13900-00-02'}\n------------------------------\n\n{'A043R46200-03-03', 'A043R46200-06-00', 'A046R46300-06-07', 'A046R46300-06-01', 'A043R46200-06-01', 'A046R46300-00-00', 'A043R46200-00-02', 'A046R46300-06-06', 'A046R46300-03-01', 'A043R46200-03-00', 'A043R46200-03-02', 'A046R46300-00-03', 'A046R46300-00-02', 'A043R46200-03-04', 'A046R46300-06-03', 'A046R46300-06-08', 'A043R46200-00-01', 'A046R46300-00-01', 'A046R46300-06-02', 'A066R11800-00-02', 'A046R46300-06-00', 'A046R46300-06-05', 'A066R11800-00-01', 'A043R46200-03-01', 'A046R46300-06-04', 'A043R46200-00-00', 'A046R46300-05-02', 'A043R46200-06-02', 'A046R46300-03-00', 'A046R46300-05-01'}\n------------------------------\n\n{'R119R32000-00-01', 'R120R32001-00-02', 'R120R32001-00-01', 'R120R32001-00-00', 'R119R32000-00-02', 'R119R32000-00-00'}\n------------------------------\n\nset()\nset()\nset()\n"
],
[
"\"\"\"\nThe data, grouped by line name, is now in a form that will facilitate at least some micro targerted advertising.\n\"\"\"\n\n\ndf.groupby(['LINENAME', 'DATE', 'TIME']).head(130)",
"_____no_output_____"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6c05312133e9031c821a4d01cb8e2ebdb0ad85 | 28,400 | ipynb | Jupyter Notebook | Vacation_Itinerary/Vacation_Itinerary.ipynb | madbee99/World_Weather_Analysis1 | ee7f20d15a4702d20982666601f9dc3122e38797 | [
"MIT"
]
| null | null | null | Vacation_Itinerary/Vacation_Itinerary.ipynb | madbee99/World_Weather_Analysis1 | ee7f20d15a4702d20982666601f9dc3122e38797 | [
"MIT"
]
| null | null | null | Vacation_Itinerary/Vacation_Itinerary.ipynb | madbee99/World_Weather_Analysis1 | ee7f20d15a4702d20982666601f9dc3122e38797 | [
"MIT"
]
| null | null | null | 30.309498 | 131 | 0.418486 | [
[
[
"## Deliverable 3. Create a Travel Itinerary Map.",
"_____no_output_____"
]
],
[
[
"# Dependencies and Setup\nimport pandas as pd\nimport requests\nimport gmaps\n\n# Import API key\nimport sys\nsys.path.append('../')\nfrom config import g_key\n\n# Configure gmaps\ngmaps.configure(api_key=g_key)",
"_____no_output_____"
],
[
"# 1. Read the WeatherPy_vacation.csv into a DataFrame.\nvacation_df = pd.read_csv(\"../Vacation_Search/WeatherPy_vacation.csv\")\nvacation_df.head()",
"_____no_output_____"
],
[
"# 2. Using the template add the city name, the country code, the weather description and maximum temperature for the city.\ninfo_box_template = \"\"\"\n<dl>\n<dt>Hotel Name</dt><dd>{Hotel Name}</dd>\n<dt>City</dt><dd>{City}</dd>\n<dt>Country</dt><dd>{Country}</dd>\n<dt>Current Weather</dt><dd>{Current Description} and {Max Temp} °F</dd>\n</dl>\n\"\"\"\n\n# 3a. Get the data from each row and add it to the formatting template and store the data in a list.\nhotel_info = [info_box_template.format(**row) for index, row in vacation_df.iterrows()]\n\n# 3b. Get the latitude and longitude from each row and store in a new DataFrame.\nlocations = vacation_df[[\"Lat\", \"Lng\"]]",
"_____no_output_____"
],
[
"# 4a. Add a marker layer for each city to the map.\nmarker_layer = gmaps.marker_layer(locations, info_box_content = hotel_info)\nfig = gmaps.figure()\nfig.add_layer(marker_layer)\n\n# 4b. Display the figure\nfig\n",
"_____no_output_____"
],
[
"# From the map above pick 4 cities and create a vacation itinerary route to travel between the four cities. \n# 5. Create DataFrames for each city by filtering the 'vacation_df' using the loc method. \n# Hint: The starting and ending city should be the same city.\n\nvacation_start = vacation_df.loc[vacation_df[\"City\"] == \"Pacific Grove\"]\nvacation_end = vacation_df.loc[vacation_df[\"City\"] == \"Pacific Grove\"]\nvacation_stop1 = vacation_df.loc[vacation_df[\"City\"] == \"Half Moon Bay\"]\nvacation_stop2 = vacation_df.loc[vacation_df[\"City\"] == \"Eureka\"] \nvacation_stop3 = vacation_df.loc[vacation_df[\"City\"] == \"Truckee\"] ",
"_____no_output_____"
],
[
"vacation_start",
"_____no_output_____"
],
[
"vacation_end",
"_____no_output_____"
],
[
"vacation_stop1",
"_____no_output_____"
],
[
"vacation_stop2 ",
"_____no_output_____"
],
[
"vacation_stop3",
"_____no_output_____"
],
[
"# 6. Get the latitude-longitude pairs as tuples from each city DataFrame using the to_numpy function and list indexing.\nstart = vacation_start.to_numpy()[0, 5], vacation_start.to_numpy()[0, 6]\nend = vacation_end.to_numpy()[0, 5], vacation_end.to_numpy()[0, 6]\nstop1 = vacation_stop1.to_numpy()[0, 5], vacation_stop1.to_numpy()[0, 6]\nstop2 = vacation_stop2.to_numpy()[0, 5], vacation_stop2.to_numpy()[0, 6]\nstop3 = vacation_stop3.to_numpy()[0, 5], vacation_stop3.to_numpy()[0, 6]",
"_____no_output_____"
],
[
"# 7. Create a direction layer map using the start and end latitude-longitude pairs,\n# and stop1, stop2, and stop3 as the waypoints. The travel_mode should be \"DRIVING\", \"BICYCLING\", or \"WALKING\".\n\nfig = gmaps.figure()\nvacation_itinerary = gmaps.directions_layer(\n start, end, waypoints = [stop1, stop2, stop3],\n travel_mode = \"DRIVING\"\n)\nfig.add_layer(vacation_itinerary)\nfig",
"_____no_output_____"
],
[
"# 8. To create a marker layer map between the four cities.\n# Combine the four city DataFrames into one DataFrame using the concat() function.\nitinerary_df = pd.concat([vacation_start, vacation_stop1, vacation_stop2, vacation_stop3],ignore_index=True)\nitinerary_df",
"_____no_output_____"
],
[
"itinerary_df.reset_index(drop = True)",
"_____no_output_____"
],
[
"# 9 Using the template add city name, the country code, the weather description and maximum temperature for the city. \ninfo_box_template = \"\"\"\n<dl>\n<dt>Hotel Name</dt><dd>{Hotel Name}</dd>\n<dt>City</dt><dd>{City}</dd>\n<dt>Country</dt><dd>{Country}</dd>\n<dt>Current Weather</dt><dd>{Current Description} and {Max Temp} °F</dd>\n</dl>\n\"\"\"\n\n# 10a Get the data from each row and add it to the formatting template and store the data in a list.\nhotel_info = [info_box_template.format(**row) for index, row in itinerary_df.iterrows()]\n\n# 10b. Get the latitude and longitude from each row and store in a new DataFrame.\nlocations = itinerary_df[[\"Lat\", \"Lng\"]]",
"_____no_output_____"
],
[
"# 11a. Add a marker layer for each city to the map.\nmarker_layer = gmaps.marker_layer(locations, info_box_content = hotel_info)\nfig = gmaps.figure()\nfig.add_layer(marker_layer)\n\n# 11b. Display the figure\nfig",
"_____no_output_____"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6c05b8188aa3c6ca7bb0214c2ae2067485f06e | 56,837 | ipynb | Jupyter Notebook | notebooks/Using Biopython PDB Header Parser to get missing residues.ipynb | fomightez/cl_demo-binder | 963978c783b785dbf79c706e27b0c0a43f51ab5d | [
"MIT"
]
| null | null | null | notebooks/Using Biopython PDB Header Parser to get missing residues.ipynb | fomightez/cl_demo-binder | 963978c783b785dbf79c706e27b0c0a43f51ab5d | [
"MIT"
]
| null | null | null | notebooks/Using Biopython PDB Header Parser to get missing residues.ipynb | fomightez/cl_demo-binder | 963978c783b785dbf79c706e27b0c0a43f51ab5d | [
"MIT"
]
| 1 | 2022-03-16T02:49:36.000Z | 2022-03-16T02:49:36.000Z | 32.62744 | 1,395 | 0.396414 | [
[
[
"# Using Biopython's PDB Header parser to get missing residues\n\n\nPreviously this worked out and had to be run at that time with a development version of Biopython that I got working [here](https://github.com/fomightez/BernBiopython). Now current Bioython has the essential functionality about missing residues in structure files, and so this notebook can be run here where the current Biopython is installed.\n\nYou may also be interested in the notebook entitled, 'Using Biopython's PDB module to list resolved residues and construct fit commands'. Think of this notebook as complementing that one. Depending on what you are trying to do (or use as the source of information), that one may be better suited.",
"_____no_output_____"
]
],
[
[
"#get stuctures\nimport os\nfiles_needed = [\"6AGB.pdb\",\"6AH3.pdb\"]\nfor file_needed in files_needed:\n if not os.path.isfile(file_needed):\n #os.system(f\"curl -OL https://files.rcsb.org/download/{file_needed}.gz\") #version of next line that works outside Jupyter/IPython\n !curl -OL https://files.rcsb.org/download/{file_needed}.gz # gives more feedback in Jupyter\n # os.system(f\"gunzip {file_needed}.gz\") #version of next line that works outside Jupyter/IPYthon\n !gunzip {file_needed}.gz",
" % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 491k 100 491k 0 0 666k 0 --:--:-- --:--:-- --:--:-- 665k\n % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n100 519k 100 519k 0 0 872k 0 --:--:-- --:--:-- --:--:-- 871k\n"
],
[
"from Bio.PDB import *\nh =parse_pdb_header('6AGB.pdb')\nh['has_missing_residues']",
"_____no_output_____"
],
[
"from Bio.PDB import *\nh =parse_pdb_header('6AGB.pdb')\nh['missing_residues']",
"_____no_output_____"
],
[
"# Missing residue positions for specific chains\nfrom Bio.PDB import *\nfrom collections import defaultdict\nh =parse_pdb_header('6AGB.pdb')\n#parse per chain\nchains_of_interest = [\"F\",\"G\"]\n# make a dictionary for each chain of interest with value of a list. The list will be the list of residues later\nmissing_per_chain = defaultdict(list)\n# go through missing residues and populate each chain's list\nfor residue in h['missing_residues']:\n if residue[\"chain\"] in chains_of_interest:\n missing_per_chain[residue[\"chain\"]].append(residue[\"ssseq\"])\n#print(missing_per_chain)\n\n\n\nprint('')\nprint(\"Missing from chain 'G':\\n{}\".format(missing_per_chain['G']))\nprint('\\n\\n')\nfor chain in missing_per_chain:\n print(chain,missing_per_chain[chain])",
"\nMissing from chain 'G':\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 108, 109, 110, 111, 112, 113, 114]\n\n\n\nF [1]\nG [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 108, 109, 110, 111, 112, 113, 114]\n"
],
[
"# Missing residue positions for ALL chains\nfrom Bio.PDB import *\nfrom collections import defaultdict\n# extract information on chains in structure\nstructure = PDBParser().get_structure('6AGB', '6AGB.pdb')\nchains = [each.id for each in structure.get_chains()]\n\nh =parse_pdb_header('6AGB.pdb')\n\n# make a dictionary for each chain of interest with value of a list. The list will be the list of residue positions later\nmissing_per_chain = defaultdict(list)\n# go through missing residues and populate each chain's list\nfor residue in h['missing_residues']:\n if residue[\"chain\"] in chains:\n missing_per_chain[residue[\"chain\"]].append(residue[\"ssseq\"])\nprint(missing_per_chain)\n\n\n\nprint('')\nprint(\"Missing from chain 'K':\\n{}\".format(missing_per_chain['K']))",
"defaultdict(<class 'list'>, {'B': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 525, 526, 527, 528, 529, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 743, 744, 745, 746, 747, 748, 749, 750, 751], 'C': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 189, 190, 191, 192, 193, 194, 195], 'D': [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76], 'E': [1, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173], 'F': [1], 'G': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 108, 109, 110, 111, 112, 113, 114], 'H': [1, 2], 'I': [243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293], 'K': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]})\n\nMissing from chain 'K':\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]\n"
]
],
[
[
"----\n\n#### Compare two structures",
"_____no_output_____"
]
],
[
[
"# Does 6AH3 have any residues missing that 6AGB doesn't, for chains shared between them?\nfrom Bio.PDB import *\nfrom collections import defaultdict\n# extract information on chains in structure\nstructure = PDBParser().get_structure('6AGB', '6AGB.pdb') # USING CHAIN LISTING FROM THAT BECAUSE ONLY CARE ABOUT ONES SHARED\nchains = [each.id for each in structure.get_chains()]\n\nh =parse_pdb_header('6AH3.pdb')\n\n# make a dictionary for each chain of interest with value of a list. The list will be the list of residue positions later\nmissing_per_chainh3 = defaultdict(list)\n# go through missing residues and populate each chain's list\nfor residue in h['missing_residues']:\n if residue[\"chain\"] in chains:\n missing_per_chainh3[residue[\"chain\"]].append(residue[\"ssseq\"])\nprint(\"Missing from chains in AGH3:\\n{}\".format(missing_per_chainh3))\n\n\n\nprint('')\nprint(\"Missing from chain 'K':\\n{}\".format(missing_per_chainh3['K']))\n\nprint ('')\nsame_result = missing_per_chainh3 == missing_per_chain\nprint(\"Same residues missing for chains shared by 6AGB and 6AH3?:\\n{}\".format(same_result))\nprint ('')\nprint(\"Chain by chain accounting of whether missing same residues between 6AGB and 6AH3?:\")\nsame_residues_present_list = []\nfor chain in chains:\n print(chain)\n print (missing_per_chainh3[chain] == missing_per_chain[chain])\n if missing_per_chainh3[chain] != missing_per_chain[chain]:\n same_residues_present_list.append(chain)\nprint(\"\\n\\nFurther details on those chains where not the same residues missing:\")\nfor chain in same_residues_present_list:\n print(\"chain '{}' in 6AH3 has more missing residues than 6AGB:\\n{}\".format(chain,len(missing_per_chainh3[chain]) > len(missing_per_chain[chain]) ))\n print(\"\\ntotal # residues missing in chain '{}' of 6AH3: {}\".format(chain,len(missing_per_chainh3[chain]) ))\n print(\"total # residues missing in chain '{}' of 6AGB: {}\\n\".format(chain,len(missing_per_chain[chain]) ))",
"Missing from chains in AGH3:\ndefaultdict(<class 'list'>, {'B': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 525, 526, 527, 528, 529, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 743, 744, 745, 746, 747, 748, 749, 750, 751], 'C': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 189, 190, 191, 192, 193, 194, 195], 'D': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76], 'E': [1, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173], 'F': [1], 'G': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 108, 109, 110, 111, 112, 113, 114], 'H': [1, 2], 'I': [243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293], 'K': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]})\n\nMissing from chain 'K':\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]\n\nSame residues missing for chains shared by 6AGB and 6AH3?:\nFalse\n\nChain by chain accounting of whether missing same residues between 6AGB and 6AH3?:\nA\nTrue\nB\nTrue\nC\nTrue\nD\nFalse\nE\nTrue\nF\nTrue\nG\nTrue\nH\nTrue\nI\nTrue\nJ\nTrue\nK\nTrue\n\n\nFurther details on those chains where not the same residues missing:\nchain 'D' in 6AH3 has more missing residues than 6AGB:\nTrue\n\ntotal # residues missing in chain 'D' of 6AH3: 76\ntotal # residues missing in chain 'D' of 6AGB: 52\n\n"
]
],
[
[
"Chain D is the only one with differences. The one in 6AGB(without the substrate) has more residues total, as it has less missing. (**Note that depending on how the gaps are distributed the the chain with the most residues may not have more information than the other for a region you are particularly interested in. It is just a rough metric and you should look into details. The 'Protein' tab at [PDBsum](https://www.ebi.ac.uk/thornton-srv/databases/cgi-bin/pdbsum/GetPage.pl?pdbcode=index.html) is particularly useful for comparing missing residues in specific regions of proteins in structures.**)\n\nPython's set math can be used to look into some of the specific missing residues. Here that is done to provide some insight into the parts to examine for Chain D:",
"_____no_output_____"
]
],
[
[
"# How does Chain D compare specifically:\nprint(\"total missing:\",len(missing_per_chain['D']))\nprint(\"total missing:\",len(missing_per_chainh3['D']))\nA= set(missing_per_chainh3['D'])\nB= set(missing_per_chain['D']) \nprint(\"These are missing in 6AH3 Chain D but present in 6AGB:\",A-B) # set math based on https://stackoverflow.com/a/1830195/8508004\nprint(\"These are present in 6AH3 Chain D but missing in 6AGB:\",B-A) # set math based on https://stackoverflow.com/a/1830195/8508004",
"total missing: 52\ntotal missing: 76\nThese are missing in 6AH3 Chain D but present in 6AGB: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}\nThese are present in 6AH3 Chain D but missing in 6AGB: set()\n"
]
],
[
[
"Note that there are none present in 6AH3 Chain D but missing in 6AGB and so the result is an empty set for this case.",
"_____no_output_____"
],
[
"---- ",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
]
]
|
cb6c08c153a8f56b76b24c03da12dd04ffd4f13d | 6,883 | ipynb | Jupyter Notebook | welcome.ipynb | holdfest/2019-12-03-intro-to-python-workshop | 51e0914cdad2749d234f9413b072612b397ec957 | [
"MIT"
]
| null | null | null | welcome.ipynb | holdfest/2019-12-03-intro-to-python-workshop | 51e0914cdad2749d234f9413b072612b397ec957 | [
"MIT"
]
| null | null | null | welcome.ipynb | holdfest/2019-12-03-intro-to-python-workshop | 51e0914cdad2749d234f9413b072612b397ec957 | [
"MIT"
]
| null | null | null | 29.41453 | 226 | 0.569083 | [
[
[
"# Software Carpentry\n\n# Welcome to Binder\n\nThis is where will do all our Python, Shell and Git live coding.\n\n",
"_____no_output_____"
],
[
"## Jupyter Lab\n\nLet's quickly familiarise ourselves with the enironment ... \n\n- the overal environment (ie your entire browser tab) is called:\n\n *Jupyter Lab*\n \n it contains menus, tabs, toolbars and a file browser\n \n- Jupyter Lab allows you to *launch* files and application into the *Work Area*. Right now you probably have two tabs in the *Work Area* - this document an another tab called *Launcher*.\n \n\n",
"_____no_output_____"
],
[
"## Juptyer Notebooks\n\n- this document is document is called an:\n\n *Interactive Python Notebook* (or Notebook for short)\n\nNotebooks are a documents (files) made up of a sequence of *cells* that contain either code (python in our case) or documentation (text, or formatted text called *markdown*).\n",
"_____no_output_____"
],
[
"### Cells\n\nThe three types of Cells are:\n\n - *Markdown* - formatted text like this cell (with *italics*, **bold** and tables etc ...)\n - *Raw* - like the following cell, and\n - *Code* - (in our case) python code \n\nCells can be modified by simply clicking inside them and typing.\n\nSee if you can change the cell below by replacing *exciting* with something more exciting.",
"_____no_output_____"
]
],
[
[
"RAW CELL\n\nThis Cell is a 'Raw' Cell - it's just boring text.",
"_____no_output_____"
]
],
[
[
"#### Executing Cells\n\nBoth *markdown* and *code* cells can be executed.\n\nExcuting a *markdown* causes the *formatted* version of the cell to be displayed. Executing a *code* cell causes the code to run and any results are displayed below the cell.\n\nAny cell can be executed by pressing the play icon at the top of the document while the cell is highlighted.\n\nYou can also press **CTL-ENTER** to execute the active cell.\n\nGo ahead and make some more changes to the cells above and execute them - what happens when you execute a *Raw* cell ?",
"_____no_output_____"
],
[
"#### Adding a Removing Cells\n\nYou can use the `+` (plus icon) at the top of the docuement to add a new cell, and use the cell type drop down the change the type.\n\nYou can also use the `A` key to add cell *above* the current cell and the `B` key to add *below* the current cell.\n\n\nNow add a couple of cell of your own ...",
"_____no_output_____"
]
],
[
[
"\n\nsee if you can delete this cell - tip, checkout the *Edit* menu ... or even try right-click\n\n",
"_____no_output_____"
]
],
[
[
"#### Code Cells\n\nCode cells allow us to write (in our case Python) and run our code and see the results right inside the notebook.\n\nThe next cell is a code cell that contains Python code to add 4 numbers.\n\nTry executing the cell and if gets the right result - try some more/different numbers\n",
"_____no_output_____"
]
],
[
[
"1 + 2 + 3 + 4 + 5",
"_____no_output_____"
]
],
[
[
"## Let's save our work so for and Push to our changes to GitHub\n\n### Saving\n\nBy pressing the save icon on the document (or File -> Save Notebook) we can save our work to our Binder environment.\n\n\n### But what about Version Control and Git (wasn't that in the Workshop syllabus)\n\nSince our binder environment will disappear when we are no longer using is, we need cause our new version to be saved some where permanent.\n\nLuckly we have a GitHub respository already connected to our current environment - however there are couple steps required to make our GitHub repository match the copy of the respository inside our Binder environment.\n\n#### Git likes to know who we are\n\n... otherwise it keeps complaining it cannot track who made what commits (changes).\n\nTo tell Git who you are, we need to do the following:\n\n- Launch a Terminal sesson (File -> New -> Terminal, or you can use the *Laucher* tab)\n- At the command prompt, type:\n\n```\ngit-setup\n```\n \nThis operation only needs to be done once per binder session.\n\n#### Add your changed files to Git's list of files to track\n\n- at the same terminal prompt type:\n\n```\ngit add .\n```\n \n#### Tell Git to commit (record) this state as a version\n\n- at the same terminal prompt type: \n\n```\ngit commit -m \"save change made inside binder\"\n```\n\nat this point Git has added an additional version of your files to your repository inside your curren Binder environment. However, your repository on GitHub remains unchanges (you might like to go check).\n\n#### Tell Git to push the new commit (version) to GitHub\n\n- again at the same prompt type:\n\n```\ngit push\n```\n\nonce you supply the correct GitHub usename and password, all your changes will be *pushed*.\n\nGo check out your respository on github.com ...\n\n",
"_____no_output_____"
]
]
]
| [
"markdown",
"raw",
"markdown",
"raw",
"markdown",
"code",
"markdown"
]
| [
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"raw"
],
[
"markdown",
"markdown"
],
[
"raw"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
]
]
|
cb6c0ab449e14640f35793e1d6371a6537b03611 | 55,855 | ipynb | Jupyter Notebook | examples/notebooks/Sort_Objects_in_ICs.ipynb | LSSTDESC/Twinkles | 86d6caebde7f965b76ded80df0a1b66254f2a866 | [
"MIT"
]
| 6 | 2017-02-10T00:38:09.000Z | 2018-12-13T17:12:08.000Z | examples/notebooks/Sort_Objects_in_ICs.ipynb | LSSTDESC/Twinkles | 86d6caebde7f965b76ded80df0a1b66254f2a866 | [
"MIT"
]
| 101 | 2016-11-29T15:31:00.000Z | 2019-08-23T19:14:19.000Z | examples/notebooks/Sort_Objects_in_ICs.ipynb | LSSTDESC/Twinkles | 86d6caebde7f965b76ded80df0a1b66254f2a866 | [
"MIT"
]
| 4 | 2017-01-05T20:28:40.000Z | 2018-12-13T17:12:09.000Z | 32.193084 | 561 | 0.425799 | [
[
[
"# Sorting Objects in Instance Catalogs\n\n_Bryce Kalmbach_\n\nThis notebook provides a series of commands that take a Twinkles Phosim Instance Catalog and creates different pandas dataframes for different types of objects in the catalog. It first separates the full sets of objects in the Instance Catalogs before picking out the sprinkled strongly lensed systems for further analysis. The complete object dataframes contain:\n * Stars: All stars in the Instance Catalog\n * Galaxies: All bulge and disk components of galaxies in the Instance Catalog\n * AGN: All AGN in the Instance Catalog\n * SNe: The supernovae that are present in the Instance Catalog\n \nThen there are sprinkled strongly lensed systems dataframes containing:\n * Sprinkled AGN galaxies: The images of the lensed AGNs\n * Lens Galaxies: These are the foreground galaxies in the lens system.\n * **(Not Default)** Sprinkled AGN Host galaxies: While these were turned off in Run 1 of Twinkles the original motivation for this notebook was to find these objects in a catalog to help development of lensed hosts at the DESC 2017 SLAC Collaboration Meeting Hack Day.\n \n## Requirements\n \nIf you already have an instance catalog from Twinkles on hand all you need now are:\n * Pandas\n * Numpy",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport numpy as np",
"_____no_output_____"
]
],
[
[
"### Parsing the Instance Catalog\nHere we run through the instance catalog and store which rows belong to which class of object. This is necessary since the catalog objects do not all have the same number of properties so we cannot just import them all and then sort within a dataframe.",
"_____no_output_____"
]
],
[
[
"filename = 'twinkles_phosim_input_230.txt'",
"_____no_output_____"
],
[
"i = 0\nnot_star_rows = []\nnot_galaxy_rows = []\nnot_agn_rows = []\nnot_sne_rows = []\nwith open(filename, 'r') as f:\n for line in f:\n new_str = line.split(' ')\n #Skip through the header\n if len(new_str) < 4:\n not_star_rows.append(i)\n not_galaxy_rows.append(i)\n not_agn_rows.append(i)\n not_sne_rows.append(i)\n i+=1\n continue\n if new_str[5].startswith('starSED'):\n #star_rows.append(i)\n not_galaxy_rows.append(i)\n not_agn_rows.append(i)\n not_sne_rows.append(i)\n elif new_str[5].startswith('galaxySED'):\n #galaxy_rows.append(i)\n not_star_rows.append(i)\n not_agn_rows.append(i)\n not_sne_rows.append(i)\n elif new_str[5].startswith('agnSED'):\n #agn_rows.append(i)\n not_star_rows.append(i)\n not_galaxy_rows.append(i)\n not_sne_rows.append(i)\n elif new_str[5].startswith('spectra_files'):\n #sne_rows.append(i)\n not_star_rows.append(i)\n not_galaxy_rows.append(i)\n not_agn_rows.append(i)\n i += 1",
"_____no_output_____"
]
],
[
[
"### Populating Dataframes\nNow we load the dataframes for the overall sets of objects.",
"_____no_output_____"
]
],
[
[
"df_star = pd.read_csv(filename, delimiter=' ', header=None,\n names = ['prefix', 'uniqueId', 'raPhosim', 'decPhoSim', \n 'phoSimMagNorm', 'sedFilepath', 'redshift', \n 'shear1', 'shear2', 'kappa', 'raOffset', 'decOffset',\n 'spatialmodel', 'internalExtinctionModel',\n 'galacticExtinctionModel', 'galacticAv', 'galacticRv'],\n skiprows=not_star_rows)",
"_____no_output_____"
],
[
"df_star[:3]",
"_____no_output_____"
],
[
"df_galaxy = pd.read_csv(filename, delimiter=' ', header=None, \n names=['prefix', 'uniqueId', 'raPhoSim', 'decPhoSim', \n 'phoSimMagNorm', 'sedFilepath',\n 'redshift', 'shear1', 'shear2', 'kappa', \n 'raOffset', 'decOffset', 'spatialmodel', \n 'majorAxis', 'minorAxis', 'positionAngle', 'sindex',\n 'internalExtinctionModel', 'internalAv', 'internalRv',\n 'galacticExtinctionModel', 'galacticAv', 'galacticRv'], \n skiprows=not_galaxy_rows)",
"_____no_output_____"
],
[
"df_galaxy[:3]",
"_____no_output_____"
],
[
"df_agn = pd.read_csv(filename, delimiter=' ', header=None, \n names=['prefix', 'uniqueId', 'raPhoSim', 'decPhoSim', \n 'phoSimMagNorm', 'sedFilepath', 'redshift', \n 'shear1', 'shear2', 'kappa', 'raOffset', 'decOffset',\n 'spatialmodel', 'internalExtinctionModel',\n 'galacticExtinctionModel', 'galacticAv', 'galacticRv'],\n skiprows = not_agn_rows)",
"_____no_output_____"
],
[
"df_agn[:3]",
"_____no_output_____"
],
[
"df_sne = pd.read_csv(filename, delimiter=' ', header=None, \n names=['prefix', 'uniqueId', 'raPhoSim', 'decPhoSim',\n 'phoSimMagNorm', 'shorterFileNames', 'redshift',\n 'shear1', 'shear2', 'kappa', 'raOffset', 'decOffset',\n 'spatialmodel', 'internalExtinctionModel',\n 'galacticExtinctionModel', 'galacticAv', 'galacticRv'],\n skiprows = not_sne_rows)",
"_____no_output_____"
],
[
"df_sne[:3]",
"_____no_output_____"
]
],
[
[
"### Sort out sprinkled Strong Lensing Systems\nNow we will pick out the pieces of strongly lensed systems that were sprinkled into the instance catalogs for the Twinkles project.",
"_____no_output_____"
],
[
"#### Lensed AGN\nWe start with the Lensed AGN. In Twinkles Instance Catalogs the lensed AGN have larger `uniqueId`s than normal since we added information about the systems into the `uniqueId`s. We use this to find them in the AGN dataframe.",
"_____no_output_____"
]
],
[
[
"sprinkled_agn = df_agn[df_agn['uniqueId'] > 20000000000]",
"_____no_output_____"
]
],
[
[
"Below we see a pair of lensed images from a double.",
"_____no_output_____"
]
],
[
[
"sprinkled_agn[:2]",
"_____no_output_____"
]
],
[
[
"Now we will extract the extra information we have stored in the `uniqueId`. This information is the Twinkles System number in our custom OM10 catalog in the `data` directory in Twinkles and the Twinkles Image Number which identifies which image in that particular system refers to that line in the catalog.",
"_____no_output_____"
]
],
[
[
"# This step undoes the step in CatSim that gives each component of a galaxy a different offset\ntwinkles_nums = []\nfor agn_id in sprinkled_agn['uniqueId']:\n twinkles_ids = np.right_shift(agn_id-28, 10)\n twinkles_nums.append(twinkles_ids)",
"_____no_output_____"
],
[
"#This parses the information added in the last 4 digits of the unshifted ID\ntwinkles_system_num = []\ntwinkles_img_num = []\nfor lens_system in twinkles_nums:\n lens_system = str(lens_system)\n twinkles_id = lens_system[-4:]\n twinkles_id = np.int(twinkles_id)\n twinkles_base = np.int(np.floor(twinkles_id/4))\n twinkles_img = twinkles_id % 4\n twinkles_system_num.append(twinkles_base)\n twinkles_img_num.append(twinkles_img)",
"_____no_output_____"
]
],
[
[
"We once again look at the two images we showed earlier. We see that they are image 0 and image 1 from Twinkles System 24.",
"_____no_output_____"
]
],
[
[
"print twinkles_system_num[:2], twinkles_img_num[:2]",
"[24, 24] [0, 1]\n"
]
],
[
[
"We now add this information into our sprinkled AGN dataframe and reset the indices.",
"_____no_output_____"
]
],
[
[
"sprinkled_agn = sprinkled_agn.reset_index(drop=True)\nsprinkled_agn['twinkles_system'] = twinkles_system_num\nsprinkled_agn['twinkles_img_num'] = twinkles_img_num",
"_____no_output_____"
],
[
"sprinkled_agn.iloc[:2, [1, 2, 3, -2, -1]]",
"_____no_output_____"
]
],
[
[
"The last step is to now add a column with the lens galaxy `uniqueId` for each system so that we can cross-reference between the lensed AGN and the lens galaxy dataframe we will create next. We start by finding the `uniqueId`s for the lens galaxies.",
"_____no_output_____"
]
],
[
[
"#The lens galaxy ids do not have the extra 4 digits at the end so we remove them\n#and then do the shift back to the `uniqueID`.\nlens_gal_ids = np.left_shift((np.array(twinkles_nums))/10000, 10) + 26",
"_____no_output_____"
],
[
"sprinkled_agn['lens_galaxy_uID'] = lens_gal_ids",
"_____no_output_____"
]
],
[
[
"We now see that the same system has the same lens galaxy `uniqueId` as we expect.",
"_____no_output_____"
]
],
[
[
"sprinkled_agn.iloc[:2, [1, 2, 3, -3, -2, -1]]",
"_____no_output_____"
]
],
[
[
"#### Lens Galaxies",
"_____no_output_____"
],
[
"Now we will create a dataframe with the Lens Galaxies.",
"_____no_output_____"
]
],
[
[
"lens_gal_locs = []\nfor idx in lens_gal_ids:\n lens_gal_locs.append(np.where(df_galaxy['uniqueId'] == idx)[0])\n\nlens_gals = df_galaxy.iloc[np.unique(lens_gal_locs)]\nlens_gals = lens_gals.reset_index(drop=True)",
"_____no_output_____"
]
],
[
[
"We now have the lens galaxies in their own dataframe that can be joined on the lensed AGN dataframe by the `uniqueId`.",
"_____no_output_____"
]
],
[
[
"lens_gals[:1]",
"_____no_output_____"
]
],
[
[
"And we can check how many systems there are by checking the length of this dataframe.",
"_____no_output_____"
]
],
[
[
"len(lens_gals)",
"_____no_output_____"
]
],
[
[
"Showing that we 198 systems in the Twinkles field!",
"_____no_output_____"
],
[
"#### Lensed AGN Host Galaxies (Not in Twinkles 1 catalogs)",
"_____no_output_____"
],
[
"In Twinkles 1 catalogs we do not have host galaxies around our lensed AGN, but in the future we will want to be able to include this. We experimented with this at the [2017 DESC SLAC Collaboration Meeting Hack Day](https://confluence.slac.stanford.edu/display/LSSTDESC/SLAC+2017+-+Friday+Hack+Day) since Nan Li, Matt Wiesner and others are working adding lensed hosts into images.\n\nTherefore, I have included the capacity to find the host galaxies here for future use.\n\nTo start we once again cut based on the `uniqueId` which will be larger than a normal galaxy.",
"_____no_output_____"
]
],
[
[
"host_gals = df_galaxy[df_galaxy['uniqueId'] > 178465239310]",
"_____no_output_____"
],
[
"host_gals = df_galaxy[df_galaxy['uniqueId'] > 170000000000]",
"_____no_output_____"
],
[
"host_gals[:2]",
"_____no_output_____"
]
],
[
[
"Then like the lensed AGN we add in the info from the longer Ids and the lens galaxy info along with resetting the index.",
"_____no_output_____"
]
],
[
[
"twinkles_gal_nums = []\nfor gal_id in host_gals['uniqueId']:\n twinkles_ids = np.right_shift(gal_id-26, 10)\n twinkles_gal_nums.append(twinkles_ids)",
"_____no_output_____"
],
[
"host_twinkles_system_num = []\nhost_twinkles_img_num = []\nfor host_gal in twinkles_gal_nums:\n host_gal = str(host_gal)\n host_twinkles_id = host_gal[-4:]\n host_twinkles_id = np.int(host_twinkles_id)\n host_twinkles_base = np.int(np.floor(host_twinkles_id/4))\n host_twinkles_img = host_twinkles_id % 4\n host_twinkles_system_num.append(host_twinkles_base)\n host_twinkles_img_num.append(host_twinkles_img)",
"_____no_output_____"
],
[
"host_lens_gal_ids = np.left_shift((np.array(twinkles_gal_nums))/10000, 10) + 26",
"_____no_output_____"
],
[
"host_gals = host_gals.reset_index(drop=True)\nhost_gals['twinkles_system'] = host_twinkles_system_num\nhost_gals['twinkles_img_num'] = host_twinkles_img_num\nhost_gals['lens_galaxy_uID'] = host_lens_gal_ids",
"_____no_output_____"
],
[
"host_gals.iloc[:2, [1, 2, 3, -3, -2, -1]]",
"_____no_output_____"
]
],
[
[
"Notice that there are different numbers of sprinkled AGN and host galaxy entries.",
"_____no_output_____"
]
],
[
[
"len(sprinkled_agn), len(host_gals)",
"_____no_output_____"
]
],
[
[
"This is because some host galaxies have both bulge and disk components, but not all do. The example we have been using does have both components and thus we have four entries for the doubly lensed system in the host galaxy dataframe.",
"_____no_output_____"
]
],
[
[
"host_gals[host_gals['lens_galaxy_uID'] == 21393434].iloc[:, [1, 2, 3, -3, -2, -1]]",
"_____no_output_____"
]
],
[
[
"## Final Thoughts\n\nThe main point of being able to break up the instance catalogs like this is for validation and future development. Being able to find the sprinkled input for Twinkles images helps us validate what appears in our output catalogs. Storing this input in pandas dataframes makes it easy to find and compare against the output catalogs that are accessed using tools in the DESC Monitor. In addition, this is a useful tool for future development like the creation of lensed images for the AGN host galaxies that we hope to add in the next iteration of Twinkles.",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
]
]
|
cb6c1586d42c8286af923cf235821cced3ead79f | 15,413 | ipynb | Jupyter Notebook | notebooks/CS/.ipynb_checkpoints/CS_J3D-GTO-checkpoint.ipynb | tsommerfeld/L2-methods_for_resonances | acba48bfede415afd99c89ff2859346e1eb4f96c | [
"MIT"
]
| null | null | null | notebooks/CS/.ipynb_checkpoints/CS_J3D-GTO-checkpoint.ipynb | tsommerfeld/L2-methods_for_resonances | acba48bfede415afd99c89ff2859346e1eb4f96c | [
"MIT"
]
| null | null | null | notebooks/CS/.ipynb_checkpoints/CS_J3D-GTO-checkpoint.ipynb | tsommerfeld/L2-methods_for_resonances | acba48bfede415afd99c89ff2859346e1eb4f96c | [
"MIT"
]
| null | null | null | 26.035473 | 99 | 0.489522 | [
[
[
"### CS/GTO: step 1 and 2",
"_____no_output_____"
]
],
[
[
"show_plots=False",
"_____no_output_____"
],
[
"import numpy as np\nfrom scipy.linalg import eig, eigh, eigvals, eigvalsh\nfrom scipy.optimize import minimize\nimport matplotlib\nimport matplotlib.pyplot as plt\nmatplotlib.use('Qt5Agg')\n%matplotlib qt5\nimport pandas as pd",
"_____no_output_____"
],
[
"#\n# extend path by location of the dvr package\n#\nimport sys\nsys.path.append('../../Python_libs')\nfrom captools import simple_traj_der, five_point_derivative \nfrom GTO_basis import GBR\nfrom jolanta import Jolanta_3D",
"_____no_output_____"
],
[
"amu_to_au=1822.888486192\nau2cm=219474.63068\nau2eV=27.211386027\nAngs2Bohr=1.8897259886",
"_____no_output_____"
],
[
"#\n# Jolanata parameters a, b, c:\n#\n# CS-DVR: \n# bound state: -7.17051 eV\n# resonance (3.1729556 - 0.16085j) eV\n#\njparam=(0.028, 1.0, 0.028)",
"_____no_output_____"
]
],
[
[
"* Create a valence set $[\\alpha_0, \\alpha_0/s, \\alpha_0/s^2, ..., \\alpha_N]$\n* Diagonalize **H** to compare with $E_0^{DVR}$\n* Add diffuse functions $[\\alpha_N/s_{df}, ...]$\n* Diagonalize **H** again",
"_____no_output_____"
]
],
[
[
"sets=['GTO_unc', 'GTO_DZ', 'GTO_TZ']\nbas = sets[0]\nnval=10\na0=17.0\ns=2\nndf=4\nsdf=1.5\nif bas == 'GTO_unc':\n contract = (0,0)\nelif bas == 'GTO_DZ':\n contract = (1,1) # one contracted, one uncontracted function\nelif bas == 'GTO_TZ':\n contract = (1,2) # one contracted, two uncontracted function\nelse:\n print('No such basis.')\n\nfname='Traj_' + bas + '.csv'\nprint(fname)",
"Traj_GTO_unc.csv\n"
]
],
[
[
"### Valence set\nCompare the bound state with DVR: $E_0 = -7.17051$ eV",
"_____no_output_____"
]
],
[
[
"alpha_val=[a0]\nfor i in range(nval-1):\n alpha_val.append(alpha_val[-1]/s)\nVal = GBR(alpha_val, jparam, contract=contract, diffuse=(0,0))\nS, T, V = Val.STV()\nEs, cs = eigh(T+V, b=S)\nprint(f'E0 = {Es[0]*au2eV:.6f} Emax = {Es[-1]*au2eV:.6f}')\nVal.print_exp()\n\nif show_plots:\n scale=10\n xmax=15\n xs=np.linspace(0.1,xmax,200)\n Vs=Jolanta_3D(xs, jparam)\n plt.cla()\n plt.plot(xs,Vs*au2eV, '-', color=\"blue\")\n for i in range(len(Es)):\n ys=Val.eval_vector(cs[:,i], xs)\n plt.plot(xs,scale*ys**2+Es[i]*au2eV, '-')\n plt.ylim(-8,10)\n plt.show()",
"E0 = -7.170439 Emax = 2419.320761\n alpha r0=1/sqrt(alpha) Norm\n 1.70000000e+01 2.42535625e-01 1.0070e+02\n 8.50000000e+00 3.42997170e-01 4.2341e+01\n 4.25000000e+00 4.85071250e-01 1.7802e+01\n 2.12500000e+00 6.85994341e-01 7.4848e+00\n 1.06250000e+00 9.70142500e-01 3.1470e+00\n 5.31250000e-01 1.37198868e+00 1.3231e+00\n 2.65625000e-01 1.94028500e+00 5.5631e-01\n 1.32812500e-01 2.74397736e+00 2.3390e-01\n 6.64062500e-02 3.88057000e+00 9.8343e-02\n 3.32031250e-02 5.48795472e+00 4.1348e-02\n"
]
],
[
[
"### Extend the basis by a diffuse set",
"_____no_output_____"
]
],
[
[
"Bas = GBR(alpha_val, jparam, contract=contract, diffuse=(ndf,sdf))\nS, T, V = Bas.STV()\nEs, cs = eigh(T+V, b=S)\nnEs = len(Es)\nprint(f'E0 = {Es[0]*au2eV:.6f} Emax = {Es[-1]*au2eV:.6f}')\n\nif show_plots:\n Emax=10 # eV\n plt.cla()\n plt.plot(xs,Vs*au2eV, '-', color=\"blue\")\n for i, E in enumerate(Es):\n ys=Bas.eval_vector(cs[:,i], xs)\n plt.plot(xs,scale*ys**2+E*au2eV, '-')\n if E*au2eV > Emax:\n break\n\n plt.ylim(-10,Emax+1)\n plt.show()",
"E0 = -7.170447 Emax = 2421.905980\n"
]
],
[
[
"***\n### CS\nExample for testing library. With:\n\n`nval=10, a0=17.0, s=2, ndf=4, sdf=1.5, theta = 10 deg`\n1. `(-7.171756, 0.000583)`\n2. `(0.327329, -0.171381)`\n3. `(1.228884, -0.692745)`\n4. `(3.165013, -0.147167)`\n5. `(3.431676, -1.806220)`",
"_____no_output_____"
]
],
[
[
"if True:\n theta=8.0/180.0*np.pi\n print(\"theta = %f\" % (theta))\n H_theta = Bas.H_theta(theta+0.00005, 1.00000)\n energies = eigvals(H_theta, b=S)\n energies.sort()\n energies*=au2eV\n for e in energies:\n print(\"(%f, %f)\" % (e.real, e.imag))",
"theta = 0.139626\n(-7.171084, 0.000342)\n(0.344332, -0.140453)\n(1.304015, -0.565986)\n(3.152077, -0.151021)\n(3.591431, -1.412265)\n(7.487083, -2.093086)\n(12.154227, -3.213948)\n(21.924637, -7.105574)\n(47.856322, -17.015877)\n(108.475496, -36.285772)\n(236.367357, -74.120776)\n(500.570665, -150.587619)\n(1056.707013, -310.511939)\n(2326.966794, -675.120632)\n"
]
],
[
[
"### $\\theta$-run",
"_____no_output_____"
]
],
[
[
"n_keep=nEs\n\ntheta_min=0\ntheta_max=16\nn_theta=101\nthetas=np.linspace(theta_min, theta_max, num=n_theta)\nrun_data = np.zeros((n_theta,n_keep), complex) # array used to collect all theta-run data\n\nfor i, tdeg in enumerate(thetas):\n theta = tdeg/180.0*np.pi\n H_theta = Bas.H_theta(theta, 1.0)\n energies = au2eV * eigvals(H_theta, b=S)\n energies.sort()\n run_data[i,:] = energies[0:n_keep]\n print(i+1, end=\" \")\n if (i+1)%10==0:\n print()",
"1 2 3 4 5 6 7 8 9 10 \n11 12 13 14 15 16 17 18 19 20 \n21 22 23 24 25 26 27 28 29 30 \n31 32 33 34 35 36 37 38 39 40 \n41 42 43 44 45 46 47 48 49 50 \n51 52 53 54 55 56 57 58 59 60 \n61 62 63 64 65 66 67 68 69 70 \n71 72 73 74 75 76 77 78 79 80 \n81 82 83 84 85 86 87 88 89 90 \n91 92 93 94 95 96 97 98 99 100 \n101 "
]
],
[
[
"Raw $\\eta$ trajectories",
"_____no_output_____"
]
],
[
[
"plt.cla()\nfor i in range(0, n_keep):\n plt.plot(run_data[:,i].real, run_data[:,i].imag, 'o')\nplt.xlim(0,8)\nplt.ylim(-2,0.5)\nplt.show()",
"_____no_output_____"
]
],
[
[
"Get the resonance trajectory by naive nearest follow\n\nWe start with the energy nearest `follow` ",
"_____no_output_____"
]
],
[
[
"#follow=3.7\nfollow=3.0\nes=np.zeros(n_theta,complex)\n\nfor j in range(0,n_theta):\n i = np.argmin(abs(run_data[j,:]-follow))\n es[j] = run_data[j,i]\n follow = es[j]\nplt.cla()\nplt.ylim(-1,0.0)\nplt.plot(es.real, es.imag, 'o-')\nplt.show()",
"_____no_output_____"
],
[
"abs_der = np.abs(simple_traj_der(thetas, es))\nplt.cla()\nplt.plot(thetas, np.log10(abs_der), 'o-')\nplt.xlabel(r'$\\theta$ [deg.]')\nplt.ylabel(r'$\\log \\vert dE/d \\theta{} \\vert $')\nplt.show()",
"_____no_output_____"
],
[
"df = pd.DataFrame({\"theta\": thetas, \n \"ReE\":es.real, \n \"ImE\":es.imag,\n \"der\": abs_der})\nfname = 'Traj_' + bas + '.csv'\ndf.to_csv(fname, index=False)",
"_____no_output_____"
]
],
[
[
"Energy, $\\theta_{opt} $, and stability for $\\alpha=1$",
"_____no_output_____"
]
],
[
[
"j_opt = np.argmin(abs_der)\nif j_opt == len(thetas)-1:\n j_opt -= 1\ntheta_opt = thetas[j_opt]\nEres=es[j_opt]\nprint('theta_opt', thetas[j_opt])\nprint('E_res', Eres)\nprint('dE/dtheta', abs_der[j_opt])\nprint('delta-E down', es[j_opt-1]-es[j_opt])\nprint('delta-E up ', es[j_opt+1]-es[j_opt])",
"theta_opt 11.040000000000001\nE_res (3.1692295664154315-0.14411821624242616j)\ndE/dtheta 0.004881233243806652\ndelta-E down (-0.0005794423188767439-0.0005237844928482893j)\ndelta-E up (0.0005591583569932723+0.0005466002429930505j)\n"
]
],
[
[
"### Don't optimize $\\eta=\\alpha\\,\\exp(i\\theta)$\n\n**For GTOs the primitive numerical derivative is unstable.**",
"_____no_output_____"
]
],
[
[
"def objective(eta, dx, E_near, verbose=False):\n \"\"\"\n Input: \n eta: (alpha, theta); z = alpha*exp(i*theta)\n dx: numerical derivatives using z +/- dx or idx\n E_near: select the eigenvalue nearest to this energy \n Output: \n dE/dz along Re(z), dE/dz along Im(z) for the state near E_near\n This requires four single points.\n \"\"\"\n a, t = eta\n z0 = a*np.exp(1j*t)\n es = np.zeros(2, complex)\n zs = np.array([z0-dx, z0+dx])\n for i, z in enumerate(zs):\n a, t = np.abs(z), np.angle(z)\n es[i] = near_E(a, t, E_near)\n dEdz_re = (es[1] - es[0])/(2*dx)\n zs = [z0-1j*dx, z0+1j*dx]\n for i, z in enumerate(zs):\n a, t = np.abs(z), np.angle(z)\n es[i] = near_E(a, t, E_near)\n dEdz_im = (es[1] - es[0])/(2j*dx)\n if verbose:\n print(dEdz_re)\n print(dEdz_im)\n return np.abs(0.5*(dEdz_re + dEdz_im)) \n\ndef ECS(alpha, theta):\n \"\"\" diag H(alpha*exp(i*theta)) and return eigenvalues \"\"\"\n H_theta = Bas.H_theta(theta, alpha)\n return eigvals(H_theta, b=S)\n\ndef near_E(alpha, theta, E_near):\n \"\"\" diag H(alpha*exp(i*theta)) and return eigenvalue near E_near \"\"\"\n Es = ECS(alpha, theta)\n j = np.argmin(np.abs(Es - E_near))\n return Es[j]",
"_____no_output_____"
],
[
"alpha_curr=1.0\ntheta_curr=theta_opt/180.0*np.pi\ndx=0.001\nE_find = Eres/au2eV\nobjective((alpha_curr, theta_curr), dx, E_find, verbose=True)",
"(-0.05026468491142744-1.9077031085368823j)\n(-0.2706172373061824+0.996945859327504j)\n"
],
[
"args=(dx, E_find)\np0=[alpha_curr, theta_curr]\nprint('p0=', p0)\nprint('Eres0=', near_E(alpha_curr, theta_curr, E_find)*au2eV)\nprint('f0=', objective(p0, dx, E_find))\nres=minimize(objective, p0, args=args, method='Nelder-Mead')\nprint(res.message)\nprint(res.x)\nprint(res.fun)\nEopt=near_E(res.x[0], res.x[1], E_find)*au2eV\nprint('Eres=', Eopt)\nprint('Energy change=', Eopt-Eres)",
"p0= [1.0, 0.19268434942017398]\nEres0= (3.1692295664154315-0.14411821624242616j)\nf0= 0.4828156933534529\nOptimization terminated successfully.\n[1.15969003 0.20451713]\n0.0246259033514554\nEres= (3.64741613569381+0.8421105067721848j)\nEnergy change= (0.47818656927837866+0.986228723014611j)\n"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
]
|
cb6c3acaf73751f919fe578c632b8a1e9a152843 | 809,158 | ipynb | Jupyter Notebook | mission_to_mars.ipynb | ArunKara/web_scraping_hw | 66f7a6b8cc5a0e076615a5c4d2c8dd37ea149f04 | [
"ADSL"
]
| null | null | null | mission_to_mars.ipynb | ArunKara/web_scraping_hw | 66f7a6b8cc5a0e076615a5c4d2c8dd37ea149f04 | [
"ADSL"
]
| null | null | null | mission_to_mars.ipynb | ArunKara/web_scraping_hw | 66f7a6b8cc5a0e076615a5c4d2c8dd37ea149f04 | [
"ADSL"
]
| null | null | null | 249.817228 | 481,167 | 0.766504 | [
[
[
"from bs4 import BeautifulSoup \nfrom splinter import Browser\nfrom pprint import pprint\nimport pymongo\nimport pandas as pd\nimport requests",
"_____no_output_____"
],
[
"!which chromedriver",
"/usr/local/bin/chromedriver\n"
],
[
"executable_path = {'executable_path': 'chromedriver'}\nbrowser = Browser(\"chrome\", **executable_path)",
"_____no_output_____"
],
[
"url = ('https://mars.nasa.gov/news/')",
"_____no_output_____"
],
[
"browser.visit(url)",
"_____no_output_____"
],
[
"#response = requests.get(url)\nurl_html = browser.html\nsoup = BeautifulSoup(url_html, 'html.parser')",
"_____no_output_____"
],
[
"print(soup.prettify())",
"<html class=\"no-flash cookies geolocation svg picture canvas video webgl srcdoc supports hiddenscroll no-touchevents fullscreen flexbox cssanimations flexboxlegacy no-flexboxtweener csstransforms csstransforms3d csstransitions preserve3d -webkit-\" lang=\"en\" style=\"--vh:710px;\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <script src=\"https://m.addthis.com/live/red_lojson/300lo.json?si=5f4d8c4c188abfcf&bkl=0&bl=1&pdt=320&sid=5f4d8c4c188abfcf&pub=ra-5a690e4c1320e328&rev=v8.28.7-wp&ln=en&pc=men&cb=0&ab=-&dp=mars.nasa.gov&fp=news%2F&fr=&of=1&pd=0&irt=0&vcl=0&md=0&ct=1&tct=0&abt=0&cdn=0&pi=1&rb=0&gen=100&chr=UTF-8&mk=Mars%2Cmissions%2CNASA%2Crover%2CCuriosity%2COpportunity%2CInSight%2CMars%20Reconnaissance%20Orbiter%2Cfacts&colc=1598917708392&jsl=1&skipb=1&callback=addthis.cbs.jsonp__92801136953713590\" type=\"text/javascript\">\n </script>\n <script src=\"https://v1.addthisedge.com/live/boost/ra-5a690e4c1320e328/_ate.track.config_resp\" type=\"text/javascript\">\n </script>\n <script async=\"\" src=\"https://www.google-analytics.com/analytics.js\">\n </script>\n <script src=\"https://z.moatads.com/addthismoatframe568911941483/moatframe.js\" type=\"text/javascript\">\n </script>\n <meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\"/>\n <!-- Always force latest IE rendering engine or request Chrome Frame -->\n <meta content=\"IE=edge,chrome=1\" http-equiv=\"X-UA-Compatible\"/>\n <!-- Responsiveness -->\n <meta content=\"width=device-width, initial-scale=1.0\" name=\"viewport\"/>\n <!-- Favicon -->\n <link href=\"/apple-touch-icon.png\" rel=\"apple-touch-icon\" sizes=\"180x180\"/>\n <link href=\"/favicon-32x32.png\" rel=\"icon\" sizes=\"32x32\" type=\"image/png\"/>\n <link href=\"/favicon-16x16.png\" rel=\"icon\" sizes=\"16x16\" type=\"image/png\"/>\n <link href=\"/manifest.json\" rel=\"manifest\"/>\n <link color=\"#e48b55\" href=\"/safari-pinned-tab.svg\" rel=\"mask-icon\"/>\n <meta content=\"#000000\" name=\"theme-color\"/>\n <meta content=\"authenticity_token\" name=\"csrf-param\"/>\n <meta content=\"qY/qEkGry0owVWKTMPURkCVJ7yg6c+aKIG+pcxgvBximU7xMit6oVkAiQIV4vRotuV+3MQQPYMH4TOIsiJWUUg==\" name=\"csrf-token\"/>\n <title>\n News – NASA’s Mars Exploration Program\n </title>\n <meta content=\"NASA’s Mars Exploration Program \" property=\"og:site_name\"/>\n <meta content=\"mars.nasa.gov\" name=\"author\"/>\n <meta content=\"Mars, missions, NASA, rover, Curiosity, Opportunity, InSight, Mars Reconnaissance Orbiter, facts\" name=\"keywords\"/>\n <meta content=\"NASA’s real-time portal for Mars exploration, featuring the latest news, images, and discoveries from the Red Planet.\" name=\"description\"/>\n <meta content=\"NASA’s real-time portal for Mars exploration, featuring the latest news, images, and discoveries from the Red Planet.\" property=\"og:description\"/>\n <meta content=\"News – NASA’s Mars Exploration Program \" property=\"og:title\"/>\n <meta content=\"https://mars.nasa.gov/news\" property=\"og:url\"/>\n <meta content=\"article\" property=\"og:type\"/>\n <meta content=\"2017-09-22 19:53:22 UTC\" property=\"og:updated_time\"/>\n <meta content=\"https://mars.nasa.gov/system/site_config_values/meta_share_images/1_mars-nasa-gov.jpg\" property=\"og:image\"/>\n <meta content=\"https://mars.nasa.gov/system/site_config_values/meta_share_images/1_mars-nasa-gov.jpg\" name=\"twitter:image\"/>\n <link href=\"https://mars.nasa.gov/system/site_config_values/meta_share_images/1_mars-nasa-gov.jpg\" rel=\"image_src\"/>\n <meta content=\"195570401081308\" property=\"fb:app_id\"/>\n <style data-href=\"https://fonts.googleapis.com/css?family=Montserrat:200,300,400,500,600,700|Raleway:300,400\" media=\"\">\n /* cyrillic-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 200;\n src: local('Montserrat ExtraLight'), local('Montserrat-ExtraLight'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_aZA3gTD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 200;\n src: local('Montserrat ExtraLight'), local('Montserrat-ExtraLight'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_aZA3g3D_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 200;\n src: local('Montserrat ExtraLight'), local('Montserrat-ExtraLight'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_aZA3gbD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 200;\n src: local('Montserrat ExtraLight'), local('Montserrat-ExtraLight'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_aZA3gfD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 200;\n src: local('Montserrat ExtraLight'), local('Montserrat-ExtraLight'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_aZA3gnD_vx3rCs.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 300;\n src: local('Montserrat Light'), local('Montserrat-Light'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_cJD3gTD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 300;\n src: local('Montserrat Light'), local('Montserrat-Light'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_cJD3g3D_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 300;\n src: local('Montserrat Light'), local('Montserrat-Light'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_cJD3gbD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 300;\n src: local('Montserrat Light'), local('Montserrat-Light'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_cJD3gfD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 300;\n src: local('Montserrat Light'), local('Montserrat-Light'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_cJD3gnD_vx3rCs.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 400;\n src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v14/JTUSjIg1_i6t8kCHKm459WRhyyTh89ZNpQ.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 400;\n src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v14/JTUSjIg1_i6t8kCHKm459W1hyyTh89ZNpQ.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 400;\n src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v14/JTUSjIg1_i6t8kCHKm459WZhyyTh89ZNpQ.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 400;\n src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v14/JTUSjIg1_i6t8kCHKm459WdhyyTh89ZNpQ.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 400;\n src: local('Montserrat Regular'), local('Montserrat-Regular'), url(https://fonts.gstatic.com/s/montserrat/v14/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 500;\n src: local('Montserrat Medium'), local('Montserrat-Medium'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_ZpC3gTD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 500;\n src: local('Montserrat Medium'), local('Montserrat-Medium'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_ZpC3g3D_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 500;\n src: local('Montserrat Medium'), local('Montserrat-Medium'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_ZpC3gbD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 500;\n src: local('Montserrat Medium'), local('Montserrat-Medium'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_ZpC3gfD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 500;\n src: local('Montserrat Medium'), local('Montserrat-Medium'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_ZpC3gnD_vx3rCs.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 600;\n src: local('Montserrat SemiBold'), local('Montserrat-SemiBold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_bZF3gTD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 600;\n src: local('Montserrat SemiBold'), local('Montserrat-SemiBold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_bZF3g3D_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 600;\n src: local('Montserrat SemiBold'), local('Montserrat-SemiBold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_bZF3gbD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 600;\n src: local('Montserrat SemiBold'), local('Montserrat-SemiBold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_bZF3gfD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 600;\n src: local('Montserrat SemiBold'), local('Montserrat-SemiBold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_bZF3gnD_vx3rCs.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 700;\n src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_dJE3gTD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 700;\n src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_dJE3g3D_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 700;\n src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_dJE3gbD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 700;\n src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_dJE3gfD_vx3rCubqg.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Montserrat';\n font-style: normal;\n font-weight: 700;\n src: local('Montserrat Bold'), local('Montserrat-Bold'), url(https://fonts.gstatic.com/s/montserrat/v14/JTURjIg1_i6t8kCHKm45_dJE3gnD_vx3rCs.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 300;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyCAIT4ttDfCmxA.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 300;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyCkIT4ttDfCmxA.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 300;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyCIIT4ttDfCmxA.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 300;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyCMIT4ttDfCmxA.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 300;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyC0IT4ttDfA.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* cyrillic-ext */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 400;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyCAIT4ttDfCmxA.woff2) format('woff2');\n unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;\n}\n/* cyrillic */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 400;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyCkIT4ttDfCmxA.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n}\n/* vietnamese */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 400;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyCIIT4ttDfCmxA.woff2) format('woff2');\n unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 400;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyCMIT4ttDfCmxA.woff2) format('woff2');\n unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Raleway';\n font-style: normal;\n font-weight: 400;\n src: url(https://fonts.gstatic.com/s/raleway/v17/1Ptug8zYS_SKggPNyC0IT4ttDfA.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n </style>\n <style data-href=\"/assets/public_manifest-9467122247163ea3bf3012b71b5b39bf2bce26b82917aca331fb838f7f4a4b7e.css\" media=\"all\">\n .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{position:absolute !important;clip:rect(1px 1px 1px 1px);clip:rect(1px, 1px, 1px, 1px)}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:\"\";display:table}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{zoom:1}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default !important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:6.2em;height:.7em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:0;margin-left:0}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-widget{font-family:Segoe UI,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Segoe UI,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #666666;background:#000000;color:#ffffff}.ui-widget-content a{color:#ffffff}.ui-widget-header{border:1px solid #333333;background:#333333;color:#ffffff;font-weight:700}.ui-widget-header a{color:#ffffff}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #666666;background:#555555;font-weight:700;color:#eeeeee}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#eeeeee;text-decoration:none}.ui-state-hover a,.ui-state-hover a:hover{color:#ffffff;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #ffaf0f;background:#f58400;font-weight:700;color:#ffffff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#ffffff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #cccccc;background:#eeeeee;color:#2e7db2}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#2e7db2}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #ffb73d;background:#ffc73d;color:#111111}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#111111}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#111111}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:700}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:400}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-icon{width:16px;height:16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:6px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:6px}#simplemodal-overlay{background-color:#000}#simplemodal-container{height:360px;width:600px;color:#fff;background-color:#000;border:0;padding:0}#simplemodal-container .simplemodal-data{padding:20px 50px}.slick-slider{position:relative;display:block;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;touch-action:pan-y;-webkit-tap-highlight-color:transparent}.slick-list{position:relative;overflow:hidden;display:block;margin:0;padding:0}.slick-list:focus{outline:none}.slick-loading .slick-list{background:#fff url(\"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/ajax-loader.gif\") center center no-repeat}.slick-list.dragging{cursor:pointer;cursor:hand}.slick-slider .slick-list,.slick-track,.slick-slide,.slick-slide img{transform:translate3d(0, 0, 0)}.slick-track{position:relative;left:0;top:0;display:block;zoom:1}.slick-track:before,.slick-track:after{content:\"\";display:table}.slick-track:after{clear:both}.slick-loading .slick-track{visibility:hidden}.slick-slide{float:left;height:100%;min-height:1px;display:none}.slick-slide img{display:block}.slick-slide.slick-loading img{display:none}.slick-slide.dragging img{pointer-events:none}.slick-initialized .slick-slide{display:block}.slick-loading .slick-slide{visibility:hidden}.slick-vertical .slick-slide{display:block;height:auto;border:1px solid transparent}@font-face{font-family:\"slick\";src:url(\"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/fonts/slick.eot\");src:url(\"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/fonts/slick.eot?#iefix\") format(\"embedded-opentype\"),url(\"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/fonts/slick.woff\") format(\"woff\"),url(\"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/fonts/slick.ttf\") format(\"truetype\"),url(\"https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/fonts/slick.svg#slick\") format(\"svg\");font-weight:normal;font-style:normal}.slick-prev,.slick-next{position:absolute;display:block;height:20px;width:20px;line-height:0;font-size:0;cursor:pointer;background:transparent;color:transparent;top:50%;margin-top:-10px;padding:0;border:none;outline:none}.slick-prev:hover,.slick-prev:focus,.slick-next:hover,.slick-next:focus{outline:none;background:transparent;color:transparent}.slick-prev:hover:before,.slick-prev:focus:before,.slick-next:hover:before,.slick-next:focus:before{opacity:1}.slick-prev.slick-disabled:before,.slick-next.slick-disabled:before{opacity:0.25}.slick-prev:before,.slick-next:before{font-family:\"slick\";font-size:20px;line-height:1;color:white;opacity:0.75;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.slick-prev{left:-25px}.slick-prev:before{content:\"\\2190\"}.slick-next{right:-25px}.slick-next:before{content:\"\\2192\"}.slick-slider{margin-bottom:30px}.slick-dots{position:absolute;bottom:-45px;list-style:none;display:block;text-align:center;padding:0;width:100%}.slick-dots li{position:relative;display:inline-block;height:20px;width:20px;margin:0 5px;padding:0;cursor:pointer}.slick-dots li button{border:0;background:transparent;display:block;height:20px;width:20px;outline:none;line-height:0;font-size:0;color:transparent;padding:5px;cursor:pointer}.slick-dots li button:hover,.slick-dots li button:focus{outline:none}.slick-dots li button:hover:before,.slick-dots li button:focus:before{opacity:1}.slick-dots li button:before{position:absolute;top:0;left:0;content:\"\\2022\";width:20px;height:20px;font-family:\"slick\";font-size:6px;line-height:20px;text-align:center;color:black;opacity:0.25;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.slick-dots li.slick-active button:before{color:black;opacity:0.75}[dir=\"rtl\"] .slick-next{right:auto;left:-25px}[dir=\"rtl\"] .slick-next:before{content:\"\\2190\"}[dir=\"rtl\"] .slick-prev{right:-25px;left:auto}[dir=\"rtl\"] .slick-prev:before{content:\"\\2192\"}[dir=\"rtl\"] .slick-slide{float:right}@font-face{font-family:\"foundation-icons\";src:url(\"https://mars.nasa.gov/assets/gulp/vendor/fonts/foundation-icons.eot\");src:url(\"https://mars.nasa.gov/assets/gulp/vendor/fonts/foundation-icons.eot?#iefix\") format(\"embedded-opentype\"),url(\"https://mars.nasa.gov/assets/gulp/vendor/fonts/foundation-icons.woff\") format(\"woff\"),url(\"https://mars.nasa.gov/assets/gulp/vendor/fonts/foundation-icons.ttf\") format(\"truetype\"),url(\"https://mars.nasa.gov/assets/gulp/vendor/fonts/foundation-icons.svg#fontcustom\") format(\"svg\");font-weight:normal;font-style:normal}.fi-address-book:before,.fi-alert:before,.fi-align-center:before,.fi-align-justify:before,.fi-align-left:before,.fi-align-right:before,.fi-anchor:before,.fi-annotate:before,.fi-archive:before,.fi-arrow-down:before,.fi-arrow-left:before,.fi-arrow-right:before,.fi-arrow-up:before,.fi-arrows-compress:before,.fi-arrows-expand:before,.fi-arrows-in:before,.fi-arrows-out:before,.fi-asl:before,.fi-asterisk:before,.fi-at-sign:before,.fi-background-color:before,.fi-battery-empty:before,.fi-battery-full:before,.fi-battery-half:before,.fi-bitcoin-circle:before,.fi-bitcoin:before,.fi-blind:before,.fi-bluetooth:before,.fi-bold:before,.fi-book-bookmark:before,.fi-book:before,.fi-bookmark:before,.fi-braille:before,.fi-burst-new:before,.fi-burst-sale:before,.fi-burst:before,.fi-calendar:before,.fi-camera:before,.fi-check:before,.fi-checkbox:before,.fi-clipboard-notes:before,.fi-clipboard-pencil:before,.fi-clipboard:before,.fi-clock:before,.fi-closed-caption:before,.fi-cloud:before,.fi-comment-minus:before,.fi-comment-quotes:before,.fi-comment-video:before,.fi-comment:before,.fi-comments:before,.fi-compass:before,.fi-contrast:before,.fi-credit-card:before,.fi-crop:before,.fi-crown:before,.fi-css3:before,.fi-database:before,.fi-die-five:before,.fi-die-four:before,.fi-die-one:before,.fi-die-six:before,.fi-die-three:before,.fi-die-two:before,.fi-dislike:before,.fi-dollar-bill:before,.fi-dollar:before,.fi-download:before,.fi-eject:before,.fi-elevator:before,.fi-euro:before,.fi-eye:before,.fi-fast-forward:before,.fi-female-symbol:before,.fi-female:before,.fi-filter:before,.fi-first-aid:before,.fi-flag:before,.fi-folder-add:before,.fi-folder-lock:before,.fi-folder:before,.fi-foot:before,.fi-foundation:before,.fi-graph-bar:before,.fi-graph-horizontal:before,.fi-graph-pie:before,.fi-graph-trend:before,.fi-guide-dog:before,.fi-hearing-aid:before,.fi-heart:before,.fi-home:before,.fi-html5:before,.fi-indent-less:before,.fi-indent-more:before,.fi-info:before,.fi-italic:before,.fi-key:before,.fi-laptop:before,.fi-layout:before,.fi-lightbulb:before,.fi-like:before,.fi-link:before,.fi-list-bullet:before,.fi-list-number:before,.fi-list-thumbnails:before,.fi-list:before,.fi-lock:before,.fi-loop:before,.fi-magnifying-glass:before,.fi-mail:before,.fi-male-female:before,.fi-male-symbol:before,.fi-male:before,.fi-map:before,.fi-marker:before,.fi-megaphone:before,.fi-microphone:before,.fi-minus-circle:before,.fi-minus:before,.fi-mobile-signal:before,.fi-mobile:before,.fi-monitor:before,.fi-mountains:before,.fi-music:before,.fi-next:before,.fi-no-dogs:before,.fi-no-smoking:before,.fi-page-add:before,.fi-page-copy:before,.fi-page-csv:before,.fi-page-delete:before,.fi-page-doc:before,.fi-page-edit:before,.fi-page-export-csv:before,.fi-page-export-doc:before,.fi-page-export-pdf:before,.fi-page-export:before,.fi-page-filled:before,.fi-page-multiple:before,.fi-page-pdf:before,.fi-page-remove:before,.fi-page-search:before,.fi-page:before,.fi-paint-bucket:before,.fi-paperclip:before,.fi-pause:before,.fi-paw:before,.fi-paypal:before,.fi-pencil:before,.fi-photo:before,.fi-play-circle:before,.fi-play-video:before,.fi-play:before,.fi-plus:before,.fi-pound:before,.fi-power:before,.fi-previous:before,.fi-price-tag:before,.fi-pricetag-multiple:before,.fi-print:before,.fi-prohibited:before,.fi-projection-screen:before,.fi-puzzle:before,.fi-quote:before,.fi-record:before,.fi-refresh:before,.fi-results-demographics:before,.fi-results:before,.fi-rewind-ten:before,.fi-rewind:before,.fi-rss:before,.fi-safety-cone:before,.fi-save:before,.fi-share:before,.fi-sheriff-badge:before,.fi-shield:before,.fi-shopping-bag:before,.fi-shopping-cart:before,.fi-shuffle:before,.fi-skull:before,.fi-social-500px:before,.fi-social-adobe:before,.fi-social-amazon:before,.fi-social-android:before,.fi-social-apple:before,.fi-social-behance:before,.fi-social-bing:before,.fi-social-blogger:before,.fi-social-delicious:before,.fi-social-designer-news:before,.fi-social-deviant-art:before,.fi-social-digg:before,.fi-social-dribbble:before,.fi-social-drive:before,.fi-social-dropbox:before,.fi-social-evernote:before,.fi-social-facebook:before,.fi-social-flickr:before,.fi-social-forrst:before,.fi-social-foursquare:before,.fi-social-game-center:before,.fi-social-github:before,.fi-social-google-plus:before,.fi-social-hacker-news:before,.fi-social-hi5:before,.fi-social-instagram:before,.fi-social-joomla:before,.fi-social-lastfm:before,.fi-social-linkedin:before,.fi-social-medium:before,.fi-social-myspace:before,.fi-social-orkut:before,.fi-social-path:before,.fi-social-picasa:before,.fi-social-pinterest:before,.fi-social-rdio:before,.fi-social-reddit:before,.fi-social-skillshare:before,.fi-social-skype:before,.fi-social-smashing-mag:before,.fi-social-snapchat:before,.fi-social-spotify:before,.fi-social-squidoo:before,.fi-social-stack-overflow:before,.fi-social-steam:before,.fi-social-stumbleupon:before,.fi-social-treehouse:before,.fi-social-tumblr:before,.fi-social-twitter:before,.fi-social-vimeo:before,.fi-social-windows:before,.fi-social-xbox:before,.fi-social-yahoo:before,.fi-social-yelp:before,.fi-social-youtube:before,.fi-social-zerply:before,.fi-social-zurb:before,.fi-sound:before,.fi-star:before,.fi-stop:before,.fi-strikethrough:before,.fi-subscript:before,.fi-superscript:before,.fi-tablet-landscape:before,.fi-tablet-portrait:before,.fi-target-two:before,.fi-target:before,.fi-telephone-accessible:before,.fi-telephone:before,.fi-text-color:before,.fi-thumbnails:before,.fi-ticket:before,.fi-torso-business:before,.fi-torso-female:before,.fi-torso:before,.fi-torsos-all-female:before,.fi-torsos-all:before,.fi-torsos-female-male:before,.fi-torsos-male-female:before,.fi-torsos:before,.fi-trash:before,.fi-trees:before,.fi-trophy:before,.fi-underline:before,.fi-universal-access:before,.fi-unlink:before,.fi-unlock:before,.fi-upload-cloud:before,.fi-upload:before,.fi-usb:before,.fi-video:before,.fi-volume-none:before,.fi-volume-strike:before,.fi-volume:before,.fi-web:before,.fi-wheelchair:before,.fi-widget:before,.fi-wrench:before,.fi-x-circle:before,.fi-x:before,.fi-yen:before,.fi-zoom-in:before,.fi-zoom-out:before{font-family:\"foundation-icons\";font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;display:inline-block;text-decoration:inherit}.fi-address-book:before{content:\"\\f100\"}.fi-alert:before{content:\"\\f101\"}.fi-align-center:before{content:\"\\f102\"}.fi-align-justify:before{content:\"\\f103\"}.fi-align-left:before{content:\"\\f104\"}.fi-align-right:before{content:\"\\f105\"}.fi-anchor:before{content:\"\\f106\"}.fi-annotate:before{content:\"\\f107\"}.fi-archive:before{content:\"\\f108\"}.fi-arrow-down:before{content:\"\\f109\"}.fi-arrow-left:before{content:\"\\f10a\"}.fi-arrow-right:before{content:\"\\f10b\"}.fi-arrow-up:before{content:\"\\f10c\"}.fi-arrows-compress:before{content:\"\\f10d\"}.fi-arrows-expand:before{content:\"\\f10e\"}.fi-arrows-in:before{content:\"\\f10f\"}.fi-arrows-out:before{content:\"\\f110\"}.fi-asl:before{content:\"\\f111\"}.fi-asterisk:before{content:\"\\f112\"}.fi-at-sign:before{content:\"\\f113\"}.fi-background-color:before{content:\"\\f114\"}.fi-battery-empty:before{content:\"\\f115\"}.fi-battery-full:before{content:\"\\f116\"}.fi-battery-half:before{content:\"\\f117\"}.fi-bitcoin-circle:before{content:\"\\f118\"}.fi-bitcoin:before{content:\"\\f119\"}.fi-blind:before{content:\"\\f11a\"}.fi-bluetooth:before{content:\"\\f11b\"}.fi-bold:before{content:\"\\f11c\"}.fi-book-bookmark:before{content:\"\\f11d\"}.fi-book:before{content:\"\\f11e\"}.fi-bookmark:before{content:\"\\f11f\"}.fi-braille:before{content:\"\\f120\"}.fi-burst-new:before{content:\"\\f121\"}.fi-burst-sale:before{content:\"\\f122\"}.fi-burst:before{content:\"\\f123\"}.fi-calendar:before{content:\"\\f124\"}.fi-camera:before{content:\"\\f125\"}.fi-check:before{content:\"\\f126\"}.fi-checkbox:before{content:\"\\f127\"}.fi-clipboard-notes:before{content:\"\\f128\"}.fi-clipboard-pencil:before{content:\"\\f129\"}.fi-clipboard:before{content:\"\\f12a\"}.fi-clock:before{content:\"\\f12b\"}.fi-closed-caption:before{content:\"\\f12c\"}.fi-cloud:before{content:\"\\f12d\"}.fi-comment-minus:before{content:\"\\f12e\"}.fi-comment-quotes:before{content:\"\\f12f\"}.fi-comment-video:before{content:\"\\f130\"}.fi-comment:before{content:\"\\f131\"}.fi-comments:before{content:\"\\f132\"}.fi-compass:before{content:\"\\f133\"}.fi-contrast:before{content:\"\\f134\"}.fi-credit-card:before{content:\"\\f135\"}.fi-crop:before{content:\"\\f136\"}.fi-crown:before{content:\"\\f137\"}.fi-css3:before{content:\"\\f138\"}.fi-database:before{content:\"\\f139\"}.fi-die-five:before{content:\"\\f13a\"}.fi-die-four:before{content:\"\\f13b\"}.fi-die-one:before{content:\"\\f13c\"}.fi-die-six:before{content:\"\\f13d\"}.fi-die-three:before{content:\"\\f13e\"}.fi-die-two:before{content:\"\\f13f\"}.fi-dislike:before{content:\"\\f140\"}.fi-dollar-bill:before{content:\"\\f141\"}.fi-dollar:before{content:\"\\f142\"}.fi-download:before{content:\"\\f143\"}.fi-eject:before{content:\"\\f144\"}.fi-elevator:before{content:\"\\f145\"}.fi-euro:before{content:\"\\f146\"}.fi-eye:before{content:\"\\f147\"}.fi-fast-forward:before{content:\"\\f148\"}.fi-female-symbol:before{content:\"\\f149\"}.fi-female:before{content:\"\\f14a\"}.fi-filter:before{content:\"\\f14b\"}.fi-first-aid:before{content:\"\\f14c\"}.fi-flag:before{content:\"\\f14d\"}.fi-folder-add:before{content:\"\\f14e\"}.fi-folder-lock:before{content:\"\\f14f\"}.fi-folder:before{content:\"\\f150\"}.fi-foot:before{content:\"\\f151\"}.fi-foundation:before{content:\"\\f152\"}.fi-graph-bar:before{content:\"\\f153\"}.fi-graph-horizontal:before{content:\"\\f154\"}.fi-graph-pie:before{content:\"\\f155\"}.fi-graph-trend:before{content:\"\\f156\"}.fi-guide-dog:before{content:\"\\f157\"}.fi-hearing-aid:before{content:\"\\f158\"}.fi-heart:before{content:\"\\f159\"}.fi-home:before{content:\"\\f15a\"}.fi-html5:before{content:\"\\f15b\"}.fi-indent-less:before{content:\"\\f15c\"}.fi-indent-more:before{content:\"\\f15d\"}.fi-info:before{content:\"\\f15e\"}.fi-italic:before{content:\"\\f15f\"}.fi-key:before{content:\"\\f160\"}.fi-laptop:before{content:\"\\f161\"}.fi-layout:before{content:\"\\f162\"}.fi-lightbulb:before{content:\"\\f163\"}.fi-like:before{content:\"\\f164\"}.fi-link:before{content:\"\\f165\"}.fi-list-bullet:before{content:\"\\f166\"}.fi-list-number:before{content:\"\\f167\"}.fi-list-thumbnails:before{content:\"\\f168\"}.fi-list:before{content:\"\\f169\"}.fi-lock:before{content:\"\\f16a\"}.fi-loop:before{content:\"\\f16b\"}.fi-magnifying-glass:before{content:\"\\f16c\"}.fi-mail:before{content:\"\\f16d\"}.fi-male-female:before{content:\"\\f16e\"}.fi-male-symbol:before{content:\"\\f16f\"}.fi-male:before{content:\"\\f170\"}.fi-map:before{content:\"\\f171\"}.fi-marker:before{content:\"\\f172\"}.fi-megaphone:before{content:\"\\f173\"}.fi-microphone:before{content:\"\\f174\"}.fi-minus-circle:before{content:\"\\f175\"}.fi-minus:before{content:\"\\f176\"}.fi-mobile-signal:before{content:\"\\f177\"}.fi-mobile:before{content:\"\\f178\"}.fi-monitor:before{content:\"\\f179\"}.fi-mountains:before{content:\"\\f17a\"}.fi-music:before{content:\"\\f17b\"}.fi-next:before{content:\"\\f17c\"}.fi-no-dogs:before{content:\"\\f17d\"}.fi-no-smoking:before{content:\"\\f17e\"}.fi-page-add:before{content:\"\\f17f\"}.fi-page-copy:before{content:\"\\f180\"}.fi-page-csv:before{content:\"\\f181\"}.fi-page-delete:before{content:\"\\f182\"}.fi-page-doc:before{content:\"\\f183\"}.fi-page-edit:before{content:\"\\f184\"}.fi-page-export-csv:before{content:\"\\f185\"}.fi-page-export-doc:before{content:\"\\f186\"}.fi-page-export-pdf:before{content:\"\\f187\"}.fi-page-export:before{content:\"\\f188\"}.fi-page-filled:before{content:\"\\f189\"}.fi-page-multiple:before{content:\"\\f18a\"}.fi-page-pdf:before{content:\"\\f18b\"}.fi-page-remove:before{content:\"\\f18c\"}.fi-page-search:before{content:\"\\f18d\"}.fi-page:before{content:\"\\f18e\"}.fi-paint-bucket:before{content:\"\\f18f\"}.fi-paperclip:before{content:\"\\f190\"}.fi-pause:before{content:\"\\f191\"}.fi-paw:before{content:\"\\f192\"}.fi-paypal:before{content:\"\\f193\"}.fi-pencil:before{content:\"\\f194\"}.fi-photo:before{content:\"\\f195\"}.fi-play-circle:before{content:\"\\f196\"}.fi-play-video:before{content:\"\\f197\"}.fi-play:before{content:\"\\f198\"}.fi-plus:before{content:\"\\f199\"}.fi-pound:before{content:\"\\f19a\"}.fi-power:before{content:\"\\f19b\"}.fi-previous:before{content:\"\\f19c\"}.fi-price-tag:before{content:\"\\f19d\"}.fi-pricetag-multiple:before{content:\"\\f19e\"}.fi-print:before{content:\"\\f19f\"}.fi-prohibited:before{content:\"\\f1a0\"}.fi-projection-screen:before{content:\"\\f1a1\"}.fi-puzzle:before{content:\"\\f1a2\"}.fi-quote:before{content:\"\\f1a3\"}.fi-record:before{content:\"\\f1a4\"}.fi-refresh:before{content:\"\\f1a5\"}.fi-results-demographics:before{content:\"\\f1a6\"}.fi-results:before{content:\"\\f1a7\"}.fi-rewind-ten:before{content:\"\\f1a8\"}.fi-rewind:before{content:\"\\f1a9\"}.fi-rss:before{content:\"\\f1aa\"}.fi-safety-cone:before{content:\"\\f1ab\"}.fi-save:before{content:\"\\f1ac\"}.fi-share:before{content:\"\\f1ad\"}.fi-sheriff-badge:before{content:\"\\f1ae\"}.fi-shield:before{content:\"\\f1af\"}.fi-shopping-bag:before{content:\"\\f1b0\"}.fi-shopping-cart:before{content:\"\\f1b1\"}.fi-shuffle:before{content:\"\\f1b2\"}.fi-skull:before{content:\"\\f1b3\"}.fi-social-500px:before{content:\"\\f1b4\"}.fi-social-adobe:before{content:\"\\f1b5\"}.fi-social-amazon:before{content:\"\\f1b6\"}.fi-social-android:before{content:\"\\f1b7\"}.fi-social-apple:before{content:\"\\f1b8\"}.fi-social-behance:before{content:\"\\f1b9\"}.fi-social-bing:before{content:\"\\f1ba\"}.fi-social-blogger:before{content:\"\\f1bb\"}.fi-social-delicious:before{content:\"\\f1bc\"}.fi-social-designer-news:before{content:\"\\f1bd\"}.fi-social-deviant-art:before{content:\"\\f1be\"}.fi-social-digg:before{content:\"\\f1bf\"}.fi-social-dribbble:before{content:\"\\f1c0\"}.fi-social-drive:before{content:\"\\f1c1\"}.fi-social-dropbox:before{content:\"\\f1c2\"}.fi-social-evernote:before{content:\"\\f1c3\"}.fi-social-facebook:before{content:\"\\f1c4\"}.fi-social-flickr:before{content:\"\\f1c5\"}.fi-social-forrst:before{content:\"\\f1c6\"}.fi-social-foursquare:before{content:\"\\f1c7\"}.fi-social-game-center:before{content:\"\\f1c8\"}.fi-social-github:before{content:\"\\f1c9\"}.fi-social-google-plus:before{content:\"\\f1ca\"}.fi-social-hacker-news:before{content:\"\\f1cb\"}.fi-social-hi5:before{content:\"\\f1cc\"}.fi-social-instagram:before{content:\"\\f1cd\"}.fi-social-joomla:before{content:\"\\f1ce\"}.fi-social-lastfm:before{content:\"\\f1cf\"}.fi-social-linkedin:before{content:\"\\f1d0\"}.fi-social-medium:before{content:\"\\f1d1\"}.fi-social-myspace:before{content:\"\\f1d2\"}.fi-social-orkut:before{content:\"\\f1d3\"}.fi-social-path:before{content:\"\\f1d4\"}.fi-social-picasa:before{content:\"\\f1d5\"}.fi-social-pinterest:before{content:\"\\f1d6\"}.fi-social-rdio:before{content:\"\\f1d7\"}.fi-social-reddit:before{content:\"\\f1d8\"}.fi-social-skillshare:before{content:\"\\f1d9\"}.fi-social-skype:before{content:\"\\f1da\"}.fi-social-smashing-mag:before{content:\"\\f1db\"}.fi-social-snapchat:before{content:\"\\f1dc\"}.fi-social-spotify:before{content:\"\\f1dd\"}.fi-social-squidoo:before{content:\"\\f1de\"}.fi-social-stack-overflow:before{content:\"\\f1df\"}.fi-social-steam:before{content:\"\\f1e0\"}.fi-social-stumbleupon:before{content:\"\\f1e1\"}.fi-social-treehouse:before{content:\"\\f1e2\"}.fi-social-tumblr:before{content:\"\\f1e3\"}.fi-social-twitter:before{content:\"\\f1e4\"}.fi-social-vimeo:before{content:\"\\f1e5\"}.fi-social-windows:before{content:\"\\f1e6\"}.fi-social-xbox:before{content:\"\\f1e7\"}.fi-social-yahoo:before{content:\"\\f1e8\"}.fi-social-yelp:before{content:\"\\f1e9\"}.fi-social-youtube:before{content:\"\\f1ea\"}.fi-social-zerply:before{content:\"\\f1eb\"}.fi-social-zurb:before{content:\"\\f1ec\"}.fi-sound:before{content:\"\\f1ed\"}.fi-star:before{content:\"\\f1ee\"}.fi-stop:before{content:\"\\f1ef\"}.fi-strikethrough:before{content:\"\\f1f0\"}.fi-subscript:before{content:\"\\f1f1\"}.fi-superscript:before{content:\"\\f1f2\"}.fi-tablet-landscape:before{content:\"\\f1f3\"}.fi-tablet-portrait:before{content:\"\\f1f4\"}.fi-target-two:before{content:\"\\f1f5\"}.fi-target:before{content:\"\\f1f6\"}.fi-telephone-accessible:before{content:\"\\f1f7\"}.fi-telephone:before{content:\"\\f1f8\"}.fi-text-color:before{content:\"\\f1f9\"}.fi-thumbnails:before{content:\"\\f1fa\"}.fi-ticket:before{content:\"\\f1fb\"}.fi-torso-business:before{content:\"\\f1fc\"}.fi-torso-female:before{content:\"\\f1fd\"}.fi-torso:before{content:\"\\f1fe\"}.fi-torsos-all-female:before{content:\"\\f1ff\"}.fi-torsos-all:before{content:\"\\f200\"}.fi-torsos-female-male:before{content:\"\\f201\"}.fi-torsos-male-female:before{content:\"\\f202\"}.fi-torsos:before{content:\"\\f203\"}.fi-trash:before{content:\"\\f204\"}.fi-trees:before{content:\"\\f205\"}.fi-trophy:before{content:\"\\f206\"}.fi-underline:before{content:\"\\f207\"}.fi-universal-access:before{content:\"\\f208\"}.fi-unlink:before{content:\"\\f209\"}.fi-unlock:before{content:\"\\f20a\"}.fi-upload-cloud:before{content:\"\\f20b\"}.fi-upload:before{content:\"\\f20c\"}.fi-usb:before{content:\"\\f20d\"}.fi-video:before{content:\"\\f20e\"}.fi-volume-none:before{content:\"\\f20f\"}.fi-volume-strike:before{content:\"\\f210\"}.fi-volume:before{content:\"\\f211\"}.fi-web:before{content:\"\\f212\"}.fi-wheelchair:before{content:\"\\f213\"}.fi-widget:before{content:\"\\f214\"}.fi-wrench:before{content:\"\\f215\"}.fi-x-circle:before{content:\"\\f216\"}.fi-x:before{content:\"\\f217\"}.fi-yen:before{content:\"\\f218\"}.fi-zoom-in:before{content:\"\\f219\"}.fi-zoom-out:before{content:\"\\f21a\"}/*! normalize.css v1.1.2 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:0.67em 0}h2{font-size:1.5em;margin:0.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:0.83em;margin:1.67em 0}h6{font-size:0.67em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}hr{box-sizing:content-box;height:0}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace, serif;_font-family:'courier new', monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:before,q:after{content:'';content:none}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}dl,menu,ol,ul{margin:1em 0}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ul,nav ol{list-style:none;list-style-image:none}img{border:0;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0;white-space:normal;*margin-left:-7px}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=\"button\"],input[type=\"reset\"],input[type=\"submit\"]{-webkit-appearance:button;cursor:pointer;*overflow:visible}button[disabled],html input[disabled]{cursor:default}input[type=\"checkbox\"],input[type=\"radio\"]{box-sizing:border-box;padding:0;*height:13px;*width:13px}input[type=\"search\"]{-webkit-appearance:textfield}input[type=\"search\"]::-webkit-search-cancel-button,input[type=\"search\"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}html,button,input,select,textarea{color:#222}body{font-size:1em;line-height:1.4}::-moz-selection{background:#b3d4fc;text-shadow:none}::selection{background:#b3d4fc;text-shadow:none}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}audio,canvas,img,video{vertical-align:middle}fieldset{border:0;margin:0;padding:0}textarea{resize:vertical}.browsehappy{margin:0.2em 0;background:#ccc;color:#000;padding:0.2em 0}.ir{background-color:transparent;border:0;overflow:hidden;*text-indent:-9999px}.ir:before{content:\"\";display:block;width:0;height:150%}.hidden{display:none !important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.clearfix:before,.meganav:before,.meganav_columnar_section:before,.nav_area:before,.body_form fieldset.radio_buttons .option:before,.upper_footer:before,#site_footer .sitemap_directory:before,.main_area_sitemap .sitemap_directory:before,article:before,.grid_gallery.list_view li.slide:before,.main_carousel .slick-nav:before,.main_carousel.module .slick-slider .content_body:before,.advanced_search .filter_bar .search_row:before,.content_page #primary_column:before,#secondary_column aside.list_view_module li:before,.wysiwyg_content .related_content_module ul:before,#secondary_column .related_content_module ul:before,.wysiwyg_content .related_content_module li:before,#secondary_column .related_content_module li:before,blockquote:before,.faq_section ul.q_and_a .text.answer:before,.double_teaser .teaser_container:before,ul.item_list:before,ul.item_list>li:before,ul.item_list .list_content:before,.raw_image_gallery:before,form.pagination_form:before,.pagination_options:before,.faceted_search.list_view li.slide:before,.clearfix:after,.meganav:after,.meganav_columnar_section:after,.nav_area:after,.body_form fieldset.radio_buttons .option:after,.upper_footer:after,#site_footer .sitemap_directory:after,.main_area_sitemap .sitemap_directory:after,article:after,.grid_gallery.list_view li.slide:after,.main_carousel .slick-nav:after,.main_carousel.module .slick-slider .content_body:after,.advanced_search .filter_bar .search_row:after,.content_page #primary_column:after,#secondary_column aside.list_view_module li:after,.wysiwyg_content .related_content_module ul:after,#secondary_column .related_content_module ul:after,.wysiwyg_content .related_content_module li:after,#secondary_column .related_content_module li:after,blockquote:after,.faq_section ul.q_and_a .text.answer:after,.double_teaser .teaser_container:after,ul.item_list:after,ul.item_list>li:after,ul.item_list .list_content:after,.raw_image_gallery:after,form.pagination_form:after,.pagination_options:after,.faceted_search.list_view li.slide:after{content:\" \";display:table}.clearfix:after,.meganav:after,.meganav_columnar_section:after,.nav_area:after,.body_form fieldset.radio_buttons .option:after,.upper_footer:after,#site_footer .sitemap_directory:after,.main_area_sitemap .sitemap_directory:after,article:after,.grid_gallery.list_view li.slide:after,.main_carousel .slick-nav:after,.main_carousel.module .slick-slider .content_body:after,.advanced_search .filter_bar .search_row:after,.content_page #primary_column:after,#secondary_column aside.list_view_module li:after,.wysiwyg_content .related_content_module ul:after,#secondary_column .related_content_module ul:after,.wysiwyg_content .related_content_module li:after,#secondary_column .related_content_module li:after,blockquote:after,.faq_section ul.q_and_a .text.answer:after,.double_teaser .teaser_container:after,ul.item_list:after,ul.item_list>li:after,ul.item_list .list_content:after,.raw_image_gallery:after,form.pagination_form:after,.pagination_options:after,.faceted_search.list_view li.slide:after{clear:both}.clearfix,.meganav,.meganav_columnar_section,.nav_area,.body_form fieldset.radio_buttons .option,.upper_footer,#site_footer .sitemap_directory,.main_area_sitemap .sitemap_directory,article,.grid_gallery.list_view li.slide,.main_carousel .slick-nav,.main_carousel.module .slick-slider .content_body,.advanced_search .filter_bar .search_row,.content_page #primary_column,#secondary_column aside.list_view_module li,.wysiwyg_content .related_content_module ul,#secondary_column .related_content_module ul,.wysiwyg_content .related_content_module li,#secondary_column .related_content_module li,blockquote,.faq_section ul.q_and_a .text.answer,.double_teaser .teaser_container,ul.item_list,ul.item_list>li,ul.item_list .list_content,.raw_image_gallery,form.pagination_form,.pagination_options,.faceted_search.list_view li.slide{*zoom:1}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a,a:visited{text-decoration:underline}a[href]:after{content:\" (\" attr(href) \")\"}abbr[title]:after{content:\" (\" attr(title) \")\"}.ir a:after,a[href^=\"javascript:\"]:after,a[href^=\"#\"]:after{content:\"\"}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}html,button,input,select,textarea{color:#3c3c3c}.browsehappy{background:white;color:#333;padding:1em;position:absolute;top:0;left:0;z-index:9999;width:100%;height:100%}html.touch.-webkit-{-webkit-tap-highlight-color:transparent}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{position:absolute}:root{--breakpoint_for_desktop_nav:1199px}.site_header_area .brand_area{background:url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat;background-size:100%;display:inline-block;width:54px;height:54px}.site_header_area .brand_area .brand1{height:100%;float:left;text-indent:-9999px}.site_header_area .brand_area .brand2{display:block;float:left;height:100%;text-indent:-9999px}.site_header_area .brand_area a.top_logo,.site_header_area .brand_area a.sub_logo{width:100%;float:left}.site_header_area .brand_area a.top_logo{height:39%;width:35%}.site_header_area .brand_area a.sub_logo{height:48%}.site_header_area .brand_area a.single_logo{width:100%;float:left;height:82%}.site_header_area .brand_area .nasa_logo{width:100%;height:100%;display:block}*,*:before,*:after{box-sizing:border-box}body{margin-left:auto;margin-right:auto;margin-top:0;background-color:white}@media (max-width: 1199px){body.nav_overlay_true{overflow:hidden}}img{width:100%}p{line-height:1.4em;margin-bottom:17px;margin-top:0;font-size:16px;color:#222}@media (min-width: 600px), print{p{font-size:18px}}@media (min-width: 769px), print{p{margin-bottom:20px;font-size:16px}}@media (min-width: 1024px), print{p{font-size:17px}}@media (min-width: 1200px){p{font-size:18px}}a{text-decoration:none;color:#257cdf}a:hover{text-decoration:underline}a[name]{position:relative;display:block;visibility:hidden;margin:0;padding:0}@media (max-width: 1199px){a[name]{top:-58px}}@media (max-width: 1199px) and (min-width: 480px){a[name]{top:-58px}}@media (max-width: 1199px) and (min-width: 600px), print and (max-width: 1199px){a[name]{top:-58px}}@media (max-width: 1199px) and (min-width: 769px), print and (max-width: 1199px){a[name]{top:-70px}}@media (min-width: 1200px){a[name]{top:-47px}}dl,menu,ol,ul{margin:0;padding:0}ul{list-style-type:none}ol{list-style-position:inside}hr,.gradient_line,.related.module .gradient_line_module_top{clear:both;margin:1em 0}.print_only{display:none}.page_cover{position:absolute;display:none;background-color:rgba(0,0,0,0.5);width:100%;height:100%;z-index:21}.svg_icon_container{display:inline-block;height:24px;width:24px;vertical-align:middle}.svg_icon_container svg{width:100%;height:100%}@font-face{font-family:'Whitney';src:url(\"https://mars.nasa.gov/assets/fonts/Whitney-Book.otf\")}@font-face{font-family:'Whitney-Bold';src:url(\"https://mars.nasa.gov/assets/fonts/Whitney-Bold.otf\")}@font-face{font-family:'WhitneyCondensed-Bold';src:url(\"https://mars.nasa.gov/assets/fonts/WhitneyCondensed-Bold.otf\")}.button,.outline_button,.primary_media_feature .floating_text_area .button,.banner_header_overlay .button{font-weight:700;display:inline-block;margin-bottom:.5em;margin-left:auto;margin-right:auto;background-color:#3b788b;color:white;line-height:1em;border:0;text-decoration:none;border-radius:4px;cursor:pointer;text-shadow:none;font-size:13px;padding:12px 24px;text-transform:uppercase;white-space:nowrap}@media (min-width: 769px), print{.button,.outline_button,.primary_media_feature .floating_text_area .button,.banner_header_overlay .button{font-size:14px}}.button:hover,.outline_button:hover,.primary_media_feature .floating_text_area .button:hover{background-color:#5097ad;text-decoration:none}.outline_button,.primary_media_feature .floating_text_area .button,.banner_header_overlay .button{border-radius:10px;border:2px solid white;background:none;color:#FFF}.outline_button:hover,.primary_media_feature .floating_text_area .button:hover,.banner_header_overlay .button:hover{background-color:#5097ad;border-color:#5097ad}.msl .vital_signs_teaser .button{font-size:16px}.msl .button{background-color:#e34e41}.msl .button:hover{background-color:#FC6B5F;color:white}.insight_page .button{color:white;background-color:#3D75B3}.insight_page .button:hover{background-color:#4888D0}.meganav_container{display:none;line-height:1.4;position:absolute;z-index:30;left:0;top:58px;margin-top:-4px;width:370px;background-color:white;padding:1em 0 1.5em 0;white-space:normal;text-align:left;cursor:default;box-shadow:0 4px 4px -2px rgba(0,0,0,0.15);border-radius:3px}@media (min-width: 600px), print{.meganav_container{top:58px}}@media (min-width: 600px), print{.meganav_container{top:58px}}@media (min-width: 769px), print{.meganav_container{top:70px}}@media (min-width: 1024px), print{.meganav_container{top:74px}}@media (min-width: 1200px){.meganav_container{top:82px}}@media (min-width: 1700px){.meganav_container{top:88px}}.site_header.centered_nav .meganav_container{margin-top:-35px}@media (min-width: 1200px){.site_header.centered_nav .meganav_container{margin-top:-43px}}.meganav_container:before{content:'';position:absolute;width:100%;display:block;height:16px;top:-16px}.meganav_container .nav_item_indicator{position:absolute;display:none;z-index:50;top:-16px;left:calc(50% - 15px);width:0;height:0;border-bottom:16px solid white;border-left:16px solid transparent;border-right:16px solid transparent}.meganav_container.no_feature{padding:1em 0;width:352px}.meganav_container.no_feature .sections_container{padding-bottom:0}.meganav_container.wide{width:695px}.meganav_container .meganav_columnar_section .col{width:50%;float:left}.meganav_container .meganav_columnar_section .col a{display:block}.meganav{color:#2b2b2b;text-align:left;height:100%;margin:0 1.5em}.meganav p{color:#2b2b2b}.meganav .sections_container{width:100%;padding-bottom:0.8em}.meganav .sections_container:not(:only-child){margin-bottom:.5em}.meganav .sections_container li:first-child{padding-top:0}.meganav .sections_container li a{display:block;padding:.4em 0;font-size:1em;color:#5F5F5F;font-weight:600;text-decoration:none}.meganav .sections_container li a:hover,.touchevents .meganav .sections_container li a.pressed{color:black}.meganav .section_title{margin-top:.5em;font-size:17px}.meganav .section_description{margin:.5em 0 1em}.meganav .detail_container{height:calc(240px + 1.4em);width:auto;padding-top:1.4em;overflow:hidden;border-top:1px solid #dddfe1}.meganav.columnar{max-height:calc(100vh - 10em);overflow-y:scroll;overflow-x:hidden;padding:1rem;font-size:1rem;font-weight:400}.meganav.columnar .sections_container{-moz-column-width:9rem;column-width:9rem;-moz-column-gap:3.5rem;column-gap:3.5rem;-moz-column-rule:1px solid #dddfe1;column-rule:1px solid #dddfe1}.meganav.columnar .sections_container ul li{-moz-column-break-inside:avoid;break-inside:avoid}.meganav.columnar .sections_container ul li.top>a{padding-top:0}.meganav.columnar .sections_container ul li a{padding:1.3em 0 0.5em;color:#2b2b2b}.meganav.columnar .sections_container ul li a:hover,.touchevents .meganav.columnar .sections_container ul li a.pressed{color:black}.meganav.columnar .sections_container ul li ul li a{font-weight:500;padding:.4em 0;font-size:.9rem;color:#606061}.feature_info{height:100%;padding-top:0;max-width:1200px}.feature_info .image_container{vertical-align:top;height:100%;background-size:cover;background-position:center;position:relative}.feature_info .block_layout{height:100%}.feature_info .block_layout .image_container{display:none;width:49.15254%;float:left}.feature_info .block_layout .image_container:nth-child(2n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.feature_info .block_layout .image_container:nth-child(2n+2){margin-left:50.84746%;margin-right:-100%;clear:none}.feature_info .block_layout .image_container:nth-child(-n+2){display:block}@media (min-width: 1200px){.feature_info .block_layout .image_container{width:32.20339%;float:left}.feature_info .block_layout .image_container:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.feature_info .block_layout .image_container:nth-child(3n+2){margin-left:33.89831%;margin-right:-100%;clear:none}.feature_info .block_layout .image_container:nth-child(3n+3){margin-left:67.79661%;margin-right:-100%;clear:none}.feature_info .block_layout .image_container:nth-child(-n+3){display:block}}.feature_info .single_layout{height:100%}.feature_info .single_layout .image_container{display:block;float:left;width:320px}.feature_info .single_layout .description_container{width:43%;margin-left:.5em}@media (min-width: 1200px){.feature_info .single_layout .description_container{width:50%}}.feature_info .single_layout .description_container header{margin-bottom:0.3em}.feature_info .single_layout .description_container .content_title{color:#222;font-size:1.3em;letter-spacing:-.02em}.feature_info .single_layout .description_container .description{font-size:1em}.feature_info .category_title,.feature_info .homepage_carousel .floating_text_area .category_title,.homepage_carousel .floating_text_area .feature_info .category_title{text-transform:uppercase;font-size:0.7em;font-weight:600;color:#999}.feature_info .content_title{font-size:1.1em;font-weight:600}.feature_info .description_container{float:left;width:60%;padding:1em;max-width:600px}.feature_info .description_container .description{font-size:0.9em}.feature_info .bottom_description{transition:height 350ms ease-in-out;padding:1em;position:absolute;bottom:0;width:100%;height:35%;background-color:rgba(0,0,0,0.6);overflow:hidden}.feature_info .bottom_description .category_title{margin-bottom:0}.feature_info .bottom_description .content_title{color:#eee}.feature_info .bottom_description .description{color:#EAEAEA;opacity:0;transition:opacity 350ms ease-in-out;margin-top:4px}.feature_info .bottom_description.tall_description{height:45%}.feature_info .image_container:hover .bottom_description,.feature_info .image_container.pressed .bottom_description{height:100%;margin-top:4px}.feature_info .image_container:hover .bottom_description .description,.feature_info .image_container.pressed .bottom_description .description{opacity:1}.feature_info .image_container:hover .bottom_description .content_title,.feature_info .image_container.pressed .bottom_description .content_title{white-space:normal;overflow:auto}.touchevents #site_nav_container li.isHovered .nav_title a{color:#FFF}.meganav_container.dark_theme{background-color:#1f1f1f;color:white}.meganav_container.dark_theme .sections_container li a{color:#9f9f9f}.meganav_container.dark_theme .sections_container li a:hover,.touchevents .meganav_container.dark_theme .sections_container li a.pressed{color:white}.meganav_container.dark_theme .detail_container{border-top:1px solid #363636}.meganav_container.dark_theme .nav_item_indicator{border-bottom-color:#1f1f1f}.meganav_container.dark_theme .meganav_columnar_section{border-top:1px solid #363636}.meganav_container.dark_theme .meganav_columnar_section .title{color:#E3E3E3}.meganav_container.dark_theme .meganav_columnar_section .nav_item a{color:#9f9f9f}.meganav_container.dark_theme .meganav_columnar_section .nav_item a:hover,.touchevents .meganav_container.dark_theme .meganav_columnar_section .nav_item a.pressed{color:white}.meganav span.external_link_icon svg,.subnav span.external_link_icon svg{display:inline-block}.meganav span.no_wrap,.subnav span.no_wrap{display:inline;white-space:nowrap}.meganav_columnar_section{border-top:1px solid #d4d4d4;padding:1rem 0 0.5rem}.meganav_columnar_section .title{font-weight:600;font-size:0.75rem;font-family:\"Montserrat\",Helvetica,Arial,sans-serif;color:#7b7b7b;margin-bottom:0.5rem}.meganav_columnar_section .col{width:100%;float:left}.meganav_columnar_section .col a{display:block}.meganav_columnar_section .nav_item a{color:#5f5f5f;font-weight:600;margin-bottom:0.5rem;text-decoration:none}.meganav_columnar_section .nav_item a:hover{color:black}.meganav>.meganav_columnar_section:first-child{border-top:none;padding-top:.5rem}@media (min-width: 1200px){.nav_area{width:100%;height:100%;float:right;bottom:0;right:0;position:absolute;text-align:right;z-index:50;display:block !important}.nav_area .social_nav{display:none}}.no-touchevents .nav_is_fixed .fancybox-wrap #sticky_nav_spacer{display:none}.no-touchevents .nav_is_fixed .fancybox-wrap .nav_area{position:relative}@media (min-width: 1200px){#site_nav_container{padding:0;position:relative;display:inline-block !important;width:100%;height:100%;position:relative;bottom:0}}@media (min-width: 1200px) and (min-width: 1024px), print and (min-width: 1200px){#site_nav_container{bottom:0}}@media (min-width: 1200px) and (min-width: 1200px){#site_nav_container{bottom:0}}@media (min-width: 1200px){#site_nav_container .site_nav{width:100%;padding:0;position:relative;overflow-y:visible;min-height:0;height:100%;top:auto;left:auto;padding-top:15px}}@media (min-width: 1200px) and (min-width: 1200px){#site_nav_container .site_nav{padding-top:18px}}@media (min-width: 1200px) and (min-width: 1700px){#site_nav_container .site_nav{padding-top:20px;padding-right:0.8em}}@media (min-width: 1200px) and (min-width: 1200px){.center_header_container #site_nav_container .site_nav{padding-top:14px}}@media (min-width: 1200px) and (min-width: 1700px){.center_header_container #site_nav_container .site_nav{padding-top:16px}}@media (min-width: 1200px){#site_nav_container ul.nav{margin-bottom:0;display:inline-block;margin-right:.6em;height:100%}#site_nav_container ul.nav>li{padding:0;border:none;display:inline-block;cursor:pointer;height:auto;border-top-left-radius:2px;border-top-right-radius:2px;white-space:nowrap}#site_nav_container ul.nav>li:hover .nav_title a,#site_nav_container ul.nav>li.current .nav_title a{color:#eee}.center_header_container #site_nav_container ul.nav>li:hover .nav_title a,.center_header_container #site_nav_container ul.nav>li.current .nav_title a{color:#fff}#site_nav_container ul.nav>li:hover .global_subnav_container{display:block !important}#site_nav_container ul.nav>li .gradient_line,#site_nav_container ul.nav>li .related.module .gradient_line_module_top,.related.module #site_nav_container ul.nav>li .gradient_line_module_top,#site_nav_container ul.nav>li .arrow_box{display:none}#site_nav_container .nav_title{display:block;position:relative;line-height:1.4em;font-weight:700;margin-bottom:0;height:100%;cursor:pointer}#site_nav_container .nav_title a{color:#fff;text-decoration:none;font-size:.9em;padding:14px 9px 28px;display:block}}@media (min-width: 1200px) and (min-width: 1024px), print and (min-width: 1200px){#site_nav_container .nav_title a{padding-left:7px;padding-right:7px;font-size:.88em}}@media (min-width: 1200px) and (min-width: 1200px){#site_nav_container .nav_title a{padding:.5em 1em 2em;font-size:1em}}@media (min-width: 1200px) and (min-width: 1700px){#site_nav_container .nav_title a{font-size:1em}}@media (min-width: 1200px){.center_header_container #site_nav_container .nav_title a{padding-bottom:20px}#site_nav_container .nav_title a span.no_wrap{display:inline;white-space:nowrap}#site_nav_container ul.subnav{margin-bottom:0;min-width:190px;display:none;position:absolute;margin:0}.no-touchevents .nav_is_fixed #site_nav_container ul.subnav{box-shadow:0 4px 4px -2px rgba(0,0,0,0.15)}#site_nav_container ul.subnav li{text-align:left;clear:both;display:block}#site_nav_container ul.subnav li:first-child{border-top:none}#site_nav_container ul.subnav a{line-height:1.4em;text-decoration:none;display:block;font-weight:700;white-space:normal;padding:5px 9px 6px}#site_nav_container li.admin_site_nav_item{background-color:#D94F34}#site_nav_container li.admin_site_nav_item .nav_title a{color:white !important;padding-bottom:14px}#site_nav_container li.admin_site_nav_item:hover .nav_title,#site_nav_container li.admin_site_nav_item.current .nav_title{background-color:#FF7054 !important}#site_nav_container li.admin_site_nav_item:hover .nav_title a,#site_nav_container li.admin_site_nav_item.current .nav_title a{color:white}#site_nav_container li.admin_site_nav_item:hover .subnav{display:block !important}#site_nav_container li.admin_site_nav_item ul.subnav{border:none}#site_nav_container li.admin_site_nav_item ul.subnav a{color:white;padding:10px 9px 12px}#site_nav_container li.admin_site_nav_item ul.subnav li{background-color:#D94F34;border:none}#site_nav_container li.admin_site_nav_item ul.subnav li:hover{background-color:#FF7054}#site_nav_container li.admin_site_nav_item .global_subnav_container>.meganav_container{display:none !important}}@media (max-width: 1199px){.nav_area{display:none;position:fixed;left:0;width:104%;overflow:hidden;height:100%;min-height:100%;background-color:#5a2017;z-index:10000;top:58px}}@media (max-width: 1199px) and (min-width: 480px){.nav_area{top:58px}}@media (max-width: 1199px) and (min-width: 600px), print and (max-width: 1199px){.nav_area{top:58px}}@media (max-width: 1199px) and (min-width: 769px), print and (max-width: 1199px){.nav_area{top:70px}}@media (max-width: 1199px){#site_nav_container{width:100%;text-align:center;overflow-y:auto;padding:0 8.8% 150px 4.8%;height:100%;min-height:100%;-webkit-overflow-scrolling:touch}#site_nav_container .site_nav{display:block}#site_nav_container ul.nav{margin-bottom:2em}#site_nav_container ul.nav>li{display:block;padding:1em 0 0}#site_nav_container ul.nav>li .gradient_line,#site_nav_container ul.nav>li .related.module .gradient_line_module_top,.related.module #site_nav_container ul.nav>li .gradient_line_module_top{margin:1em 0 0 0}#site_nav_container ul.nav>li .arrow_box{padding:20px 20px;width:52px;float:right;cursor:pointer;margin:-0.4em -.8em 0 0;display:block;text-align:center}#site_nav_container ul.nav>li .arrow_box.reverse{transform:rotate(180deg);-ms-filter:\"progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=1.2246063538223773e-16, M21=-1.2246063538223773e-16, M22=-1, SizingMethod='auto expand')\"}#site_nav_container ul.nav>li .arrow_box .arrow_down{width:0;height:0;border-left:6px solid rgba(255,255,255,0);border-right:6px solid rgba(255,255,255,0);border-top:8px solid #fff;float:right}#site_nav_container .meganav_container{display:none !important}#site_nav_container .nav_title{margin-bottom:.3em;display:block;line-height:1.4em;font-weight:700;text-align:left;width:80%}#site_nav_container .nav_title a{font-size:1.2em;color:#fff;display:block;width:100%;height:100%;width:100%;padding:.4em .4em .4em 0}#site_nav_container .nav_title a:hover{text-decoration:none}#site_nav_container .global_subnav_container{display:none}#site_nav_container ul.subnav li{text-align:left}#site_nav_container ul.subnav a{color:#84B0DD;font-size:1em;line-height:1.4em;text-decoration:none;display:block;padding:.4em 0;font-weight:700;white-space:nowrap}#site_nav_container ul.nav>li.admin_site_nav_item .arrow_box .arrow_up,#site_nav_container ul.nav>li.admin_site_nav_item .arrow_box .arrow_down{border-top-color:#F45F5F}.no-touchevents #site_nav_container ul.nav>li.admin_site_nav_item .arrow_box:hover .arrow_up,.no-touchevents #site_nav_container ul.nav>li.admin_site_nav_item .arrow_box:hover .arrow_down{border-top-color:white}#site_nav_container ul.nav>li.admin_site_nav_item .nav_title a,#site_nav_container ul.nav>li.admin_site_nav_item ul.subnav a{color:#F45F5F}.no-touchevents #site_nav_container ul.nav>li.admin_site_nav_item .nav_title a:hover,.no-touchevents #site_nav_container ul.nav>li.admin_site_nav_item ul.subnav a:hover{color:white}#site_nav_container .overlay_search,#site_nav_container .meganav_overlay_search{margin-bottom:2em;width:100%;max-width:320px}#site_nav_container .overlay_search .search_field,#site_nav_container .meganav_overlay_search .search_field{width:100%}#site_nav_container .social_nav,#site_nav_container .social_icons{color:white;display:block;font-size:1.3em;width:100%;border-radius:4px;padding:1.3em 0 1.7em;max-width:320px;margin:0 auto}#site_nav_container .social_nav .nav_title,#site_nav_container .social_icons .nav_title{margin-bottom:1em;text-align:center;width:auto}#site_nav_container .social_nav .social_icons{padding:0}}body.admin_only #site_nav_container ul.nav>li .gradient_line,body.admin_only #site_nav_container ul.nav>li .related.module .gradient_line_module_top,.related.module body.admin_only #site_nav_container ul.nav>li .gradient_line_module_top{margin-left:auto;margin-right:auto;content:\" \";width:100%;height:1px;clear:both;background:#BEBEBE;background:linear-gradient(to right, rgba(190,190,190,0), #BEBEBE, rgba(190,190,190,0));background:-webkit-linear-gradient(to right, rgba(190,190,190,0), #BEBEBE, rgba(190,190,190,0));margin:1em 0 0 0}.section_search,.blog_search_form,.overlay_search,.meganav_overlay_search{color:white;display:inline-block;position:relative}.section_search .search_field,.blog_search_form .search_field,.overlay_search .search_field,.meganav_overlay_search .search_field{color:white;background-color:#282828;background-color:rgba(255,255,255,0.1);font-weight:500;font-size:16px;border:none;border-radius:4px;height:40px;padding-left:1.1em;padding-right:40px;width:155px}.section_search .search_field.placeholder,.blog_search_form .search_field.placeholder,.overlay_search .search_field.placeholder,.meganav_overlay_search .search_field.placeholder{color:rgba(255,255,255,0.8);-webkit-font-smoothing:antialiased;opacity:1 !important;font-family:\"Montserrat\",Helvetica,Arial,sans-serif}.section_search .search_field:-moz-placeholder,.blog_search_form .search_field:-moz-placeholder,.overlay_search .search_field:-moz-placeholder,.meganav_overlay_search .search_field:-moz-placeholder{color:rgba(255,255,255,0.8);-webkit-font-smoothing:antialiased;opacity:1 !important;font-family:\"Montserrat\",Helvetica,Arial,sans-serif}.section_search .search_field::-moz-placeholder,.blog_search_form .search_field::-moz-placeholder,.overlay_search .search_field::-moz-placeholder,.meganav_overlay_search .search_field::-moz-placeholder{color:rgba(255,255,255,0.8);-webkit-font-smoothing:antialiased;opacity:1 !important;font-family:\"Montserrat\",Helvetica,Arial,sans-serif}.section_search .search_field::-webkit-input-placeholder,.blog_search_form .search_field::-webkit-input-placeholder,.overlay_search .search_field::-webkit-input-placeholder,.meganav_overlay_search .search_field::-webkit-input-placeholder{color:rgba(255,255,255,0.8);-webkit-font-smoothing:antialiased;opacity:1 !important;font-family:\"Montserrat\",Helvetica,Arial,sans-serif}.section_search .search_field::-ms-clear,.blog_search_form .search_field::-ms-clear,.overlay_search .search_field::-ms-clear,.meganav_overlay_search .search_field::-ms-clear{display:none;width:0;height:0}.section_search .search_submit,.blog_search_form .search_submit,.overlay_search .search_submit,.meganav_overlay_search .search_submit{padding:0;cursor:pointer;width:42px;height:42px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -127px -5px;background-size:300px;position:absolute;right:-5px;top:-3px;border:none;margin-left:-44px;opacity:.8}.section_search .search_submit:hover,.blog_search_form .search_submit:hover,.overlay_search .search_submit:hover,.meganav_overlay_search .search_submit:hover,.section_search .search_submit.active,.blog_search_form .search_submit.active,.overlay_search .search_submit.active,.meganav_overlay_search .search_submit.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -127px -5px;background-size:300px}.section_search .search_field,.blog_search_form .search_field{background-color:#F3F4F8;color:#222}.section_search .search_field.placeholder,.blog_search_form .search_field.placeholder{color:rgba(255,255,255,0.8);opacity:1 !important}.section_search .search_field:-moz-placeholder,.blog_search_form .search_field:-moz-placeholder{color:rgba(255,255,255,0.8);opacity:1 !important}.section_search .search_field::-moz-placeholder,.blog_search_form .search_field::-moz-placeholder{color:rgba(255,255,255,0.8);opacity:1 !important}.section_search .search_field::-webkit-input-placeholder,.blog_search_form .search_field::-webkit-input-placeholder{color:rgba(255,255,255,0.8);opacity:1 !important}.section_search .search_submit,.blog_search_form .search_submit{padding:0;cursor:pointer;width:42px;height:42px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -127px -54px;background-size:300px;opacity:.6}.section_search .search_submit:hover,.blog_search_form .search_submit:hover,.section_search .search_submit.active,.blog_search_form .search_submit.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -127px -54px;background-size:300px}form.nav_search .search_field,form.meganav_search .search_field{padding-right:20px;height:34px}form.nav_search input:-webkit-autofill,form.overlay_search input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px #989898 inset;-webkit-text-fill-color:white !important}.overlay_search .search_field,.meganav_overlay_search .search_field{color:white;background-color:rgba(255,255,255,0.3)}.overlay_search .search_field.placeholder,.meganav_overlay_search .search_field.placeholder{color:white}.overlay_search .search_field:-moz-placeholder,.meganav_overlay_search .search_field:-moz-placeholder{color:white}.overlay_search .search_field::-moz-placeholder,.meganav_overlay_search .search_field::-moz-placeholder{color:white}.overlay_search .search_field::-webkit-input-placeholder,.meganav_overlay_search .search_field::-webkit-input-placeholder{color:white}.overlay_search label.search_label,.meganav_overlay_search label.search_label{display:none}.overlay_search .search_submit,.meganav_overlay_search .search_submit{padding:0;cursor:pointer;width:42px;height:42px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -131px -5px;background-size:300px}.overlay_search .search_submit:hover,.overlay_search .search_submit.active,.meganav_overlay_search .search_submit:hover,.meganav_overlay_search .search_submit.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -131px -5px;background-size:300px}.blog_search_form .search_field.placeholder{color:#5a6470;font-weight:400}.blog_search_form .search_field:-moz-placeholder{color:#5a6470;font-weight:400}.blog_search_form .search_field::-moz-placeholder{color:#5a6470;font-weight:400}.blog_search_form .search_field::-webkit-input-placeholder{color:#5a6470;font-weight:400}.body_form label{display:block;margin-bottom:.3em}.body_form input:not([type=\"submit\"]):not([type=\"reset\"]),.body_form textarea{font-size:16px}.body_form input[type=\"text\"]:not(#recaptcha_response_field),.body_form input[type=\"tel\"],.body_form input[type=\"email\"]{height:40px}.body_form input:not(#recaptcha_response_field):not(.inline_button):not([type=\"submit\"]):not([type=\"radio\"]):not([type=\"checkbox\"]),.body_form textarea{width:100%;border:1px solid #a7a8a8;background-color:white;border-radius:4px;padding:10px 12px}.body_form input,.body_form textarea{margin-bottom:1em}.body_form .button{margin-top:1em}.body_form select{position:relative;padding:.5em 2em .5em 1em;font-size:16px;border:0;height:40px;vertical-align:middle;color:white;-webkit-appearance:none;-o-appearance:none;-moz-appearance:none;background:#3b788b url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat 95% 10px;background-position:right .8em top 10px;background-size:9px;font-weight:700;cursor:pointer;width:100%;border-radius:5px;max-width:304px;margin-bottom:1em}.body_form select::-ms-expand{display:none}.body_form select option{padding:0.5em 1em}.body_form label{font-weight:700}.body_form .radio_title{margin-bottom:.5em;font-weight:700}.body_form fieldset.radio_buttons .option{white-space:nowrap;margin-bottom:1em}.body_form fieldset.radio_buttons label{white-space:normal;vertical-align:middle;display:inline}.body_form fieldset.radio_buttons input[type=\"radio\"],.body_form fieldset.radio_buttons input[type=\"checkbox\"]{display:inline-block;margin:0 .5em 0 0;vertical-align:middle}.body_form fieldset.radio_buttons input[type=\"radio\"]+label,.body_form fieldset.radio_buttons input[type=\"checkbox\"]+label{font-weight:400}.body_form .centered{text-align:center}@media (max-width: 480px){#recaptcha_widget_div{overflow:hidden}#recaptcha_widget_div #recaptcha_area{margin:0 auto}}.event_location,.event_date{margin-bottom:1em}form#ic_signupform .form-header{display:none}form#ic_signupform label{display:block !important}form#ic_signupform label:not(.checkbox){margin-bottom:3px !important}form#ic_signupform .elcontainer .formEl.required label span.indicator.required,form#ic_signupform .elcontainer .formEl.required h3 span.indicator.required{color:red;padding-left:.2em}form#ic_signupform .elcontainer .formEl.required:before{display:none}form#ic_signupform .elcontainer .formEl.required.fieldtype-checkbox h3{margin-bottom:3px}form#ic_signupform .elcontainer .formEl.required .option-container{padding-top:0}form#ic_signupform .elcontainer .formEl.required label.checkbox{position:relative;padding-left:1.8em}form#ic_signupform .elcontainer .formEl.required label.checkbox input[type='checkbox']{position:absolute;top:50%;margin-top:-7px;left:.5em}form#ic_signupform .submit-container input[type='submit'].btn-submit{font-weight:700;display:inline-block;margin-bottom:.5em;margin-left:auto;margin-right:auto;background-color:#1d56a3;color:white;line-height:1;border:0;text-decoration:none;border-radius:4px;cursor:pointer;text-shadow:none;font-size:13px;padding:12px 24px;text-transform:uppercase;white-space:nowrap}form#ic_signupform .submit-container input[type='submit'].btn-submit:hover{background-color:#4A81C1;text-decoration:none}form#ic_signupform+img{display:none}.site_header_area{height:58px}@media (min-width: 600px), print{.site_header_area{height:58px}}@media (min-width: 600px), print{.site_header_area{height:58px}}@media (min-width: 769px), print{.site_header_area{height:70px}}@media (min-width: 1024px), print{.site_header_area{height:74px}}@media (min-width: 1200px){.site_header_area{height:82px}}@media (min-width: 1700px){.site_header_area{height:88px}}.site_header_area .brand_area{top:4px;margin-left:8px;height:49px;width:260px;transition:width .3s, height .3s;background-size:contain}.site_header_area .site_logo_container{top:16px;margin-left:0;width:189px}.site_header_area .menu_button,.site_header_area #modal_close{top:8px;right:8px}@media (min-width: 769px), print{.site_header_area .brand_area{top:6px;margin-left:12px;height:60px;width:313px}.site_header_area .site_logo_container{top:23px;margin-left:13px;width:189px}.site_header_area .menu_button,.site_header_area #modal_close{top:12px;right:12px}}@media (min-width: 1024px), print{.site_header_area .brand_area{top:12px;margin-left:10px;height:54px;width:288px}.site_header_area .site_logo_container{width:120px}}@media (min-width: 1200px){.site_header_area .brand_area{top:14px;margin-left:17px;height:60px;width:338px}.site_header_area .site_logo_container{top:30px;width:210px}}@media (min-width: 1700px){.site_header_area .brand_area{top:14px;margin-left:30px}.site_header_area .site_logo_container{top:30px;width:246px}}@media (min-width: 769px), print{#home:not(.nav_is_fixed) .brand_area{height:60px;width:329px}}@media (min-width: 1024px), print{#home:not(.nav_is_fixed) .brand_area{width:300px;height:55px}}@media (min-width: 1200px){#home:not(.nav_is_fixed) .brand_area{width:368px;height:68px}}@media (min-width: 1700px){#home:not(.nav_is_fixed) .brand_area{width:420px;height:78px}}.site_header_area{background-color:#5a2017;width:100%;position:absolute;z-index:22}.site_header_area.opaque{transition:background-color .5s ease-in-out}.main_feature_present .site_header_area,.main_feature_present .site_header_area.subsite{background-color:transparent}.main_feature_present .site_header_area.opaque{background-color:transparent}#home.nav_is_fixed .site_header_area{z-index:42}.nav_is_fixed .site_header_area{box-shadow:0 4px 4px -2px rgba(0,0,0,0.15);transition:background-color .5s ease-in-out;background-color:#5a2017}.site_header_area .site_header{width:100%;height:100%}.site_header_area .brand_area{position:relative;display:inline-block;z-index:100;background-image:url(\"https://mars.nasa.gov/assets/[email protected]\")}.site_header_area .brand_area .brand1{width:23%}.site_header_area .brand_area .brand2{width:70%;margin-left:3px}@media (min-width: 769px){.site_header_area .brand_area .brand2{display:block}}.site_header_area .site_logo_container{position:relative;display:inline-block;vertical-align:top;z-index:100}@media (min-width: 769px), print{.site_header_area .site_logo_container:before{content:\"\";height:110%;background-color:rgba(255,255,255,0.4);width:1px;position:absolute;left:-9px;top:0px}}@media (min-width: 1024px), print{.site_header_area .site_logo_container:before{height:150%;top:1px}}@media (min-width: 1200px){.site_header_area .site_logo_container:before{height:110%;top:-2px}}@media (min-width: 1700px){.site_header_area .site_logo_container:before{top:0px}}.site_header_area .site_logo_container a{display:block}.site_header_area .site_logo_container a:hover{text-decoration:none}.site_header_area .site_logo_container img.site_logo{display:block;position:relative;width:130px;top:3px}@media (min-width: 769px), print{.site_header_area .site_logo_container img.site_logo{width:170px;top:0px}}@media (min-width: 1024px), print{.site_header_area .site_logo_container img.site_logo{width:120px;top:6px}}@media (min-width: 1200px){.site_header_area .site_logo_container img.site_logo{width:188px;top:0}}@media (min-width: 1700px){.site_header_area .site_logo_container img.site_logo{width:215px}}.site_header_area .site_logo_container img.site_logo_truncated{display:none}@media (min-width: 1024px), print{.site_header_area .site_logo_container img.site_logo_truncated{display:block}}@media (min-width: 1200px){.site_header_area .site_logo_container img.site_logo_truncated{display:none}}.site_header_area img.site_logo_black{display:none}.site_header_area form.nav_search,.site_header_area form.meganav_search{display:inline-block;vertical-align:middle;margin-right:1em}.main_feature_present.insight_page.secondary_nav_is_fixed .site_header_area.subsite{background-color:#172E46;top:0}.header_mask{display:none}@media (min-width: 1200px){.header_mask{height:58px;display:block}}@media (min-width: 1200px) and (min-width: 600px), print and (min-width: 1200px){.header_mask{height:58px}}@media (min-width: 1200px) and (min-width: 600px), print and (min-width: 1200px){.header_mask{height:58px}}@media (min-width: 1200px) and (min-width: 769px), print and (min-width: 1200px){.header_mask{height:70px}}@media (min-width: 1200px) and (min-width: 1024px), print and (min-width: 1200px){.header_mask{height:74px}}@media (min-width: 1200px) and (min-width: 1200px){.header_mask{height:82px}}@media (min-width: 1200px) and (min-width: 1700px){.header_mask{height:88px}}.site_header_area .brand_area.subsite_brand{background-image:none;display:inline-flex;align-items:center;color:white;width:auto;top:5px}@media (min-width: 1024px), print{.site_header_area .brand_area.subsite_brand{top:10px}}.site_header_area .brand_area.subsite_brand .brand1{background:url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat;background-size:100%;background-position:center;width:17%;width:50px}@media (min-width: 769px), print{.site_header_area .brand_area.subsite_brand .brand1{width:65px}}@media (min-width: 1024px), print{.site_header_area .brand_area.subsite_brand .brand1{width:69px}}.site_header_area .brand_area.subsite_brand .site_title{text-transform:uppercase;vertical-align:middle;font-size:22px;margin-left:0.2rem;font-size:1.6rem}@media (min-width: 480px){.site_header_area .brand_area.subsite_brand .site_title{margin-left:0.6rem}}.site_header_area .brand_area.subsite_brand .subsite_title{vertical-align:middle;font-size:5.1vw;color:white;font-weight:500;margin-left:.4rem}.site_header_area .brand_area.subsite_brand .subsite_title:hover{text-decoration:none}@media (min-width: 480px){.site_header_area .brand_area.subsite_brand .subsite_title{font-size:1.5rem}}.magic_shell_page #site_nav_container ul.nav>li:hover{background-color:transparent}.magic_shell_page #site_nav_container ul.nav>li:hover ul.subnav{text-indent:0}@media (min-width: 1200px){.magic_shell_page #site_nav_container ul.nav>li:hover ul.subnav{display:none}}.magic_shell_page #site_nav_container .external_nav_item.expanded .meganav_container{display:block !important}@media (max-width: 1199px){#sticky_nav_spacer{height:58px}}@media (max-width: 1199px) and (min-width: 480px){#sticky_nav_spacer{height:58px}}@media (max-width: 1199px) and (min-width: 600px), print and (max-width: 1199px){#sticky_nav_spacer{height:58px}}@media (max-width: 1199px) and (min-width: 769px), print and (max-width: 1199px){#sticky_nav_spacer{height:70px}}@media (max-width: 1199px){.main_feature_present #sticky_nav_spacer{display:none}}.site_header_area .menu_icon{color:transparent;font-size:0}@media (max-width: 1199px){.site_header_area{display:block;position:fixed}.fixfixed .site_header_area{position:absolute;box-shadow:none}.nav_is_fixed .site_header_area{box-shadow:0 4px 4px -2px rgba(0,0,0,0.15)}.nav_overlay_true .site_header_area{background-color:#5a2017;transition:none}.site_header_area img.grace_logo_black{display:none}.site_header_area .right_header_container{width:300px}.site_header_area .right_header_container .menu_button{position:absolute;display:block;vertical-align:middle;padding:10px;text-decoration:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none}.site_header_area .right_header_container .menu_button .menu_icon{display:block;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0 0;background-size:300px}.site_header_area .right_header_container .menu_button .menu_icon:hover,.site_header_area .right_header_container .menu_button .menu_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0 0;background-size:300px}.site_header_area .right_header_container #modal_close{position:absolute;padding:10px;text-decoration:none;display:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none}.site_header_area .right_header_container #modal_close .modal_close_icon{display:block;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0;background-size:300px}.site_header_area .right_header_container #modal_close .modal_close_icon:hover,.site_header_area .right_header_container #modal_close .modal_close_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0;background-size:300px}.site_header_area .right_header_container form.nav_search,.site_header_area .right_header_container form.meganav_search{margin-right:0}.site_header_area.menu_open #modal_close{display:block}.site_header_area.menu_open .nav_area{display:block}.site_header_area.menu_open #menu_button{display:none}.site_header_area .meganav_container{display:none !important}}@media (min-width: 1200px){.site_header_area{display:block !important}.site_header_area form.nav_search,.site_header_area form.meganav_search{display:inline-block;max-width:216px}.site_header_area form.nav_search .search_field,.site_header_area form.meganav_search .search_field{width:37px;padding-right:0;padding-left:0;height:34px}.site_header_area form.nav_search .search_open,.site_header_area form.meganav_search .search_open{padding-left:.8em;padding-right:38px;width:100%}.nav_is_fixed .site_header_area{bottom:auto;top:0;position:fixed;width:100%;box-shadow:0 4px 4px -2px rgba(0,0,0,0.15);margin-top:0px}.site_header_area .menu_button{display:none}}body.megasection_nav_present.insight_page .secondary_megasection_nav .megasection_nav.megasection_nav--nav-hidden{display:none}#site_footer{padding:0;background:black;background-size:100%;position:relative;line-height:1.4}@media (min-width: 600px), print{#site_footer{background:#000 url(\"https://mars.nasa.gov/assets/footer_bg.png\") center no-repeat;background-size:cover}}@media (min-width: 1200px){#site_footer{background-position:center 70%}}#site_footer .gradient_line,#site_footer .related.module .gradient_line_module_top,.related.module #site_footer .gradient_line_module_top{margin-left:auto;margin-right:auto;content:\" \";width:100%;height:1px;clear:both;background:#a7abd2;background:linear-gradient(to right, rgba(167,171,210,0), #a7abd2, rgba(167,171,210,0));background:-webkit-linear-gradient(to right, rgba(167,171,210,0), #a7abd2, rgba(167,171,210,0));width:90%}@media (min-width: 769px), print{#site_footer .gradient_line,#site_footer .related.module .gradient_line_module_top,.related.module #site_footer .gradient_line_module_top{width:50%}}#site_footer .footer_line{display:none;margin-left:auto;margin-right:auto;content:\" \";width:85%;height:1px;clear:both;background-color:rgba(255,255,255,0.25)}@media (min-width: 600px), print{#site_footer .footer_line{display:block;width:65%}}.mars_now_footer{display:block;margin:0 auto;text-align:center;width:0;height:0;margin-bottom:5em}.mars_now_footer .mars_now a:before{transform:translate(-50%, -20%)}@media (min-width: 480px){.mars_now_footer .mars_now a:before{transform:translate(-50%, -30%)}}@media (min-width: 600px), print{.mars_now_footer .mars_now a:before{transform:translate(-50%, -60%)}}@media (min-width: 769px), print{.mars_now_footer .mars_now a:before{transform:translate(-50%, -80%)}}@media (min-width: 1024px), print{.mars_now_footer .mars_now a:before{position:absolute;transform:translate(-50%, -50%)}}.mars_now_footer .footer_title{color:white;font-size:.8em;font-weight:bold;width:200px;text-align:center;position:relative;left:-100px;top:-20px}@media (min-width: 600px), print{.mars_now_footer .footer_title{top:-45px}}@media (min-width: 769px), print{.mars_now_footer .footer_title{top:-65px}}@media (min-width: 1024px), print{.mars_now_footer .footer_title{top:25px}}.upper_footer{padding:2em 0 0em;width:100%;margin:0 auto}.msl .upper_footer{padding:0}@media (min-width: 600px), print{.upper_footer{padding:4em 0 4em}}@media (min-width: 1024px), print{.upper_footer{width:85%}}@media (min-width: 1200px){.upper_footer{width:70%}}.upper_footer .share,.upper_footer .footer_newsletter,.upper_footer .newsletter{text-align:center;margin-bottom:2.7em;width:90%}@media (min-width: 480px){.upper_footer .share,.upper_footer .footer_newsletter,.upper_footer .newsletter{width:75%}}@media (min-width: 600px), print{.upper_footer .share,.upper_footer .footer_newsletter,.upper_footer .newsletter{margin-bottom:4em;width:60%}}@media (min-width: 769px), print{.upper_footer .share,.upper_footer .footer_newsletter,.upper_footer .newsletter{width:48%}}@media (min-width: 1024px), print{.upper_footer .share,.upper_footer .footer_newsletter,.upper_footer .newsletter{width:44%}}.upper_footer .share h2,.upper_footer .footer_newsletter h2,.upper_footer .newsletter h2{font-size:1.8em;font-weight:400;margin-bottom:0.6em;color:#ccdeef;letter-spacing:-.035em;margin-top:0}.share_newsletter_container{display:flex;flex-direction:column;align-items:center}@media (min-width: 769px), print{.share_newsletter_container{flex-direction:row;align-items:unset;justify-content:space-around}}@media (min-width: 1024px), print{.share_newsletter_container{justify-content:space-between}}.newsletter form{display:inline-block;position:relative;width:100%}.newsletter form input:-webkit-autofill,.newsletter form input:-webkit-autofill:hover,.newsletter form input:-webkit-autofill:focus,.newsletter form textarea:-webkit-autofill,.newsletter form textarea:-webkit-autofill:hover,.newsletter form textarea:-webkit-autofill:focus,.newsletter form select:-webkit-autofill,.newsletter form select:-webkit-autofill:hover,.newsletter form select:-webkit-autofill:focus,.newsletter form input:-internal-autofill-selected{-webkit-box-shadow:0 0 0px 1000px #3b4351 inset;-webkit-text-fill-color:#fff !important}.newsletter input[type=email]{background-color:rgba(59,67,81,0.75);color:white;width:100%;padding:.7em .5em .7em 15px;border:0;border-radius:5px}.newsletter input[type=submit]{padding:0;cursor:pointer;width:40px;height:29px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -94px -30px;background-size:300px;position:absolute;right:7px;top:8px;border:none;opacity:1}.newsletter ::-moz-placeholder{color:white;opacity:1}.newsletter :-ms-input-placeholder{color:white;opacity:1}.newsletter ::-ms-input-placeholder{color:white;opacity:1}.newsletter ::placeholder{color:white;opacity:1}.lower_footer{padding-bottom:4em}@media (min-width: 769px), print{.lower_footer{padding-bottom:9em}}.lower_footer .nav_container{margin:0 auto 1em;position:relative;left:0;width:100%}@media (min-width: 769px), print{.lower_footer .nav_container{padding-top:0.5em}}.lower_footer nav{font-size:1em;text-transform:uppercase;text-align:center;margin-left:auto;margin-right:auto;color:#98c7fc}.lower_footer nav a{padding:0 .4em;font-weight:600;color:#98c7fc;font-size:.85em;text-decoration:none;line-height:2em}@media (min-width: 769px), print{.lower_footer nav a{padding:0 .6em}}.no-touchevents .lower_footer nav a:hover{color:white}.lower_footer nav li{display:inline}.lower_footer nav li:not(:last-child):after{content:\"|\"}.lower_footer .credits{position:relative;float:none;width:auto;text-align:center}.lower_footer .credits .footer_brands_top,.lower_footer .credits .staff,.lower_footer .credits p{color:#ccdeef;font-weight:700;font-size:1em;text-align:center;line-height:1.3em}@media (min-width: 769px), print{.lower_footer .credits .footer_brands_top,.lower_footer .credits .staff,.lower_footer .credits p{font-size:1em}}.lower_footer .credits .footer_brands_top p{font-weight:400}.lower_footer .credits .footer_brands_top p:last-child{margin-bottom:.4em}.lower_footer .credits .footer_brands{color:#ccdeef;margin-bottom:1em}.lower_footer .credits .footer_brands .caltech{font-weight:300}.lower_footer .credits .staff,.lower_footer .credits .staff p{line-height:1.6em;margin:.3em 0;font-weight:400}.lower_footer .credits a{color:#ccdeef;font-weight:700}.no-touchevents .lower_footer .credits a:hover{color:white}.megasection_nav_present.insight_page #site_footer{background-image:url(\"https://mars.nasa.gov/assets/insight_footer_subsurface.jpg\");background-position:top center;background-repeat:no-repeat;background-size:cover}.megasection_nav_present.insight_page #site_footer .lower_footer{padding-bottom:28em}.megasection_nav_present.msl #site_footer .upper_footer{margin:0 auto;padding:4em 0 4em}.msl_sitemap_title{margin:0 auto;color:white;text-align:center;display:inherit;font-size:1.4em;margin-bottom:1.3em;padding-top:1.2em}@media (max-width: 1199px){#site_nav_container .nav_title a{color:#FFF}#site_nav_container .overlay_search{margin-bottom:2em;width:100%;max-width:320px}#site_nav_container .overlay_search .search_field{width:100%}#site_nav_container .social_nav,#site_nav_container .social_icons{background-color:#394862}}@media (max-width: 1199px){.subsite.site_header_area{background-color:#172E46}.subsite.site_header_area.menu_open,.main_feature_present.nav_is_fixed .subsite.site_header_area{background-color:#172E46}.subsite.site_header_area .nav_area{background-color:#172E46}.subsite.site_header_area .nav_area .gradient_line,.subsite.site_header_area .nav_area .related.module .gradient_line_module_top,.related.module .subsite.site_header_area .nav_area .gradient_line_module_top{width:60%;margin-top:1.5em;margin-bottom:1.5em;margin-left:auto;margin-right:auto;content:\" \";width:100%;height:1px;clear:both;background:#9BACBE;background:linear-gradient(to right, rgba(155,172,190,0), #9BACBE, rgba(155,172,190,0));background:-webkit-linear-gradient(to right, rgba(155,172,190,0), #9BACBE, rgba(155,172,190,0))}}.qqq{border:0px solid yellow}@media (min-width: 1200px){#site_nav_container ul.nav{padding-top:9px}#site_nav_container ul.nav>li{border-radius:2px}#site_nav_container ul.nav>li:hover{border-bottom-left-radius:0;border-bottom-right-radius:0;z-index:20}#site_nav_container ul.nav>li:hover .subnav{display:block;z-index:1}#site_nav_container ul.nav>li .gradient_line,#site_nav_container ul.nav>li .related.module .gradient_line_module_top,.related.module #site_nav_container ul.nav>li .gradient_line_module_top{display:none}#site_nav_container ul.nav>li .arrow_box{display:none}#site_nav_container ul.nav>li:last-child .global_subnav_container>ul.subnav{border-top-left-radius:2px;right:-52px}#site_nav_container .nav_title{display:inline-block}#site_nav_container .nav_title a,#site_nav_container .nav_title .main_nav_item{display:block;font-size:.88rem;font-weight:600;padding:.5em 6px;color:white}}@media (min-width: 1200px) and (min-width: 1200px){#site_nav_container .nav_title a,#site_nav_container .nav_title .main_nav_item{padding:.5em 0.8em;font-size:.9rem}}@media (min-width: 1200px) and (min-width: 1700px){#site_nav_container .nav_title a,#site_nav_container .nav_title .main_nav_item{padding:.5em 1em}}@media (min-width: 1200px){#site_nav_container .admin_site_nav_item .nav_title{padding-bottom:0}#site_nav_container ul.subnav{display:none !important;padding:0.4em 0;border-bottom-left-radius:2px;border-bottom-right-radius:2px;border-top-right-radius:2px}.main_feature_present #site_nav_container ul.subnav{background-color:rgba(0,0,0,0.5)}.main_feature_present.nav_is_fixed #site_nav_container ul.subnav{background-color:#9a4739}#site_nav_container ul.subnav li{text-align:left;display:block !important}#site_nav_container ul.subnav li:hover{background-color:rgba(0,0,0,0.3)}#site_nav_container ul.subnav a{white-space:normal;font-size:.85em;color:white;padding:.4em 1em}}@media (min-width: 1200px) and (min-width: 1024px), print and (min-width: 1200px){#site_nav_container ul.subnav a{padding:.4em 1.1em}}@media (min-width: 1200px){.no-touchevents #site_nav_container ul.subnav a:hover{color:white}#site_nav_container .social_nav{display:none}#site_nav_container li.admin_site_nav_item ul.subnav,ul.subnav .main_feature_present.nav_is_fixed #site_nav_container li.admin_site_nav_item,#site_nav_container li.admin_site_nav_item:hover ul.subnav,ul.subnav .main_feature_present.nav_is_fixed #site_nav_container li.admin_site_nav_item:hover{background-color:#D94F34}}#site_nav_container .nav_title,#site_nav_container ul.subnav a{font-weight:600}.site_header_area ul.nav .mars_now a.icon::before,.mars_now_footer .mars_now a::before{content:\"\";display:block;width:6.25em;height:4.6875em;background-image:url(\"https://mars.nasa.gov/assets/mars.svg\");background-repeat:no-repeat;background-size:contain}@media (max-width: 1199px){.site_header_area ul.nav .mars_now a{padding-left:2em !important}.site_header_area ul.nav .mars_now a::before{transform:translate(-80%, -33%);font-size:0.75em;margin-bottom:-4.6875em}}@media (min-width: 1024px) and (max-width: 1100px){.site_header_area .brand_area{width:248px}}@media (min-width: 1200px){.site_header_area .brand_area{top:8px}.site_header_area ul.nav .mars_now{margin-right:.8em}.site_header_area ul.nav .mars_now a::before{position:absolute;transform:translate(-60%, -50%)}.site_header_area ul.nav .mars_now .section_title{margin-bottom:0}.site_header_area ul.nav .mars_now .section_description,.site_header_area ul.nav .mars_now .feature_info .image_container:hover .bottom_description .description,.site_header_area ul.nav .mars_now .feature_info .image_container.pressed .bottom_description .description{font-weight:400}.site_header_area ul.nav .mars_now,.mars_now_footer .mars_now{background-color:transparent !important}.site_header_area ul.nav .mars_now a span,.mars_now_footer .mars_now a span{position:absolute;left:-9999px}#site_nav_container .nav_title .main_nav_item.icon{padding-right:.8em;padding-left:2.2em}}@media (min-width: 1200px){.subsite :hover .subnav,.main_feature_present.nav_is_fixed .subsite :hover .subnav{display:none}.subsite .site_nav ::-webkit-input-placeholder{color:transparent}.subsite .site_nav :-moz-placeholder{color:transparent}.subsite .site_nav ::-moz-placeholder{color:transparent}.subsite .site_nav :-ms-input-placeholder{color:transparent}.nav_is_fixed .site_header_area.subsite,.site_header_area.subsite{background-color:#172E46}}@media (min-width: 1200px){body#home .subsite .nav_title>a{color:white}}@media (min-width: 1200px){.magic_shell_site_nav #site_nav_container .insight_site_nav ul.nav>li:not(.admin_site_nav_item){height:auto}.insight_page #site_nav_container .insight_site_nav ul.nav>li:hover{background-color:transparent}#site_nav_container .insight_site_nav ul.nav>li:hover .subnav{display:none}#site_nav_container .insight_site_nav .meganav_container{background-color:white;margin-top:-11px}}@media (min-width: 1700px){#site_nav_container .insight_site_nav .meganav_container{margin-top:-15px}}#site_footer .sitemap{font-weight:400;z-index:10;position:relative;margin-bottom:2em}@media (min-width: large){#site_footer .sitemap .grid_layout{width:97%}}#site_footer .sitemap_directory{margin-bottom:2em}#site_footer .sitemap_directory .footer_sitemap_item{margin-bottom:1.8em}@media (min-width: 600px), print{#site_footer .sitemap_directory .footer_sitemap_item{margin-bottom:2em}}@media (min-width: 1024px), print{#site_footer .sitemap_directory .footer_sitemap_item{margin-left:10%}}#site_footer .sitemap_title{font-weight:400;text-transform:capitalize;font-size:1em;margin-bottom:.4em;margin-top:0}#site_footer .sitemap_title a,#site_footer .sitemap_title .no_link_nav_item{color:white;text-decoration:none}@media (min-width: 600px), print{#site_footer .sitemap_title{font-size:1.1em;margin-bottom:.4em}}@media (min-width: 1024px), print{#site_footer .sitemap_title{font-size:1.1em}}#site_footer .sitemap_block{text-align:center;width:100%}@media (min-width: 600px), print{#site_footer .sitemap_block{box-sizing:border-box;width:25%;float:left;padding-left:1.66667%;padding-right:1.66667%;text-align:left}}@media (min-width: 1024px), print{#site_footer .sitemap_block{box-sizing:border-box;width:16.66667%;float:left;padding-left:1.66667%;padding-right:1.66667%}}#site_footer ul.subnav{margin-bottom:1em}#site_footer ul.subnav li{padding-left:1em;text-indent:-1em;margin:0 0 .25em 0}#site_footer ul.subnav a{color:#98c7fc;text-decoration:none;font-size:1em}@media (min-width: 600px), print{#site_footer ul.subnav a{font-size:.85em}}@media (min-width: 1024px), print{#site_footer ul.subnav a{font-size:.95em}}.no-touchevents #site_footer ul.subnav a:hover{color:white}@media (min-width: 600px), print{.main_area_sitemap .grid_layout{width:100%}}.main_area_sitemap .sitemap_directory{padding:2em 0 0}.main_area_sitemap .sitemap_directory .footer_sitemap_item{margin-bottom:1.8em}@media (min-width: 600px), print{.main_area_sitemap .sitemap_directory .footer_sitemap_item{margin-bottom:2em}}.main_area_sitemap .sitemap_block{text-align:center;width:100%}@media (min-width: 600px), print{.main_area_sitemap .sitemap_block{box-sizing:border-box;width:25%;float:left;padding-left:1.66667%;padding-right:1.66667%;text-align:left}}@media (min-width: 1024px), print{.main_area_sitemap .sitemap_block{box-sizing:border-box;width:16.66667%;float:left;padding-left:1.66667%;padding-right:1.66667%}}.main_area_sitemap .sitemap_block a{word-wrap:normal}.main_area_sitemap .sitemap_title{margin-top:0}.main_area_sitemap .sitemap_title a,.main_area_sitemap .sitemap_title .no_link_nav_item{color:#222}.main_area_sitemap .subnav a{display:block}@media (min-width: 600px), print{.main_area_sitemap .subnav a{padding-left:1em;text-indent:-1em;margin:.1em 0}}.social_icons{display:block}.social_icons .icon{width:44px !important;height:44px !important;display:inline-block;overflow:hidden}.social_icons .icon+.icon{margin-left:.7em}@media (min-width: 769px), print{.social_icons .icon+.icon{margin-left:.9em}}.social_icons .icon img{opacity:1 !important;height:100%;max-width:none}.triple_teaser .social_icons{max-width:188px;white-space:nowrap}@media (min-width: 769px), print{.triple_teaser .social_icons{max-width:none}}.triple_teaser .social_icons .icon{width:44px;height:44px}.triple_teaser .social_icons .icon+.icon{margin-left:.7em}@media (min-width: 600px), print{.triple_teaser .social_icons .icon{width:38px;height:38px}.triple_teaser .social_icons .icon+.icon{margin-left:.4em;margin-left:calc((100% - 152px)/3)}}@media (min-width: 769px), print{.triple_teaser .social_icons .icon{width:44px;height:44px}.triple_teaser .social_icons .icon+.icon{margin-left:.8em}}.addthis_default_style .at300b,.addthis_default_style .at300bo,.addthis_default_style .at300m{padding:0 !important;float:none !important}#_atssh{display:none}#at4-share,#at4-soc{top:60%;bottom:auto}#secondary_column ul.sidebar_share{margin-left:0.3em !important}#secondary_column ul.sidebar_share li{list-style:none;margin-bottom:0}#secondary_column ul.sidebar_share li a.icon{width:48px;display:inline-block;margin-right:0.5em;margin-bottom:0.5em}#secondary_column ul.sidebar_share li .share_text{display:inline-block;vertical-align:middle}#secondary_column ul.sidebar_share li+li{margin-top:0.5em}.meganav_container{display:none;line-height:1.4;position:absolute;z-index:30;left:0;margin-top:-5px;width:352px;background-color:white;padding:1em 0 1.5em 0;white-space:normal;text-align:left;cursor:default;box-shadow:0 1px 1px 1px rgba(0,0,0,0.15);border-radius:3px}.meganav_container .nav_item_indicator{position:absolute;z-index:50;top:-15px;left:calc(50% - 15px);width:0;height:0;border-bottom:16px solid white;border-left:16px solid transparent;border-right:16px solid transparent}.meganav_container.no_feature{padding:1em 0}.meganav_container.no_feature .sections_container{padding:0.2rem 0 0.3em}.external_nav_item{left:auto;right:0}.external_nav_item .sections_container+.sections_container{margin-top:1rem;border-top:1px solid #BEBEBE;padding-top:1rem}.meganav{color:#2b2b2b;text-align:left;height:100%;margin:0 1.5em}.meganav p{color:#2b2b2b}.meganav .sections_container{height:100%;width:100%;display:inline-block;padding-bottom:0.8em}.meganav .sections_container li:first-child{padding-top:0}.meganav .sections_container li a:hover,.meganav .sections_container li a .touchevents a.pressed{color:#222}.meganav .detail_container{height:240px;width:auto;padding-top:1.4em;overflow:hidden;border-top:1px solid #dddfe1}.feature_info{height:100%;padding-top:0;max-width:1200px}.feature_info .image_container{vertical-align:top;height:100%;background-size:cover;background-position:center;position:relative}.feature_info .block_layout{height:100%}.feature_info .block_layout .image_container{display:none;width:49.15254%;float:left}.feature_info .block_layout .image_container:nth-child(2n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.feature_info .block_layout .image_container:nth-child(2n+2){margin-left:50.84746%;margin-right:-100%;clear:none}.feature_info .block_layout .image_container:nth-child(-n+2){display:block}@media (min-width: 1200px){.feature_info .block_layout .image_container{width:32.20339%;float:left}.feature_info .block_layout .image_container:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.feature_info .block_layout .image_container:nth-child(3n+2){margin-left:33.89831%;margin-right:-100%;clear:none}.feature_info .block_layout .image_container:nth-child(3n+3){margin-left:67.79661%;margin-right:-100%;clear:none}.feature_info .block_layout .image_container:nth-child(-n+3){display:block}}.feature_info .single_layout{height:100%}.feature_info .single_layout .image_container{display:block;float:left;width:300px}.feature_info .single_layout .description_container{width:43%;margin-left:.5em}@media (min-width: 1200px){.feature_info .single_layout .description_container{width:50%}}.feature_info .single_layout .description_container header{margin-bottom:0.3em}.feature_info .single_layout .description_container .content_title{color:#222;font-size:1.3em;letter-spacing:-.02em}.feature_info .single_layout .description_container .description{font-size:1em}.feature_info .category_title,.feature_info .homepage_carousel .floating_text_area .category_title,.homepage_carousel .floating_text_area .feature_info .category_title{text-transform:uppercase;font-size:0.7em;font-weight:600;color:#999}.feature_info .content_title{font-size:1.1em;font-weight:600}.feature_info .description_container{float:left;width:60%;padding:1em;max-width:600px}.feature_info .description_container .description{font-size:0.9em}.feature_info .bottom_description{transition:height 350ms ease-in-out;padding:1em;position:absolute;bottom:0;width:100%;height:35%;background-color:rgba(0,0,0,0.6);overflow:hidden}.feature_info .bottom_description .category_title{margin-bottom:0}.feature_info .bottom_description .content_title{color:#eee}.feature_info .bottom_description .description{color:#EAEAEA;opacity:0;transition:opacity 350ms ease-in-out;margin-top:4px}.feature_info .bottom_description.tall_description{height:45%}.feature_info .image_container:hover .bottom_description,.feature_info .image_container.pressed .bottom_description{height:100%;margin-top:4px}.feature_info .image_container:hover .bottom_description .description,.feature_info .image_container.pressed .bottom_description .description{opacity:1}.feature_info .image_container:hover .bottom_description .content_title,.feature_info .image_container.pressed .bottom_description .content_title{white-space:normal;overflow:auto}.touchevents #site_nav_container li.isHovered .nav_title a{color:#FFF}.meganav_container.dark_theme{background-color:#1f1f1f;color:white}.meganav_container.dark_theme .sections_container li a{color:#9f9f9f}.meganav_container.dark_theme .sections_container li a:hover,.touchevents .meganav_container.dark_theme .sections_container li a.pressed{color:white}.meganav_container.dark_theme .detail_container{border-top:1px solid #363636}.meganav_container.dark_theme .nav_item_indicator{border-bottom-color:#1f1f1f}.meganav_columnar_section{border-top:1px solid #d4d4d4;padding:1rem 0 0.5rem}.meganav_columnar_section .title{font-weight:600;font-size:0.75rem;margin-bottom:.2rem;font-family:\"Raleway\",Helvetica,Arial,sans-serif;color:#939393;margin-bottom:0.5rem}.meganav_columnar_section .col{width:50%;float:left}.meganav_columnar_section .col a{display:block}.meganav_columnar_section .nav_item a{color:#5f5f5f;font-weight:600;margin-bottom:0.5rem;text-decoration:none}.meganav_columnar_section .nav_item a:hover{color:black}.site_header_area.subsite .nav_title{padding-bottom:15px}.admin_site_nav_item.expanded .meganav_container{display:none !important}#site_nav_container ul.nav li:hover .subnav.hide{display:none}@media (min-width: 1200px){.site_header_area.missions_gallery_subnav_open,#home .site_header_area.missions_gallery_subnav_open,#home.nav_is_fixed .site_header_area.missions_gallery_subnav_open{background-color:#000}}.arrow_expand{display:inline-block;width:28px;height:22px;pointer-events:none}.arrow_expand.open{transform:rotateX(-180deg)}.missions_gallery_subnav_item.open .arrow_expand{transform:rotateX(-180deg)}#site_nav_container .missions_gallery_subnav_item .global_subnav_container ul.subnav,.missions_gallery_subnav_item .global_subnav_container ul.subnav body.admin_only #site_nav_container{display:none !important}.missions_gallery_subnav_item .global_subnav_container .meganav_container{display:none !important}@media (max-width: 1199px){.missions_gallery_subnav_item .nav_title a{pointer-events:none}}.missions_gallery_subnav_item .nav_title:hover{cursor:pointer}#site_nav_container ul.nav>li.missions_gallery_subnav_item.open,#site_nav_container ul.nav>li:hover.missions_gallery_subnav_item.open{padding-bottom:25px;background-color:#1B2021}@media (max-width: 1199px){#site_nav_container ul.nav>li.missions_gallery_subnav_item.open,#site_nav_container ul.nav>li:hover.missions_gallery_subnav_item.open{background-color:inherit}}.missions_gallery_subnav{display:none;position:absolute;top:58px;left:0;right:0;bottom:0;width:116%;left:-5.8%}@media (min-width: 600px), print{.missions_gallery_subnav{top:58px}}@media (min-width: 600px), print{.missions_gallery_subnav{top:58px}}@media (min-width: 769px), print{.missions_gallery_subnav{top:70px}}@media (min-width: 1024px), print{.missions_gallery_subnav{top:74px}}@media (min-width: 1200px){.missions_gallery_subnav{top:82px}}@media (min-width: 1700px){.missions_gallery_subnav{top:88px}}@media (min-width: 1200px){.missions_gallery_subnav{width:100%;left:0}}.missions_gallery_subnav .toggle_button{pointer-events:none}@media (max-width: 1199px){.nav_overlay_true .main_nav_item .arrow_expand{display:none}.nav_overlay_true .missions_gallery_subnav{position:relative;top:0;background-color:#421711}.nav_overlay_true .missions_gallery_subnav.open{background-color:#32110e}.nav_overlay_true .missions_gallery_subnav.open .missions_gallery_subnav_title{background-color:#32110e;color:#fff;font-size:1.3em;font-weight:500}.nav_overlay_true .missions_gallery_subnav.open .mission_items{background-color:#32110e;max-height:none;overflow-y:hidden}.nav_overlay_true .missions_gallery_subnav.open .mission_items .mission_item{width:32%;flex-basis:100%;margin:.35em 5%}.nav_overlay_true .missions_gallery_subnav.open .missions_links{background-color:#32110e}.nav_overlay_true .missions_gallery_subnav.open .missions_links li,.nav_overlay_true .missions_gallery_subnav.open .missions_links li:hover{background-color:inherit}}@media (max-width: 1199px) and (max-width: 480px){.nav_overlay_true .missions_gallery_subnav.open .missions_links li,.nav_overlay_true .missions_gallery_subnav.open .missions_links li:hover{display:block}}@media (max-width: 1199px){.nav_overlay_true .missions_gallery_subnav.open .missions_links li a.button,.nav_overlay_true .missions_gallery_subnav.open .missions_links li a.button:hover,.nav_overlay_true .missions_gallery_subnav.open .missions_links li:hover a.button,.nav_overlay_true .missions_gallery_subnav.open .missions_links li:hover a.button:hover{background-color:inherit;color:#98c7fc}}@media (max-width: 1199px) and (max-width: 1199px){.nav_overlay_true .missions_gallery_subnav.open .missions_links li a.button,.nav_overlay_true .missions_gallery_subnav.open .missions_links li a.button:hover,.nav_overlay_true .missions_gallery_subnav.open .missions_links li:hover a.button,.nav_overlay_true .missions_gallery_subnav.open .missions_links li:hover a.button:hover{text-transform:capitalize;font-size:1em}}@media (max-width: 1199px){.nav_overlay_true .missions_gallery_subnav.open a.close_button{display:none}}@media (max-width: 1199px) and (min-width: 480px){.nav_overlay_true .missions_gallery_subnav.open .mission_items .mission_item{margin:.3em 1%;flex-basis:48%}}@media (max-width: 1199px) and (min-width: 1024px), print and (max-width: 1199px){.nav_overlay_true .missions_gallery_subnav.open .mission_items .mission_item{margin:.5em 1%;flex-basis:29%}}.missions_gallery_subnav.open{display:block;background-color:#1B2021;font-family:\"Montserrat\",Helvetica,Arial,sans-serif}.missions_gallery_subnav.open .missions_gallery_subnav_title{background-color:#1B2021;color:#b1b1b1;font-weight:400;text-align:center;margin-bottom:0;margin-top:0;padding:1.5em 0 1em;cursor:default}.missions_gallery_subnav.open .mission_items{width:100%;background-color:#1B2021;padding:0 6%;display:flex;flex-direction:row;align-items:flex-start;align-content:space-between;white-space:normal;flex-flow:row wrap;justify-content:center;overflow-y:auto;cursor:auto}.missions_gallery_subnav.open .mission_items::-webkit-scrollbar{width:8px}.missions_gallery_subnav.open .mission_items::-webkit-scrollbar-thumb{background-color:rgba(107,107,107,0.6)}.missions_gallery_subnav.open .mission_items::-webkit-scrollbar-track{background-color:rgba(157,157,157,0.4)}.missions_gallery_subnav.open .mission_items .mission_item{display:inline-block;width:15%;margin:.5%;position:relative}.missions_gallery_subnav.open .mission_items .mission_item:hover .mission_title{display:none}.missions_gallery_subnav.open .mission_items .mission_title{text-align:left;font-size:.9em;font-weight:500;color:#fff;position:absolute;margin-left:.8em;margin-bottom:.9em;bottom:0;padding:0 5px}.missions_gallery_subnav.open .mission_items .mission_title span.external_link_icon{margin-left:.1em}.missions_gallery_subnav.open .mission_items .mission_title span.external_link_icon svg{display:inline-block}.missions_gallery_subnav.open .mission_items .mission_image{overflow:hidden;-o-object-fit:cover;object-fit:cover}.missions_gallery_subnav.open .mission_items .mission_link{width:100%}.missions_gallery_subnav.open .mission_items .mission_description{display:none;max-width:100%;color:#fff;position:absolute}.missions_gallery_subnav.open .mission_items .mission_item:hover .mission_description{padding:.9rem;position:absolute;opacity:1;height:auto;top:0;right:0;width:100%;height:100%;color:white;background-color:rgba(0,0,0,0.9);text-align:left;cursor:pointer;font-size:.95rem;line-height:1.3;display:block}.missions_gallery_subnav.open .mission_items .rollover_description .overlay_arrow{position:absolute;width:14px;height:14px;bottom:14px;right:14px}.missions_gallery_subnav.open .mission_items .mission_item_overlay{position:absolute;height:50%;width:100%;top:50%;left:0;background-image:linear-gradient(transparent, rgba(0,0,0,0.9))}.missions_gallery_subnav.open .missions_links{background-color:#1B2021;text-align:center;padding:2em 0;cursor:default}.missions_gallery_subnav.open .missions_links li{display:inline-block;padding:0 .5em}.missions_gallery_subnav.open .missions_links a.button{background-color:#34393c}@media (min-width: 1200px){.missions_gallery_subnav.open .missions_links a.button{font-weight:600}}.missions_gallery_subnav.open .missions_links li:hover a.button{background-color:#454b4e}.missions_gallery_subnav.open a.close_button{position:absolute;top:.8em;right:.8em;z-index:99;opacity:.5;top:.8em;right:.8em;z-index:99;opacity:.5;display:block;width:25px;height:25px}.no-touchevents .missions_gallery_subnav.open a.close_button:hover{opacity:1}@media (min-width: 600px), print{.missions_gallery_subnav.open a.close_button{top:1.5em;right:1.5em}}@media (min-width: 1700px){.missions_gallery_subnav.open a.close_button{top:1.2em;right:1.2em}}.missions_gallery_subnav.open a.close_button .close_icon{display:block;height:100%;position:relative}.missions_gallery_subnav.open a.close_button .close_icon:before{transform:rotate(-45deg);content:'';position:absolute;height:2px;width:100%;top:calc(50% - 1px);left:0;background:#d4d4d4}.missions_gallery_subnav.open a.close_button .close_icon:after{transform:rotate(45deg);content:'';position:absolute;height:2px;width:100%;top:calc(50% - 1px);left:0;background:#d4d4d4}@media all and (-ms-high-contrast: none), (-ms-high-contrast: active){body .image_of_the_day.no_parallax .featured_image picture{display:block}body .image_of_the_day.no_parallax .featured_image picture img{position:absolute;transform:translateY(-50%);top:50%}}html,html a,select,input,button{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}html.no-touchevents{text-rendering:optimizeLegibility}html.no-touchevents html a,html.no-touchevents select,html.no-touchevents input,html.no-touchevents button{text-rendering:optimizeLegibility}input.placeholder,textarea.placeholder{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}input:-moz-placeholder,textarea:-moz-placeholder{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}input::-moz-placeholder,textarea::-moz-placeholder{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}html,button,input,select,textarea{font-family:\"Montserrat\",Helvetica,Arial,sans-serif;color:#222}html{min-height:100%}body{font-family:\"Montserrat\",Helvetica,Arial,sans-serif;font-weight:300;font-size:96%;line-height:1.4;min-height:100%;position:relative;background-color:transparent}body.noscroll{overflow-y:hidden}@media (min-width: 600px), print{body{font-size:98%}}@media (min-width: 769px), print{body{font-size:100%}}@media (min-width: 1024px), print{body{font-size:102%}}@media (min-width: 1200px){body{font-size:104%}}h1,h2,h3,h4,h5{line-height:1.2em;font-weight:700;letter-spacing:-.01em;margin:1.2em 0 .5em}@media (min-width: 769px), print{h1,h2,h3,h4,h5{margin:1.5em 0 .5em}}h1{font-size:2.2em;letter-spacing:-.03em}h2{font-size:1.8em;letter-spacing:-.03em}h3{font-size:1.4em;letter-spacing:-.02em}h4{font-size:1.1em;letter-spacing:-.02em}img{width:100%}img,embed,object,video{max-width:100%}.jwplayer video{max-width:none}.jw-rightclick{display:none !important}i{font-style:italic}strong{font-weight:700}p{margin:1em 0;font-size:100%}.gradient_line,.related.module .gradient_line_module_top{margin-left:auto;margin-right:auto;content:\" \";width:100%;height:1px;clear:both;background:#b76b5f;background:linear-gradient(to right, rgba(183,107,95,0), #b76b5f, rgba(183,107,95,0));background:-webkit-linear-gradient(to right, rgba(183,107,95,0), #b76b5f, rgba(183,107,95,0))}.gradient_line_extra_margin{margin-left:auto;margin-right:auto;content:\" \";width:100%;height:1px;clear:both;background:#BEBEBE;background:linear-gradient(to right, rgba(190,190,190,0), #BEBEBE, rgba(190,190,190,0));background:-webkit-linear-gradient(to right, rgba(190,190,190,0), #BEBEBE, rgba(190,190,190,0));margin:2em 0}@media (min-width: 769px), print{.gradient_line_extra_margin{margin:3em 0}}.insight_page #at-share-dock,.insight_page .addthis-smartlayers-mobile{display:none;width:0;height:0}td.gssb_a img{width:auto}.module_title,.media_feature_title,.sitemap_title,.nav_title,.article_title,.sidebar_title,#secondary_column .related_content_module .module_title,.right_col .related_content_module .module_title,.rollover_title{letter-spacing:-.02em}.module_title{letter-spacing:-.02em}.rollover_title{font-size:2.34em;margin-bottom:0em}@media (min-width: 600px), print{.rollover_title{font-size:2.7em;margin-bottom:0em}}@media (min-width: 769px), print{.rollover_title{font-size:3.06em;margin-bottom:0em}}@media (min-width: 1024px), print{.rollover_title{font-size:3.24em;margin-bottom:0em}}@media (min-width: 1200px){.rollover_title{font-size:3.42em;margin-bottom:0em}}.content_title{letter-spacing:0;font-weight:600}.module_title{font-size:1.69em;margin-bottom:.35em;text-align:center;font-weight:600;margin-top:0}@media (min-width: 600px), print{.module_title{font-size:1.95em;margin-bottom:.63em}}@media (min-width: 769px), print{.module_title{font-size:2.21em;margin-bottom:.91em}}@media (min-width: 1024px), print{.module_title{font-size:2.34em;margin-bottom:1.015em}}@media (min-width: 1200px){.module_title{font-size:2.47em;margin-bottom:1.12em}}@media (min-width: 600px), print{.grid_gallery .module_title{text-align:left;width:80%}}.module_title_small,.double_teaser .module_title{font-size:1.4em}@media (min-width: 600px), print{.module_title_small,.double_teaser .module_title{font-size:1.8em;margin-bottom:.85em}}.filter_bar .module_title_small,.filter_bar .double_teaser .module_title{text-align:left;width:90%}@media (min-width: 600px), print{.filter_bar .module_title_small,.filter_bar .double_teaser .module_title{text-align:center}}.category_title,.homepage_carousel .floating_text_area .category_title{font-size:.9em;font-weight:500;color:#f08d77;text-transform:uppercase;margin-bottom:6px;margin-top:0}.multimedia_teaser .category_title,.multimedia_teaser .homepage_carousel .floating_text_area .category_title,.homepage_carousel .floating_text_area .multimedia_teaser .category_title{font-size:.8em}.primary_media_feature .media_feature_title{font-size:1.43em;margin-bottom:0em;font-weight:400;color:white}@media (min-width: 600px), print{.primary_media_feature .media_feature_title{font-size:1.65em;margin-bottom:0em}}@media (min-width: 769px), print{.primary_media_feature .media_feature_title{font-size:1.87em;margin-bottom:0em}}@media (min-width: 1024px), print{.primary_media_feature .media_feature_title{font-size:1.98em;margin-bottom:0em}}@media (min-width: 1200px){.primary_media_feature .media_feature_title{font-size:2.09em;margin-bottom:0em}}.image_of_the_day .media_feature_title{font-size:1.43em;margin-bottom:0em;font-weight:600;color:white}@media (min-width: 600px), print{.image_of_the_day .media_feature_title{font-size:1.65em;margin-bottom:0em}}@media (min-width: 769px), print{.image_of_the_day .media_feature_title{font-size:1.87em;margin-bottom:0em}}@media (min-width: 1024px), print{.image_of_the_day .media_feature_title{font-size:1.98em;margin-bottom:0em}}@media (min-width: 1200px){.image_of_the_day .media_feature_title{font-size:2.09em;margin-bottom:0em}}.multimedia_module_gallery .media_feature_title{font-size:1.43em;margin-bottom:0em;color:white;font-weight:600}@media (min-width: 600px), print{.multimedia_module_gallery .media_feature_title{font-size:1.65em;margin-bottom:0em}}@media (min-width: 769px), print{.multimedia_module_gallery .media_feature_title{font-size:1.87em;margin-bottom:0em}}@media (min-width: 1024px), print{.multimedia_module_gallery .media_feature_title{font-size:1.98em;margin-bottom:0em}}@media (min-width: 1200px){.multimedia_module_gallery .media_feature_title{font-size:2.09em;margin-bottom:0em}}.article_title{font-size:1.82em;margin-bottom:0em;font-weight:600;margin-top:0}@media (min-width: 600px), print{.article_title{font-size:2.1em;margin-bottom:0em}}@media (min-width: 769px), print{.article_title{font-size:2.38em;margin-bottom:0em}}@media (min-width: 1024px), print{.article_title{font-size:2.52em;margin-bottom:0em}}@media (min-width: 1200px){.article_title{font-size:2.66em;margin-bottom:0em}}.magic_shell_title,#iframe_overlay .magic_shell_title{font-family:WhitneyCondensed-Bold,Helvetica,Arial,sans-serif;background-color:#000;font-size:2.6em;font-weight:normal;padding:.9em .5em;text-align:center;line-height:.8}@media (min-width: 600px), print{.magic_shell_title,#iframe_overlay .magic_shell_title{padding:.9em .5em;text-align:left;font-size:2.6em}}.magic_shell_title .parent_title,#iframe_overlay .magic_shell_title .parent_title{display:block}.magic_shell_title .parent_title a,#iframe_overlay .magic_shell_title .parent_title a{color:#f08d77;transition:color 400ms}.magic_shell_title .parent_title a:hover,#iframe_overlay .magic_shell_title .parent_title a:hover{text-decoration:none;color:white}@media (min-width: 600px), print{.magic_shell_title .parent_title,#iframe_overlay .magic_shell_title .parent_title{display:inline;margin-right:0.1em}}.magic_shell_title .article_title,#iframe_overlay .magic_shell_title .article_title{color:#FFF;font-weight:normal}.magic_shell_title .article_title,#iframe_overlay .magic_shell_title .article_title,.magic_shell_title .parent_title,#iframe_overlay .magic_shell_title .parent_title{font-size:.7em;text-transform:uppercase;letter-spacing:normal}.sidebar_title,#secondary_column .related_content_module .module_title,.right_col .related_content_module .module_title{font-size:1.55em;margin-bottom:0.6em;font-weight:700;margin-left:-1px;margin-top:0}.links_module a{font-size:1em;cursor:pointer}.content_page .bread_and_nav_container{margin-top:0;margin-bottom:1.1rem}.content_page .bread_and_nav_container .gradient_line,.content_page .bread_and_nav_container .related.module .gradient_line_module_top,.related.module .content_page .bread_and_nav_container .gradient_line_module_top{display:none}.bread_and_nav_container .gradient_line,.bread_and_nav_container .related.module .gradient_line_module_top,.related.module .bread_and_nav_container .gradient_line_module_top{margin-left:auto;margin-right:auto;content:\" \";width:100%;height:1px;clear:both;background:#8c8c8c;background:linear-gradient(to right, rgba(140,140,140,0), #8c8c8c, rgba(140,140,140,0));background:-webkit-linear-gradient(to right, rgba(140,140,140,0), #8c8c8c, rgba(140,140,140,0));max-width:435px;margin:2rem auto 2.3rem}.breadcrumbs{color:#257cdf;margin:0 0 1.2rem 0}.breadcrumbs .crumb{text-transform:uppercase;font-size:.9rem;font-weight:400}.breadcrumbs .crumb:before{content:\"\\0203A\";font-size:1rem;margin:0 .3rem}.breadcrumbs .crumb:first-of-type:before{content:\"\"}.breadcrumbs.centered{text-align:center}.module{padding:2.5em 0 2.2em;position:relative}@media (min-width: 769px), print{.module{padding:4.8em 0 5em}}.grid_layout{max-width:100%;margin-left:auto;margin-right:auto;width:95%}.grid_layout:after{content:\" \";display:block;clear:both}@media (min-width: 600px), print{.grid_layout{max-width:100%;margin-left:auto;margin-right:auto;width:95%}.grid_layout:after{content:\" \";display:block;clear:both}}@media (min-width: 769px), print{.grid_layout{max-width:100%;margin-left:auto;margin-right:auto;width:90%}.grid_layout:after{content:\" \";display:block;clear:both}}@media (min-width: 1024px), print{.grid_layout{max-width:1200px;width:97%}.content_page .grid_layout{width:90%}}.grid_list_page.module .grid_layout .module:first-of-type,.full_width .grid_layout .module:first-of-type{padding-top:0}.grid_list_page.module .grid_layout .grid_layout,.full_width .grid_layout .grid_layout{width:100%;max-width:none}.grid_layout .grid_layout{width:100%;max-width:none}@media (max-width: 480px){.suggested_features .grid_layout,.news_teaser .grid_layout,.carousel_teaser .grid_layout{width:100%}.suggested_features .grid_layout header,.news_teaser .grid_layout header,.carousel_teaser .grid_layout header{margin-left:auto;margin-right:auto;width:95%}.suggested_features .grid_layout footer,.news_teaser .grid_layout footer,.carousel_teaser .grid_layout footer{margin-left:auto;margin-right:auto;width:95%}}.gradient_container_top,.gradient_container_bottom,.white_gradient_container_bottom{height:200px;max-height:45%;width:100%;position:absolute;z-index:1}.homepage_carousel .gradient_container_top,.homepage_carousel .gradient_container_bottom,.homepage_carousel .white_gradient_container_bottom{z-index:7}.gradient_container_left{height:100%;width:70%;position:absolute;z-index:1}.gradient_container_top{background:-owg-linear-gradient(rgba(0,0,0,0.6), transparent);background:linear-gradient(rgba(0,0,0,0.6), transparent);pointer-events:none;top:0}.gradient_container_left{background:-owg-linear-gradient(to right, rgba(0,0,0,0.6), transparent);background:linear-gradient(to right, rgba(0,0,0,0.6), transparent);left:0;top:0}.gradient_container_bottom{background:-owg-linear-gradient(transparent, rgba(0,0,0,0.9));background:linear-gradient(transparent, rgba(0,0,0,0.9));pointer-events:none;bottom:0}.white_gradient_container_bottom{background:url(\"https://mars.nasa.gov/assets/white_gradient.png\") repeat-x bottom left;bottom:0;height:100px;pointer-events:none}.gradient_bottom_grid{background-image:linear-gradient(to bottom, transparent 0%, #000 30%, #000 100%)}.content_page_template .grid_gallery.module{padding:2rem 0 2rem}.grid_gallery .gallery_header{margin-bottom:2em;z-index:1}@media (min-width: 769px), print{.grid_gallery .gallery_header{margin-bottom:3em}}.grid_gallery .gallery_header .module_title{margin-bottom:0.5em;text-align:left;margin-top:0}.grid_gallery .list_date{font-size:.9em;margin-bottom:.4em;color:#5A5A5A}.grid_gallery.grid_view{background:white}.grid_gallery.grid_view .content_title{letter-spacing:-.03em;display:none}.grid_gallery.grid_view .image_and_description_container{min-height:0}.grid_gallery.grid_view .article_teaser_body{display:none}.grid_gallery.grid_view .list_date{display:none}.grid_gallery.grid_view .list_image{width:100%;float:none;margin:0}.grid_gallery.grid_view .bottom_gradient{color:#222;display:block;position:relative;margin-top:0.3rem;padding-bottom:0.4rem;text-align:left;min-height:52px}@media (min-width: 769px), print{.grid_gallery.grid_view .bottom_gradient{margin-top:.5rem;min-height:85px}}.grid_gallery.grid_view .bottom_gradient div{text-align:left}.grid_gallery.grid_view .bottom_gradient h3{margin-top:0;font-weight:500;font-size:1em}.grid_gallery.grid_view li.slide{margin-bottom:.84034%;width:49.57983%;float:left}.grid_gallery.grid_view li.slide:nth-child(2n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.grid_gallery.grid_view li.slide:nth-child(2n+2){margin-left:50.42017%;margin-right:-100%;clear:none}@media (min-width: 600px), print{.grid_gallery.grid_view li.slide{margin-bottom:.84034%;width:32.77311%;float:left}.grid_gallery.grid_view li.slide:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.grid_gallery.grid_view li.slide:nth-child(3n+2){margin-left:33.61345%;margin-right:-100%;clear:none}.grid_gallery.grid_view li.slide:nth-child(3n+3){margin-left:67.22689%;margin-right:-100%;clear:none}}@media (min-width: 769px), print{.grid_gallery.grid_view li.slide{width:24.36975%;float:left}.grid_gallery.grid_view li.slide:nth-child(4n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.grid_gallery.grid_view li.slide:nth-child(4n+2){margin-left:25.21008%;margin-right:-100%;clear:none}.grid_gallery.grid_view li.slide:nth-child(4n+3){margin-left:50.42017%;margin-right:-100%;clear:none}.grid_gallery.grid_view li.slide:nth-child(4n+4){margin-left:75.63025%;margin-right:-100%;clear:none}}@media (min-width: 1200px){.grid_gallery.grid_view li.slide{width:19.32773%;float:left}.grid_gallery.grid_view li.slide:nth-child(5n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.grid_gallery.grid_view li.slide:nth-child(5n+2){margin-left:20.16807%;margin-right:-100%;clear:none}.grid_gallery.grid_view li.slide:nth-child(5n+3){margin-left:40.33613%;margin-right:-100%;clear:none}.grid_gallery.grid_view li.slide:nth-child(5n+4){margin-left:60.5042%;margin-right:-100%;clear:none}.grid_gallery.grid_view li.slide:nth-child(5n+5){margin-left:80.67227%;margin-right:-100%;clear:none}}.grid_gallery.grid_view li.slide a{text-decoration:none}.content_page_template .grid_gallery.grid_view .slide{margin-bottom:.84034%;width:49.57983%;float:left}.content_page_template .grid_gallery.grid_view .slide:nth-child(2n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.content_page_template .grid_gallery.grid_view .slide:nth-child(2n+2){margin-left:50.42017%;margin-right:-100%;clear:none}@media (min-width: 769px), print{.content_page_template .grid_gallery.grid_view .slide{margin-bottom:.84034%;width:32.77311%;float:left}.content_page_template .grid_gallery.grid_view .slide:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.content_page_template .grid_gallery.grid_view .slide:nth-child(3n+2){margin-left:33.61345%;margin-right:-100%;clear:none}.content_page_template .grid_gallery.grid_view .slide:nth-child(3n+3){margin-left:67.22689%;margin-right:-100%;clear:none}}@media (min-width: 1024px), print{.content_page_template .grid_gallery.grid_view .slide{width:24.36975%;float:left}.content_page_template .grid_gallery.grid_view .slide:nth-child(4n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.content_page_template .grid_gallery.grid_view .slide:nth-child(4n+2){margin-left:25.21008%;margin-right:-100%;clear:none}.content_page_template .grid_gallery.grid_view .slide:nth-child(4n+3){margin-left:50.42017%;margin-right:-100%;clear:none}.content_page_template .grid_gallery.grid_view .slide:nth-child(4n+4){margin-left:75.63025%;margin-right:-100%;clear:none}}.grid_gallery.list_view .list_image{float:right;margin-left:4%;margin-bottom:.5em;width:32%}@media (min-width: 600px), print{.grid_gallery.list_view .list_image{margin-left:0;margin-bottom:0;width:23.07692%;float:left;margin-right:2.5641%}}@media (min-width: 769px), print{.grid_gallery.list_view .list_image{width:23.72881%;float:left;margin-right:1.69492%}}@media (min-width: 1024px), print{.grid_gallery.list_view .list_image{width:23.72881%;float:left;margin-right:1.69492%}}.grid_gallery.list_view .list_text{width:auto}@media (min-width: 600px), print{.grid_gallery.list_view .list_text{width:74.35897%;float:right;margin-right:0}}@media (min-width: 769px), print{.grid_gallery.list_view .list_text{width:74.57627%;float:right;margin-right:0}}@media (min-width: 1024px), print{.grid_gallery.list_view .list_text{width:66.10169%;float:left;margin-right:1.69492%}}.grid_gallery.list_view .content_title a{text-decoration:none;cursor:pointer;color:#222}.grid_gallery.list_view .content_title a:hover{text-decoration:underline}.grid_gallery.list_view .content_title{display:block;font-size:1.17em;margin-bottom:.1em;margin-bottom:.2em;font-weight:700;color:#222;letter-spacing:-.035em}@media (min-width: 600px), print{.grid_gallery.list_view .content_title{font-size:1.35em;margin-bottom:.18em}}@media (min-width: 769px), print{.grid_gallery.list_view .content_title{font-size:1.53em;margin-bottom:.26em}}@media (min-width: 1024px), print{.grid_gallery.list_view .content_title{font-size:1.62em;margin-bottom:.29em}}@media (min-width: 1200px){.grid_gallery.list_view .content_title{font-size:1.71em;margin-bottom:.32em}}.grid_gallery.list_view .bottom_gradient{display:none}@media (min-width: 1024px), print{.grid_gallery.list_view .article_teaser_body{font-size:1.1em}}.grid_gallery.list_view li.slide:first-child{border-top:1px solid #CCC}.grid_gallery.list_view li.slide{border-bottom:1px solid #CCC;padding:1.2em 0}.grid_gallery.list_view li.slide a{text-decoration:none;cursor:pointer}.view_selectors{position:relative;margin:0 auto;text-align:center;width:106px;text-align:right}@media (min-width: 769px), print{.view_selectors{position:absolute;right:0;top:0;height:100%}}.view_selectors .nav_item{display:inline-block;position:relative;background-repeat:no-repeat;width:50px;height:50px;cursor:pointer;background-image:url(\"https://mars.nasa.gov/assets/[email protected]\");background-size:125px;background-color:#eef2f6;border-radius:50%;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none}.view_selectors .nav_item.list_icon{background-position:-12px -62px}.no-touchevents .view_selectors .nav_item.list_icon:hover{background-position:-12px -12px}.list_view .view_selectors .nav_item.list_icon{background-position:-12px -12px}.view_selectors .nav_item.grid_icon{background-position:-62px -62px}.no-touchevents .view_selectors .nav_item.grid_icon:hover{background-position:-62px -12px}.grid_view .view_selectors .nav_item.grid_icon{background-position:-62px -12px}.grid_gallery#more_section .module_title{text-align:center;width:100%}.grid_gallery#more_section li.slide{margin-bottom:1.69492%;width:49.15254%;float:left}.grid_gallery#more_section li.slide:nth-child(2n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.grid_gallery#more_section li.slide:nth-child(2n+2){margin-left:50.84746%;margin-right:-100%;clear:none}@media (min-width: 1200px){.grid_gallery#more_section li.slide{width:32.20339%;float:left}.grid_gallery#more_section li.slide:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.grid_gallery#more_section li.slide:nth-child(3n+2){margin-left:33.89831%;margin-right:-100%;clear:none}.grid_gallery#more_section li.slide:nth-child(3n+3){margin-left:67.79661%;margin-right:-100%;clear:none}}.grid_gallery#more_section li.slide .image_and_description_container{position:relative}.grid_gallery#more_section li.slide a.slide_title{padding-top:.6em;display:block;color:#222;font-weight:400}.grid_gallery#more_section li.slide:hover a.slide_title{color:#366599}.special_list .event_list_by_location .date_section:first-child .date_title{border-top:1px solid #ccc}.special_list .event_list_by_location .date_section:last-child .country_section:last-child ul.item_list.list_view li.slide:last-child{border-bottom:0}.special_list .event_list_by_location .date_section .date_title{font-weight:bold;font-size:1.3em;margin:1em 0;padding-top:1em}.special_list .event_list_by_location .date_section .country_section{margin-top:1em}.special_list .event_list_by_location .date_section .country_section .country_title{font-size:1.7em;font-weight:400}.special_list .event_list_by_location .date_section .country_section ul.item_list.list_view{margin-bottom:0}.special_list .event_list_by_location .date_section .country_section ul.item_list.list_view .list_title,.special_list .event_list_by_location .date_section .country_section ul.item_list.list_view p span{font-weight:700}.special_list .event_list_by_location .date_section .country_section ul.item_list.list_view a.list_link{font-weight:500}@media (min-width: 600px), print{.special_list .event_list_by_location .date_section .country_section ul.item_list.list_view .list_text.no_float{float:none}}.special_list .event_list_by_location .date_section .country_section ul.item_list.list_view li.slide:first-child{border-top:0}.special_list .event_list_by_location .category{background-color:#DDD;width:auto;display:inline-block;padding:.1em .3em;margin-bottom:.6em;font-weight:700;background-color:#DCEDF3;color:#1F414B;padding:.1em .5em}.special_list .event_list_by_location .date{margin-bottom:.5em}.wysiwyg_content ul,ol{margin-left:1.6em}.feature_pages .wysiwyg_content ol,.feature_pages .wysiwyg_content ul{list-style-position:inside}#secondary_column ul,ol{margin-left:1.2em}.wysiwyg_content ul,#secondary_column ul{margin-left:1.6em;list-style-type:disc;list-style-position:outside}.wysiwyg_content ul ul,#secondary_column ul ul{list-style-type:circle;margin-left:1.6em;margin-top:.5em}.wysiwyg_content ul ul ul,#secondary_column ul ul ul{list-style-type:square;margin-left:1.6em;margin-top:.5em}.wysiwyg_content ul ul ul ul,#secondary_column ul ul ul ul{list-style-type:disc;margin-left:1.6em;margin-top:.5em}.wysiwyg_content ol,#secondary_column ol{margin-left:1.6em;list-style-type:decimal;list-style-position:outside}.wysiwyg_content ol ol,#secondary_column ol ol{list-style-type:decimal;margin-left:1.6em;margin-top:.5em}.wysiwyg_content ol ol ol,#secondary_column ol ol ol{list-style-type:decimal;margin-left:1.6em;margin-top:.5em}.wysiwyg_content ol ol ol ol,#secondary_column ol ol ol ol{list-style-type:decimal;margin-left:1.6em;margin-top:.5em}.wysiwyg_content ol,.wysiwyg_content ul,#secondary_column ol,#secondary_column ul{margin-bottom:2em}.wysiwyg_content ol:last-child,.wysiwyg_content ul:last-child,#secondary_column ol:last-child,#secondary_column ul:last-child{margin-bottom:0}.wysiwyg_content ol li,.wysiwyg_content ul li,#secondary_column ol li,#secondary_column ul li{margin-bottom:.5em}.wysiwyg_content .item_list_module,.wysiwyg_content .item_list,.wysiwyg_content .list_sublist,.wysiwyg_content .footnotes ul,.wysiwyg_content .sidebar_gallery,.wysiwyg_content .related_items,.wysiwyg_content .sitemap_directory ul,.wysiwyg_content .list_view_module ul,.wysiwyg_content .faq_topics ul,.wysiwyg_content .item_grid,.wysiwyg_content .related_content_module ul,.wysiwyg_content .sig_events_module ul,.wysiwyg_content ul.detailed_def_nav,#secondary_column .item_list_module,#secondary_column .item_list,#secondary_column .list_sublist,#secondary_column .footnotes ul,#secondary_column .sidebar_gallery,#secondary_column .related_items,#secondary_column .sitemap_directory ul,#secondary_column .list_view_module ul,#secondary_column .faq_topics ul,#secondary_column .item_grid,#secondary_column .related_content_module ul,#secondary_column .sig_events_module ul,#secondary_column ul.detailed_def_nav{margin-left:0;list-style-type:none;list-style-position:inside}.wysiwyg_content .item_list_module li,.wysiwyg_content .item_list li,.wysiwyg_content .list_sublist li,.wysiwyg_content .footnotes ul li,.wysiwyg_content .sidebar_gallery li,.wysiwyg_content .related_items li,.wysiwyg_content .sitemap_directory ul li,.wysiwyg_content .list_view_module ul li,.wysiwyg_content .faq_topics ul li,.wysiwyg_content .item_grid li,.wysiwyg_content .related_content_module ul li,.wysiwyg_content .sig_events_module ul li,.wysiwyg_content ul.detailed_def_nav li,#secondary_column .item_list_module li,#secondary_column .item_list li,#secondary_column .list_sublist li,#secondary_column .footnotes ul li,#secondary_column .sidebar_gallery li,#secondary_column .related_items li,#secondary_column .sitemap_directory ul li,#secondary_column .list_view_module ul li,#secondary_column .faq_topics ul li,#secondary_column .item_grid li,#secondary_column .related_content_module ul li,#secondary_column .sig_events_module ul li,#secondary_column ul.detailed_def_nav li{margin-bottom:0}.wysiwyg_content .faq_topics ul li a,#secondary_column .faq_topics ul li a{font-weight:500;line-height:1.8em}.module header{margin-bottom:1em;position:relative}.module footer{text-align:center;position:relative}.module footer a.detail_link{text-transform:uppercase;font-weight:400}a.detail_link:not(.msl .module footer){font-size:.9em}.module .module_title{font-weight:300;color:#6d3007}.wysiwyg_content>.module:first-child{padding-top:0}.insight_page .module .module_title{color:#000}.multimedia_teaser{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none;overflow:hidden}#secondary_column aside .multimedia_teaser{position:relative}#secondary_column aside .multimedia_teaser .text{position:absolute;width:100%;text-align:center;padding:0 1.4em 2em;bottom:0}#secondary_column aside .multimedia_teaser .text .category_title,#secondary_column aside .multimedia_teaser .text .media_feature_title{color:white}.multimedia_teaser{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none;overflow:hidden}.multimedia_teaser .util-carousel{margin-bottom:2em;width:190%}@media (min-width: 480px){.multimedia_teaser .util-carousel{width:90%}}@media (min-width: 769px), print{.multimedia_teaser .util-carousel{margin-bottom:3em}}.suggested_features.module{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none;background-color:#eef2f6}.related.module{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none;padding-top:1em}.related.module .module_title{text-align:left;font-size:2em}.related.module .gradient_line_module_top{margin:0 0 2em}.carousel_teaser.related .module_title{text-align:center}@media (min-width: 600px), print{.carousel_teaser.related .module_title{text-align:left;width:88%;margin-left:auto;margin-right:auto}}@media (min-width: 769px), print{.carousel_teaser.related .module_title{width:88.5%}}@media (min-width: 1024px), print{.carousel_teaser.related .module_title{width:89%}}section.site_teaser .img_col{width:100%;margin-bottom:1.5em}@media (min-width: 600px), print{section.site_teaser .img_col{width:40.78947%;float:left;margin-right:5.26316%;margin-bottom:0}}section.site_teaser .text_col{width:100%}@media (min-width: 600px), print{section.site_teaser .text_col{width:53.94737%;float:left;margin-right:5.26316%;float:right;margin-right:0}}section.site_teaser .text_col .category_title{font-size:0.9em}section.site_teaser .text_col p{margin:1em 0 1.7em}section.site_teaser .site_teaser_caption{margin:.5em 1em 0 0;text-align:right;font-size:.8em}section.site_teaser footer{text-align:center}@media (min-width: 600px), print{section.site_teaser footer{text-align:left}}section.site_teaser .button{padding:0.8em 1.2em}section.more_bar{text-align:center;background-color:#4d91a6;color:black;height:36px;cursor:pointer;position:relative}section.more_bar .title,section.more_bar .arrow_down{display:inline-block;vertical-align:middle;margin-top:6px}section.more_bar .arrow_down{padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -50px -125px;background-size:300px}section.more_bar .arrow_down:hover,section.more_bar .arrow_down.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -50px -125px;background-size:300px}.insight_page section.more_bar{color:#7BBBFF;background-color:#2F6197;font-weight:500}.insight_page section.more_bar .arrow_down{background:none}.insight_page section.more_bar .icon{display:inline-block;width:11px;height:11px;border-radius:50%;vertical-align:middle}.insight_page section.more_bar .icon svg{width:100%;height:100%;fill:#7BBBFF;display:block}.latest_update_module .latest_update_header{display:none}.content_page .latest_update_module{margin:1rem 0}.content_page .latest_update_module .latest_update_header{display:block}.content_page .latest_update_module .latest_update_header h2{margin:1.5rem 0 1rem}.content_page .latest_update_module .latest_update_header h4.subhead{margin:0;font-size:1.3rem}.content_page .latest_update_module .list_text .list_title,.content_page .latest_update_module .list_text .desc_title{display:none}.content_page .latest_update_module .list_image{width:41%;float:right;margin:0 0 0.9rem 1.2rem}@media (min-width: 600px), print{.content_page .latest_update_module .list_image{width:27%}}.content_page .latest_update_module .list_text{float:none;width:auto}.content_page .latest_update_module .description p:first-of-type{margin-top:0}.content_page .latest_update_module ul.item_list{margin-bottom:0}.content_page .latest_update_module ul.item_list li:last-child{margin-bottom:0}.content_page .latest_update_module ul.item_list li:first-child .list_content{padding:0}.content_page .latest_update_module .latest_article_link{margin-top:0}.inline_dashboard_item{display:inline}.inline_dashboard_item div{display:inline-block}.my_map_container{width:100%}.my_map_container iframe{width:100%}.content_page_template .featured_map.module{padding:0;margin:3em 0}.featured_map .featured_map_title{margin:.8rem 0 0}.openseadragon{background-color:black}.openseadragon div[title^='Zoom'],.openseadragon div[title^='Go'],.openseadragon div[title^='Toggle']{margin:6px 0 0 6px !important;cursor:pointer}.feature_pages .deep_zoom_module{width:94%;max-width:100%;margin:3em auto;float:none}@media (min-width: 600px), print{.feature_pages .deep_zoom_module{max-width:600px}}.feature_pages .deep_zoom_module.full-bleed,.feature_pages .deep_zoom_module.full_width,.feature_pages .deep_zoom_module.wide,.feature_pages .deep_zoom_module.parallax{clear:both}@media (min-width: 600px), print{.feature_pages .deep_zoom_module.full-bleed,.feature_pages .deep_zoom_module.full_width,.feature_pages .deep_zoom_module.wide,.feature_pages .deep_zoom_module.parallax{margin-top:5em;margin-bottom:5em}}.feature_pages .deep_zoom_module.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.feature_pages .deep_zoom_module.column-width{max-width:600px}}.feature_pages .deep_zoom_module.full-bleed{width:100%;max-width:none}.feature_pages .deep_zoom_module.full-bleed figcaption{margin:.8em .8em 0 .8em}.feature_pages .deep_zoom_module.full_width{clear:both}@media (min-width: 769px), print{.feature_pages .deep_zoom_module.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.feature_pages .deep_zoom_module.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.feature_pages .deep_zoom_module.full_width{width:55%}}.feature_pages .deep_zoom_module.wide{width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .deep_zoom_module.wide{width:95%}}@media (min-width: 769px), print{.feature_pages .deep_zoom_module.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .deep_zoom_module.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .deep_zoom_module.column-width{max-width:calc(600px + 15%)}}.feature_pages .deep_zoom_module.left,.feature_pages .deep_zoom_module.right{max-width:94%}@media (min-width: 600px), print{.feature_pages .deep_zoom_module.left,.feature_pages .deep_zoom_module.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.feature_pages .deep_zoom_module.left,.feature_pages .deep_zoom_module.right{width:27%;max-width:27%}}@media (min-width: 1700px){.feature_pages .deep_zoom_module.left,.feature_pages .deep_zoom_module.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.feature_pages .deep_zoom_module.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.feature_pages .deep_zoom_module.left{margin-left:15%}}@media (min-width: 1700px){.feature_pages .deep_zoom_module.left{margin-left:20%}}@media (min-width: 480px){.feature_pages .deep_zoom_module.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.feature_pages .deep_zoom_module.right{margin-right:15%}}@media (min-width: 1700px){.feature_pages .deep_zoom_module.right{margin-right:20%}}.feature_pages .deep_zoom_module.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.feature_pages .deep_zoom_module.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.feature_pages .deep_zoom_module.parallax_module .caption{font-size:.88em}}.feature_pages .deep_zoom_module.parallax_module img{height:auto !important}.feature_pages .deep_zoom_module.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.feature_pages .deep_zoom_module.parallax_module .window.mobile{height:auto;min-height:100%}.feature_pages .deep_zoom_module.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.feature_pages .deep_zoom_module.parallax_module .window .featured_image{position:absolute}}.deep_zoom_module .deepzoom_caption{margin-top:.8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.deep_zoom_module .deepzoom_caption{font-size:.88em}}.content_page .deep_zoom_module{margin-bottom:2em}.megasection_nav_present.msl section.more_bar{background-color:#e34e41}.megasection_nav_present.msl section.more_bar .title{font-weight:500}.megasection_nav_present.msl section.more_bar .arrow_down .icon.svg_icon_container{width:10px}.megasection_nav_present.msl section.suggested_features{background:#FFF6F5}.megasection_nav_present.msl section.suggested_features h1.module_title{font-weight:500}.megasection_nav_present.msl section.suggested_features button{background-color:#e34e41}.megasection_nav_present.msl section.suggested_features button:hover{background-color:rgba(227,78,65,0.7)}.homepage_carousel .floating_text_area{width:100%;padding:1.4em;bottom:120px;text-align:center;margin-left:auto;margin-right:auto;color:white;background-color:rgba(0,0,0,0.4)}@media (min-width: 769px), print{.homepage_carousel .floating_text_area{bottom:calc(125px + 3em);background-color:transparent}}@media only screen and (max-height: 600px) and (orientation: landscape){.homepage_carousel .floating_text_area{padding:.9em;bottom:111px}}.homepage_carousel .floating_text_area .description{display:block;max-height:130px;overflow-y:auto;padding:0 1.4em;color:#ffffff;font-weight:300}.homepage_carousel .floating_text_area .description a{font-weight:500;color:#69B9FF}.homepage_carousel .floating_text_area .description a.multi_links{display:block}@media (max-height: 600px) and (max-width: 769px) and (orientation: landscape){.homepage_carousel .floating_text_area .description a.multi_links{display:inline-block}.homepage_carousel .floating_text_area .description a.multi_links+.multi_links{margin-left:0.9rem}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area .description{display:block;line-height:1.4em;padding:0;max-height:none;overflow:hidden}}.no-touchevents .homepage_carousel .floating_text_area .description{display:none}@media (min-width: 769px), print{.no-touchevents .homepage_carousel .floating_text_area .description{display:block !important}}.homepage_carousel .floating_text_area .description .detail_link{display:inline-block;color:#69B9FF;text-transform:none}.homepage_carousel .floating_text_area .description .detail_link:hover{text-decoration:none;color:#ffffff}@media (min-width: 769px), print{.homepage_carousel .floating_text_area .description .detail_link{display:none}}.homepage_carousel .floating_text_area footer{margin:0}@media (min-width: 769px), print{.homepage_carousel .floating_text_area footer{margin:1.6em 0 0}}.homepage_carousel .floating_text_area .category_title{margin-top:0}.homepage_carousel .floating_text_area .media_feature_title{color:white;margin-top:0;margin-bottom:.4em;font-size:1.6em;width:70%;margin-left:auto;margin-right:auto;position:relative;font-weight:400}.homepage_carousel .floating_text_area .media_feature_title a{color:white;text-decoration:none}@media (min-width: 600px), print{.homepage_carousel .floating_text_area .media_feature_title{font-size:2em;width:80%}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area .media_feature_title{font-size:1.5em;margin-bottom:.4em;width:100%}}@media (min-width: 1024px), print{.homepage_carousel .floating_text_area .media_feature_title{font-size:1.6em}}@media (min-width: 1200px){.homepage_carousel .floating_text_area .media_feature_title{font-size:1.8em}}@media (min-width: 1700px){.homepage_carousel .floating_text_area .media_feature_title{font-size:1.9em}}.homepage_carousel .floating_text_area .media_feature_title span.arrow{background:url(\"https://mars.nasa.gov/assets/[email protected]\") center no-repeat;position:absolute;right:-25%;margin-top:-0.2em;background-size:12px;height:44px;width:44px;bottom:-9px}@media (min-width: 600px), print{.homepage_carousel .floating_text_area .media_feature_title span.arrow{margin-top:0;right:-10%}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area .media_feature_title span.arrow{display:none}}@media (orientation: landscape){.homepage_carousel .floating_text_area .media_feature_title span.arrow{display:none}}.homepage_carousel .floating_text_area .button,.homepage_carousel .floating_text_area .button:hover{display:none;text-transform:none;font-size:16px;font-weight:400;border-radius:3px;padding:9px 16px}@media (min-width: 769px), print{.homepage_carousel .floating_text_area .button,.homepage_carousel .floating_text_area .button:hover{display:inline-block !important;color:white !important}}.no-touchevents .homepage_carousel .floating_text_area .button{transition:background 300ms}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.expandable .media_feature_title{font-size:1.5em}}@media (min-width: 1024px), print{.homepage_carousel .floating_text_area.expandable .media_feature_title{font-size:1.7em}}@media (min-width: 1200px){.homepage_carousel .floating_text_area.expandable .media_feature_title{font-size:2.0em}}@media (min-width: 1700px){.homepage_carousel .floating_text_area.expandable .media_feature_title{font-size:2.2em}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area{text-align:left;padding:1.4em;margin:0}.homepage_carousel .floating_text_area.box,.homepage_carousel .floating_text_area.no-box{position:absolute;width:400px}}@media (min-width: 769px) and (min-width: 1024px), print and (min-width: 1024px), print and (min-width: 769px), print{.homepage_carousel .floating_text_area.box,.homepage_carousel .floating_text_area.no-box{width:480px}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.homepage_carousel .floating_text_area.box,.homepage_carousel .floating_text_area.no-box{width:530px}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.box.left,.homepage_carousel .floating_text_area.no-box.left{left:8%}}@media (min-width: 769px) and (min-width: 1700px), print and (min-width: 1700px){.homepage_carousel .floating_text_area.box.left,.homepage_carousel .floating_text_area.no-box.left{left:4%}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.box.right,.homepage_carousel .floating_text_area.no-box.right{right:8%}}@media (min-width: 769px) and (min-width: 1700px), print and (min-width: 1700px){.homepage_carousel .floating_text_area.box.right,.homepage_carousel .floating_text_area.no-box.right{right:4%}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.box{background-color:rgba(0,0,0,0.6)}.homepage_carousel .floating_text_area.no-box .media_feature_title{font-size:2.7em;font-weight:400}.homepage_carousel .floating_text_area.no-box .description{font-size:1.5em}.homepage_carousel .floating_text_area.centered{bottom:calc(58px + 3em);text-align:center;left:0;right:0;margin:auto;width:98%;max-width:900px}.homepage_carousel .floating_text_area.centered .media_feature_title{font-size:2.5em;font-weight:500}}@media (min-width: 769px) and (min-width: 600px), print and (min-width: 600px), print and (min-width: 769px), print{.homepage_carousel .floating_text_area.centered .media_feature_title{font-size:2.9em}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.expandable,.homepage_carousel .floating_text_area.expandable_light{transition:background-color .5s ease-out;width:40%;top:auto}.homepage_carousel .floating_text_area.expandable footer,.homepage_carousel .floating_text_area.expandable_light footer{margin-bottom:1em}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.homepage_carousel .floating_text_area.expandable,.homepage_carousel .floating_text_area.expandable_light{width:415px}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.homepage_carousel .floating_text_area.expandable,.homepage_carousel .floating_text_area.expandable_light{width:480px}}@media (min-width: 769px) and (min-width: 1700px), print and (min-width: 1700px){.homepage_carousel .floating_text_area.expandable,.homepage_carousel .floating_text_area.expandable_light{width:600px}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.expandable.left,.homepage_carousel .floating_text_area.expandable_light.left{left:8%}}@media (min-width: 769px) and (min-width: 1700px), print and (min-width: 1700px){.homepage_carousel .floating_text_area.expandable.left,.homepage_carousel .floating_text_area.expandable_light.left{left:4%}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.expandable.right,.homepage_carousel .floating_text_area.expandable_light.right{right:8%}}@media (min-width: 769px) and (min-width: 1700px), print and (min-width: 1700px){.homepage_carousel .floating_text_area.expandable.right,.homepage_carousel .floating_text_area.expandable_light.right{right:4%}}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.expandable .description,.homepage_carousel .floating_text_area.expandable_light .description{max-height:0;overflow:hidden;transition:all .7s}.homepage_carousel .floating_text_area.expandable .media_feature_title:after,.homepage_carousel .floating_text_area.expandable_light .media_feature_title:after{content:url(\"https://mars.nasa.gov/assets/arrow_down_prompt.png\");transition:opacity .25s;position:relative;top:-4px;left:10px;opacity:1}.homepage_carousel .floating_text_area.expandable .media_feature_title span.arrow,.homepage_carousel .floating_text_area.expandable_light .media_feature_title span.arrow{display:none}.homepage_carousel .floating_text_area.expandable:hover:before,.homepage_carousel .floating_text_area.expandable_light:hover:before{opacity:0}.homepage_carousel .floating_text_area.expandable:hover .description,.homepage_carousel .floating_text_area.expandable_light:hover .description{max-height:400px}.homepage_carousel .floating_text_area.expandable:hover .media_feature_title:after,.homepage_carousel .floating_text_area.expandable_light:hover .media_feature_title:after{opacity:0}.homepage_carousel .floating_text_area.expandable{background-color:rgba(0,0,0,0.6)}.homepage_carousel .floating_text_area.expandable_light{background-color:rgba(255,255,255,0.9)}.homepage_carousel .floating_text_area.expandable_light .media_feature_title,.homepage_carousel .floating_text_area.expandable_light .description{color:#452520}.homepage_carousel .floating_text_area.expandable_light .category_title{color:#d63e1c}.homepage_carousel .floating_text_area.expandable_light .media_feature_title:after{content:url(\"https://mars.nasa.gov/assets/arrow_down_light.png\")}}.homepage_carousel .floating_text_area.open span.arrow{transform:rotate(180deg)}@media (min-width: 769px), print{.homepage_carousel .floating_text_area.open .description{display:block}}.primary_media_feature .floating_text_area{bottom:2em}.banner_header_overlay{bottom:1em}.primary_media_feature .floating_text_area,.banner_header_overlay{position:absolute;z-index:12;color:white;width:100%;text-align:center;padding:0 1%}.primary_media_feature .floating_text_area .category_title,.banner_header_overlay .category_title,.banner_header_overlay .homepage_carousel .floating_text_area .category_title,.homepage_carousel .floating_text_area .banner_header_overlay .category_title{color:white;margin-bottom:0.7em;margin-top:0}.primary_media_feature .floating_text_area .description,.banner_header_overlay .description{margin:-.5em auto 1em}@media (min-width: 769px), print{.primary_media_feature .floating_text_area .description,.banner_header_overlay .description{width:500px;margin-bottom:1.5em}}@media (min-width: 1024px), print{.primary_media_feature .floating_text_area .description,.banner_header_overlay .description{width:550px}}.primary_media_feature .floating_text_area .media_feature_title,.banner_header_overlay .media_feature_title{color:white;margin-bottom:.4em;font-size:1.93em}@media (min-width: 600px), print{.primary_media_feature .floating_text_area .media_feature_title,.banner_header_overlay .media_feature_title{font-size:2.8em}}.primary_media_feature .floating_text_area .media_feature_title a,.banner_header_overlay .media_feature_title a{color:white;text-decoration:none}.custom_banner_container{height:190px;width:100%;background-size:cover;background-position:center}@media only screen and (orientation: landscape){.custom_banner_container{height:260px}}@media (min-width: 600px), print{.custom_banner_container{height:420px}}@media only screen and (min-width: 600px) and (orientation: landscape){.custom_banner_container{height:350px}}@media (min-width: 769px), print{.custom_banner_container{height:400px}}@media only screen and (min-width: 769px) and (orientation: landscape){.custom_banner_container{height:400px}}@media (min-width: 1024px), print{.custom_banner_container{height:440px}}@media (min-width: 1200px){.custom_banner_container{height:550px}}@media (min-width: 1700px){.custom_banner_container{height:660px}}.custom_banner_container .banner_header_overlay{position:absolute;width:100%;bottom:0;z-index:2}.custom_banner_container .article_title{margin-bottom:.5em;text-align:center;color:#FFF}.custom_banner_container .secondary_nav_mobile{display:block}.custom_banner_container .secondary_nav_mobile select{position:relative;padding:.5em 2em .5em 1em;font-size:16px;border:0;height:40px;vertical-align:middle;color:white;-webkit-appearance:none;-o-appearance:none;-moz-appearance:none;background:#3b788b url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat 95% 10px;background-position:right .8em top 10px;background-size:9px;font-weight:700;cursor:pointer;width:100%;border-radius:5px;max-width:304px;margin:.3em 0 2em}.custom_banner_container .secondary_nav_mobile select::-ms-expand{display:none}.custom_banner_container .secondary_nav_mobile select option{padding:0.5em 1em}@media (min-width: 769px), print{.custom_banner_container .secondary_nav_mobile{display:none}}.custom_banner_container .secondary_nav_desktop{display:none;margin:0 0 .8em 0;text-align:center}@media (min-width: 769px), print{.custom_banner_container .secondary_nav_desktop{display:block}}.custom_banner_container .secondary_nav_desktop li{display:inline-block;position:relative}.custom_banner_container .secondary_nav_desktop a{color:#5AA1F5;font-size:1.2em;font-weight:700;display:block;padding:.3em .9em .3em 0}@media (min-width: 1700px){.custom_banner_container .secondary_nav_desktop a{font-size:1.3em}}.custom_banner_container .secondary_nav_desktop li.current a,.custom_banner_container .secondary_nav_desktop li:hover a{text-decoration:none;color:white}.megasection_nav_present nav.secondary_nav.secondary_nav_mobile{visibility:hidden}.homepage_carousel .master-slider .ms-slide-bgvideocont{transform:none !important}#masterslider{height:480px;width:100%}@media only screen and (orientation: landscape){#masterslider{height:260px}}@media (min-width: 600px), print{#masterslider{height:500px}}@media only screen and (min-width: 600px) and (orientation: landscape){#masterslider{height:350px}}@media (min-width: 769px), print{#masterslider{height:500px}}@media only screen and (min-width: 769px) and (orientation: landscape){#masterslider{height:500px}}@media (min-width: 1024px), print{#masterslider{height:640px}}@media (min-width: 1200px){#masterslider{height:780px}}@media (min-width: 1700px){#masterslider{height:800px}}#masterslider .ms-slide-bgvideocont{background-color:#000}#masterslider .ms-slide-bgvideocont video{max-width:none}#masterslider .ms-nav-next,#masterslider .ms-nav-prev{display:none}@media (min-width: 769px), print{#masterslider .ms-nav-next,#masterslider .ms-nav-prev{display:block}}#masterslider .ms-nav-prev,#masterslider .ms-nav-next{width:40px;height:80px;margin-top:-60px}@media (min-width: 769px), print{#masterslider .ms-nav-prev,#masterslider .ms-nav-next{margin-top:-80px}}#masterslider .ms-nav-prev{background:url(\"https://mars.nasa.gov/assets/arrow_left_slim.png\");background-size:40px 103px;background-position:0;left:15px;border-top-right-radius:6px;border-bottom-right-radius:6px}#masterslider .ms-nav-next{background:url(\"https://mars.nasa.gov/assets/arrow_right_slim.png\");background-size:40px 103px;background-position:0;right:15px;border-top-left-radius:6px;border-bottom-left-radius:6px}#masterslider .ms-bullets{left:0;right:0;margin:0 auto;bottom:104px;z-index:10}@media (min-width: 769px), print{#masterslider .ms-bullets{bottom:123px}}@media only screen and (max-height: 600px) and (orientation: landscape){#masterslider .ms-bullets{bottom:100px}}.subsite_content_page #masterslider .ms-bullets{bottom:99px}@media (min-width: 769px), print{.subsite_content_page #masterslider .ms-bullets{bottom:108px}}@media only screen and (max-height: 600px) and (orientation: landscape){.subsite_content_page #masterslider .ms-bullets{bottom:90px}}#masterslider .ms-bullet{background-color:white;background-image:none;border-radius:50% 50% 50% 50%;height:8px;width:8px;opacity:0.5;margin:0 10px}#masterslider .ms-bullet:hover{opacity:1.0}#masterslider .ms-bullet-selected{opacity:1.0}.wysiwyg_content section.jpl_carousel{margin-bottom:3rem}.wysiwyg_content section.jpl_carousel .image_carousel_caption{position:relative}.wysiwyg_content section.jpl_carousel .master-slider{width:100%;height:300px}@media (min-width: 600px), print{.wysiwyg_content section.jpl_carousel .master-slider{height:394px}}@media (min-width: 769px), print{.wysiwyg_content section.jpl_carousel .master-slider{height:534px}}.feature_pages .wysiwyg_content section.jpl_carousel{max-width:600px;width:94%}@media (min-width: 769px), print{.feature_pages .wysiwyg_content section.jpl_carousel{max-width:calc(600px + 15%)}}.wysiwyg_content section.jpl_carousel .slider_title{margin-top:0.4rem;font-weight:700}.wysiwyg_content section.jpl_carousel .slider_caption{color:#5a6470;font-size:0.8em;height:auto;line-height:1.4em}.wysiwyg_content section.jpl_carousel .slider_link{margin-left:.4rem;font-size:.85em}.wysiwyg_content section.jpl_carousel .ms-nav-next,.wysiwyg_content section.jpl_carousel .ms-nav-prev{display:none}.wysiwyg_content section.jpl_carousel.medium_mid .ms-nav-next,.wysiwyg_content section.jpl_carousel.medium_mid .ms-nav-prev,.wysiwyg_content section.jpl_carousel.medium_large .ms-nav-next,.wysiwyg_content section.jpl_carousel.medium_large .ms-nav-prev,.wysiwyg_content section.jpl_carousel.large .ms-nav-next,.wysiwyg_content section.jpl_carousel.large .ms-nav-prev,.wysiwyg_content section.jpl_carousel.xlarge .ms-nav-next,.wysiwyg_content section.jpl_carousel.xlarge .ms-nav-prev,.wysiwyg_content section.jpl_carousel.xxlarge .ms-nav-next,.wysiwyg_content section.jpl_carousel.xxlarge .ms-nav-prev{display:block}.no-touchevents .wysiwyg_content section.jpl_carousel.medium .ms-nav-next,.no-touchevents .wysiwyg_content section.jpl_carousel.medium .ms-nav-prev,.no-touchevents .wysiwyg_content section.jpl_carousel.small .ms-nav-next,.no-touchevents .wysiwyg_content section.jpl_carousel.small .ms-nav-prev{display:block}.wysiwyg_content section.jpl_carousel .ms-nav-prev,.wysiwyg_content section.jpl_carousel .ms-nav-next{width:40px;height:80px;margin-top:-60px}.wysiwyg_content section.jpl_carousel.medium_large .ms-nav-next,.wysiwyg_content section.jpl_carousel.medium_large .ms-nav-prev,.wysiwyg_content section.jpl_carousel.large .ms-nav-next,.wysiwyg_content section.jpl_carousel.large .ms-nav-prev,.wysiwyg_content section.jpl_carousel.xlarge .ms-nav-next,.wysiwyg_content section.jpl_carousel.xlarge .ms-nav-prev,.wysiwyg_content section.jpl_carousel.xxlarge .ms-nav-next,.wysiwyg_content section.jpl_carousel.xxlarge .ms-nav-prev{margin-top:-80px}.wysiwyg_content section.jpl_carousel .ms-nav-prev{background:url(\"https://mars.nasa.gov/assets/arrow_left_slim.png\");background-size:40px 95px;background-color:transparent;background-position:0;left:0;border-top-right-radius:6px;border-bottom-right-radius:6px}.wysiwyg_content section.jpl_carousel .ms-nav-next{background:url(\"https://mars.nasa.gov/assets/arrow_right_slim.png\");background-size:40px 95px;background-color:transparent;background-position:0;right:0;border-top-left-radius:6px;border-bottom-left-radius:6px}.wysiwyg_content section.jpl_carousel .x_of_y{position:absolute;top:-48px;left:0;right:0;margin:auto;padding:2px;background-color:#e7dfdd;background-color:rgba(231,223,221,0.8);width:60px;border-radius:20px;text-align:center}.slick-slider .slick-prev,.slick-slider .slick-next{width:30px;height:48px}.slick-slider .slick-prev:before,.slick-slider .slick-next:before{content:'';display:inline-block;padding:0;cursor:pointer;width:17px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -30px -100px;background-size:300px;opacity:1}.slick-slider .slick-prev:before:hover,.slick-slider .slick-prev:before.active,.slick-slider .slick-next:before:hover,.slick-slider .slick-next:before.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -30px -100px;background-size:300px}.slick-slider .slick-prev:not(.slick-disabled):hover:before,.slick-slider .slick-next:not(.slick-disabled):hover:before{opacity:1}.slick-slider .slick-next:before{content:'';display:inline-block;padding:0;cursor:pointer;width:17px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -30px -150px;background-size:300px}.slick-slider .slick-next:before:hover,.slick-slider .slick-next:before.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -30px -150px;background-size:300px}.slick-slider .slick-prev{left:-33px}.slick-slider .slick-next{right:-33px}.slick-slider .slick-disabled{cursor:default;opacity:.4}.slick-slider .slick-disabled:before{cursor:default}.main_carousel .slick-nav_container{width:100%;text-align:center;padding-top:1em;border-top:1px solid #BEBEBE}@media (min-width: 600px), print{.main_carousel .slick-nav_container{border:none;margin-top:1em}}.main_carousel .slick-dots{position:relative;top:0}.main_carousel .slick-dots li{vertical-align:top}.main_carousel .slick-dots li button:before{content:\"\";border-radius:50%;background-color:black;height:8px;width:8px;top:6px;left:5px;text-align:center}.main_carousel .slick-nav{position:relative;display:inline-block}.main_carousel .slick-prev,.main_carousel .slick-next{top:-4px}.suggested_features .slick-prev,.suggested_features .slick-next{top:38%}.suggested_features .slick-prev{left:-9%}@media (min-width: 600px), print{.suggested_features .slick-prev{left:-7%}}@media (min-width: 769px), print{.suggested_features .slick-prev{left:-6%}}.suggested_features .slick-next{right:-9%}@media (min-width: 600px), print{.suggested_features .slick-next{right:-7%}}@media (min-width: 769px), print{.suggested_features .slick-next{right:-6%}}.lightbox_carousel_module .slick-prev,.lightbox_carousel_module .slick-next{top:33%}.lightbox_carousel_module .slick-prev{left:-9%}@media (min-width: 600px), print{.lightbox_carousel_module .slick-prev{left:-7%}}@media (min-width: 769px), print{.lightbox_carousel_module .slick-prev{left:-6%}}.lightbox_carousel_module .slick-next{right:-9%}@media (min-width: 600px), print{.lightbox_carousel_module .slick-next{right:-7%}}@media (min-width: 769px), print{.lightbox_carousel_module .slick-next{right:-6%}}.suggested_features .slick-slider .slick-next,.suggested_features .slick-slider .slick-prev{border-radius:50%;background-color:#D3E4FF;width:33px;height:33px}.suggested_features .slick-slider .slick-next:before,.suggested_features .slick-slider .slick-prev:before{transform:scale(0.5);opacity:.6}.suggested_features .slick-slider .slick-next:hover,.suggested_features .slick-slider .slick-prev:hover{background-color:#DFEFFF}.suggested_features .slick-slider .slick-next:before{margin-left:2px}.related .slick-prev,.related .slick-next{top:31%}@media (min-width: 600px), print{.related .slick-prev,.related .slick-next{top:38%}}@media (min-width: 1024px), print{.related .slick-prev,.related .slick-next{top:31%}}.related .slick-prev:before,.related .slick-next:before{background-image:none}.megasection_nav_present.msl .suggested_features .slick-next,.megasection_nav_present.msl .suggested_features .slick-prev{background-color:#E34E41}.megasection_nav_present.msl .suggested_features .slick-next:hover,.megasection_nav_present.msl .suggested_features .slick-prev:hover{background-color:#FC6B5F}.megasection_nav_present.msl .suggested_features .slick-next:before,.megasection_nav_present.msl .suggested_features .slick-prev:before{-webkit-filter:invert(1);filter:invert(1);opacity:1}.main_carousel.module{padding-top:1.7em;padding-bottom:2.1em}@media (min-width: 600px), print{.main_carousel.module{padding-top:2em;padding-bottom:2.2em}}@media (min-width: 769px), print{.main_carousel.module{padding-top:3em;padding-bottom:2.9em}}@media (min-width: 769px), print{.main_carousel.module{padding-top:3.5em;padding-bottom:3.2em}}.main_carousel.module .carousel_header .carousel_title{border:1px solid blue;margin-bottom:.8em}@media (min-width: 600px), print{.main_carousel.module .carousel_header .carousel_title{margin-bottom:1.1em}}.main_carousel.module .slick-slider{margin-left:auto;margin-right:auto;width:100%;margin-bottom:0}.main_carousel.module .slick-slider .slick-slide a{text-decoration:none}.main_carousel.module .slick-slider .content_title{margin:.6em 0 0;color:#222}@media (min-width: 600px), print{.main_carousel.module .slick-slider .content_title{margin:0 0 .8em}}.main_carousel.module .slick-slider .content_title h1{font-size:1.209em;margin-bottom:0em}@media (min-width: 600px), print{.main_carousel.module .slick-slider .content_title h1{font-size:1.395em;margin-bottom:0em}}@media (min-width: 769px), print{.main_carousel.module .slick-slider .content_title h1{font-size:1.581em;margin-bottom:0em}}@media (min-width: 1024px), print{.main_carousel.module .slick-slider .content_title h1{font-size:1.674em;margin-bottom:0em}}@media (min-width: 1200px){.main_carousel.module .slick-slider .content_title h1{font-size:1.767em;margin-bottom:0em}}.main_carousel.module .slick-slider .left-col,.main_carousel.module .slick-slider .right-col{display:inline-block;vertical-align:top}@media (min-width: 600px), print{.main_carousel.module .slick-slider .left-col{display:inline-block;width:45.83333%;float:left;margin-right:4.16667%}}.main_carousel.module .slick-slider .right-col{width:100%}@media (min-width: 600px), print{.main_carousel.module .slick-slider .right-col{width:50%;float:right;margin-right:0}}.main_carousel.module .slick-slider .carousel_item_description{display:none}@media (min-width: 600px), print{.main_carousel.module .slick-slider .carousel_item_description{display:block;margin-bottom:1.5em}}.main_carousel.module .slick-slider .content_body{margin-bottom:.9em}@media (min-width: 600px), print{.main_carousel.module .slick-slider .content_body{margin-bottom:0}}.main_carousel.module .slick-slider .content_footer{padding:.6em 1em 1em 0}@media (min-width: 769px), print{.main_carousel.module .slick-slider .content_footer{padding:0}.main_carousel.module .slick-slider .content_footer a+a{margin-top:.6em}}.main_carousel.module .slick-slider .content_footer .full_artical_link,.main_carousel.module .slick-slider .content_footer .full_category_link{padding-right:.8em;display:inline-block;font-size:.9em;white-space:nowrap}@media (min-width: 600px), print{.main_carousel.module .slick-slider .content_footer .full_artical_link,.main_carousel.module .slick-slider .content_footer .full_category_link{font-size:1em}}@media (min-width: 769px), print{.main_carousel.module .slick-slider .content_footer .full_artical_link,.main_carousel.module .slick-slider .content_footer .full_category_link{float:left;clear:both}}.main_carousel.module .slick-slider .content_footer .full_artical_link:before,.main_carousel.module .slick-slider .content_footer .full_category_link:before{content:\"› \"}.suggested_features.module .slick-slider,.related.module .slick-slider{margin-left:auto;margin-right:auto;width:100%;margin-bottom:1em}@media (min-width: 480px){.suggested_features.module .slick-slider,.related.module .slick-slider{width:84%}}@media (min-width: 600px), print{.suggested_features.module .slick-slider,.related.module .slick-slider{margin-bottom:1.5em;width:90%}}.suggested_features.module .slick-slider .category_title,.related.module .slick-slider .category_title{color:white;line-height:1.4em}.suggested_features.module .slick-slider .slick-slide a,.related.module .slick-slider .slick-slide a{text-decoration:none;color:#222}.suggested_features.module .slick-slider .slide,.related.module .slick-slider .slide{margin:0 6px}@media (min-width: 769px), print{.suggested_features.module .slick-slider .slide,.related.module .slick-slider .slide{margin:0 9px}}.no-touchevents .suggested_features.module .slide:hover .content_title a,.no-touchevents .related.module .slide:hover .content_title a{color:#366599}.no-touchevents .suggested_features.module .slide:hover .rollover_description,.no-touchevents .related.module .slide:hover .rollover_description{background-color:rgba(0,0,0,0.7)}.suggested_features.module .content_title,.related.module .content_title{padding:.6rem 0 0;color:#222;font-weight:400}.suggested_features.module .content_title a,.related.module .content_title a{display:block;font-size:.9rem}@media (min-width: 769px), print{.suggested_features.module .content_title a,.related.module .content_title a{font-size:1.14rem}}.suggested_features.module .image_and_description_container,.related.module .image_and_description_container{position:relative;overflow:hidden;min-height:129px}.suggested_features.module .module_title,.related.module .module_title{font-size:1.69em;margin-bottom:.35em;margin-top:0}@media (min-width: 600px), print{.suggested_features.module .module_title,.related.module .module_title{font-size:1.95em;margin-bottom:.63em}}@media (min-width: 769px), print{.suggested_features.module .module_title,.related.module .module_title{font-size:2.21em;margin-bottom:.91em}}@media (min-width: 1024px), print{.suggested_features.module .module_title,.related.module .module_title{font-size:2.34em;margin-bottom:1.015em}}@media (min-width: 1200px){.suggested_features.module .module_title,.related.module .module_title{font-size:2.47em;margin-bottom:1.12em}}.insight_page .suggested_features.module .module_title,.insight_page .related.module .module_title{color:black}.lightbox_carousel_module,.news_features_carousel{width:100%;margin-left:auto;margin-right:auto;max-width:1200px}@media (min-width: 480px){.lightbox_carousel_module,.news_features_carousel{width:calc(100% - 55px)}}.lightbox_carousel_module .slick-slider,.news_features_carousel .slick-slider{margin-left:auto;margin-right:auto;width:100%}@media (min-width: 480px){.lightbox_carousel_module .slick-slider,.news_features_carousel .slick-slider{width:90%}}.lightbox_carousel_module header,.news_features_carousel header{text-align:center;margin-bottom:2.2rem}.lightbox_carousel_module .module_title,.news_features_carousel .module_title{color:#222;margin-top:0}.lightbox_carousel_module .subtitle,.news_features_carousel .subtitle{margin:0 auto;width:97%;max-width:620px}.lightbox_carousel_module .slide,.news_features_carousel .slide{padding:0 3px}.lightbox_carousel_module .slide_description,.news_features_carousel .slide_description{text-align:center;padding:1rem .5rem 0}.lightbox_carousel_module .slide_description h3,.news_features_carousel .slide_description h3{font-size:1.1rem;margin:0;font-weight:400}.lightbox_carousel_module .slide_description .description_body,.news_features_carousel .slide_description .description_body{margin-top:.3rem;color:#727272}.lightbox_carousel_module .image_container,.news_features_carousel .image_container{position:relative}.lightbox_carousel_module .youtube_play_button,.news_features_carousel .youtube_play_button{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;width:50px;height:50px}.insight_page .suggested_features.module .module_title{color:#222;margin-bottom:1.12em}.carousel_teaser .slick-slider,.news_teaser .slick-slider,.multimedia_teaser .slick-slider{margin-left:auto;margin-right:auto;width:100%;margin-bottom:2.5em}@media (min-width: 480px){.carousel_teaser .slick-slider,.news_teaser .slick-slider,.multimedia_teaser .slick-slider{width:84%}}@media (min-width: 600px), print{.carousel_teaser .slick-slider,.news_teaser .slick-slider,.multimedia_teaser .slick-slider{width:88%;margin-bottom:3em}}@media (min-width: 769px), print{.carousel_teaser .slick-slider,.news_teaser .slick-slider,.multimedia_teaser .slick-slider{margin-bottom:3.5em}}@media (min-width: 1300px){.carousel_teaser .slick-slider,.news_teaser .slick-slider,.multimedia_teaser .slick-slider{width:92%}}.carousel_teaser .slick-slider .category_title,.news_teaser .slick-slider .category_title,.multimedia_teaser .slick-slider .category_title{color:white;line-height:1.4em}.carousel_teaser .slick-slider .slick-slide a,.news_teaser .slick-slider .slick-slide a,.multimedia_teaser .slick-slider .slick-slide a{text-decoration:none;color:#222}.carousel_teaser .slick-slider .slide,.news_teaser .slick-slider .slide,.multimedia_teaser .slick-slider .slide{margin:0 6px}@media (min-width: 769px), print{.carousel_teaser .slick-slider .slide,.news_teaser .slick-slider .slide,.multimedia_teaser .slick-slider .slide{margin:0 6px}}.no-touchevents .carousel_teaser .slick-slider .slide:hover .content_title a,.no-touchevents .news_teaser .slick-slider .slide:hover .content_title a,.no-touchevents .multimedia_teaser .slick-slider .slide:hover .content_title a{color:#366599;cursor:pointer}.carousel_teaser .slick-slider .image_and_description_container,.news_teaser .slick-slider .image_and_description_container,.multimedia_teaser .slick-slider .image_and_description_container{position:relative;overflow:hidden;min-height:129px}.carousel_teaser .slick-slider .content_title,.news_teaser .slick-slider .content_title,.multimedia_teaser .slick-slider .content_title{padding:.6em 0 0;color:#222;font-weight:400}.carousel_teaser .slick-slider .slick-prev,.carousel_teaser .slick-slider .slick-next,.news_teaser .slick-slider .slick-prev,.news_teaser .slick-slider .slick-next,.multimedia_teaser .slick-slider .slick-prev,.multimedia_teaser .slick-slider .slick-next{top:35%;content:'';display:inline-block;padding:0;cursor:pointer;width:35px;height:35px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -32px -208px;background-size:300px}.carousel_teaser .slick-slider .slick-prev:hover,.carousel_teaser .slick-slider .slick-prev.active,.carousel_teaser .slick-slider .slick-next:hover,.carousel_teaser .slick-slider .slick-next.active,.news_teaser .slick-slider .slick-prev:hover,.news_teaser .slick-slider .slick-prev.active,.news_teaser .slick-slider .slick-next:hover,.news_teaser .slick-slider .slick-next.active,.multimedia_teaser .slick-slider .slick-prev:hover,.multimedia_teaser .slick-slider .slick-prev.active,.multimedia_teaser .slick-slider .slick-next:hover,.multimedia_teaser .slick-slider .slick-next.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -32px -258px;background-size:300px}.multimedia_module_gallery .carousel_teaser .slick-slider .slick-prev,.multimedia_module_gallery .carousel_teaser .slick-slider .slick-next,.multimedia_module_gallery .news_teaser .slick-slider .slick-prev,.multimedia_module_gallery .news_teaser .slick-slider .slick-next,.multimedia_module_gallery .multimedia_teaser .slick-slider .slick-prev,.multimedia_module_gallery .multimedia_teaser .slick-slider .slick-next{top:45%}.related .carousel_teaser .slick-slider .slick-prev,.related .carousel_teaser .slick-slider .slick-next,.related .news_teaser .slick-slider .slick-prev,.related .news_teaser .slick-slider .slick-next,.related .multimedia_teaser .slick-slider .slick-prev,.related .multimedia_teaser .slick-slider .slick-next{top:25%}@media (min-width: 769px), print{.related .carousel_teaser .slick-slider .slick-prev,.related .carousel_teaser .slick-slider .slick-next,.related .news_teaser .slick-slider .slick-prev,.related .news_teaser .slick-slider .slick-next,.related .multimedia_teaser .slick-slider .slick-prev,.related .multimedia_teaser .slick-slider .slick-next{top:25%}}@media (min-width: 1024px), print{.related .carousel_teaser .slick-slider .slick-prev,.related .carousel_teaser .slick-slider .slick-next,.related .news_teaser .slick-slider .slick-prev,.related .news_teaser .slick-slider .slick-next,.related .multimedia_teaser .slick-slider .slick-prev,.related .multimedia_teaser .slick-slider .slick-next{top:31%}}.news_teaser .carousel_teaser .slick-slider .slick-prev,.suggested_features .carousel_teaser .slick-slider .slick-prev,.news_teaser .carousel_teaser .slick-slider .slick-next,.suggested_features .carousel_teaser .slick-slider .slick-next,.news_teaser .news_teaser .slick-slider .slick-prev,.suggested_features .news_teaser .slick-slider .slick-prev,.news_teaser .news_teaser .slick-slider .slick-next,.suggested_features .news_teaser .slick-slider .slick-next,.news_teaser .multimedia_teaser .slick-slider .slick-prev,.suggested_features .multimedia_teaser .slick-slider .slick-prev,.news_teaser .multimedia_teaser .slick-slider .slick-next,.suggested_features .multimedia_teaser .slick-slider .slick-next{top:38%}.carousel_teaser .slick-slider .slick-prev,.news_teaser .slick-slider .slick-prev,.multimedia_teaser .slick-slider .slick-prev{transform:scaleX(-1)}.carousel_teaser .slick-slider .slick-prev,.news_teaser .slick-slider .slick-prev,.multimedia_teaser .slick-slider .slick-prev{left:-9%}@media (min-width: 600px), print{.carousel_teaser .slick-slider .slick-prev,.news_teaser .slick-slider .slick-prev,.multimedia_teaser .slick-slider .slick-prev{left:-7%}}@media (min-width: 769px), print{.carousel_teaser .slick-slider .slick-prev,.news_teaser .slick-slider .slick-prev,.multimedia_teaser .slick-slider .slick-prev{left:-6.5%}}.carousel_teaser .slick-slider .slick-next,.news_teaser .slick-slider .slick-next,.multimedia_teaser .slick-slider .slick-next{right:-9%}@media (min-width: 600px), print{.carousel_teaser .slick-slider .slick-next,.news_teaser .slick-slider .slick-next,.multimedia_teaser .slick-slider .slick-next{right:-7%}}@media (min-width: 769px), print{.carousel_teaser .slick-slider .slick-next,.news_teaser .slick-slider .slick-next,.multimedia_teaser .slick-slider .slick-next{right:-6.5%}}.carousel_teaser .slick-slider .slick-disabled,.news_teaser .slick-slider .slick-disabled,.multimedia_teaser .slick-slider .slick-disabled{cursor:default;opacity:.4}.carousel_teaser .slick-slider .slick-disabled:before,.news_teaser .slick-slider .slick-disabled:before,.multimedia_teaser .slick-slider .slick-disabled:before{cursor:default}section.vital_signs_menu .readout{color:#222;display:inline-block;text-align:right;position:absolute;right:0;top:0;height:100%}section.vital_signs_menu .readout .title{font-size:1em;font-weight:300;color:#e4e4e4;white-space:nowrap;text-transform:uppercase}@media (min-width: 600px), print{section.vital_signs_menu .readout .title{font-size:1.4em}}.mini_module header h3,.mini_module header h4{color:#ad7226;font-weight:600;font-size:0.9em;margin:0 0 0.1em;text-transform:uppercase;letter-spacing:0}.mini_module header h3.info_tipped,.mini_module header h4.info_tipped{display:inline}.mini_module .inline_component{display:inline-block}.mini_module .description{font-size:1.85rem}.mini_module .transmissions{font-weight:400;color:#ad7226}.mini_module .target_name{color:#ad7226}.mini_module .upcoming{margin-top:.3rem}.mini_module .upcoming>span,.mini_module .previous>span{white-space:nowrap}.mini_module.countdown{overflow:hidden}.mini_module.countdown .unit>span{color:#ad7226;background-color:#FFF1DE}#iframe_overlay .mini_module header h3,#iframe_overlay .mini_module header h4{color:#f7c585}#iframe_overlay .mini_module.countdown .unit>span{color:#ad7226;background-color:#382B19}#iframe_overlay .mini_module .transmissions{color:#f7c585}#iframe_overlay .mini_module .target_name{color:white}#secondary_column .boxed .mini_module{border:none;margin:0;padding:0}#secondary_column .boxed .mini_module+.mini_module{margin-top:1.4rem}#secondary_column .mini_module header{margin-bottom:0.1rem}#secondary_column .mini_module .description{font-size:1.4em}@media (min-width: 1024px), print{#secondary_column .mini_module .description{font-size:1.5em}}#secondary_column .mini_module .countdown .unit span{padding:0 0.8em}#primary_column .mini_module{margin:3rem 0}#primary_column .mini_module header{margin-bottom:.5rem}#primary_column .mini_module header h3{font-size:1.7rem}.homepage_dashboard_modal .mini_module .upcoming{margin-top:.3rem}@media (max-width: 480px){.homepage_dashboard_modal .mini_module .upcoming>span,.homepage_dashboard_modal .mini_module .previous>span{display:block}}.homepage_dashboard_modal.vital_signs_container{position:absolute;top:0;left:0;width:100%;height:calc(100vh - 36px);z-index:41;color:#222;overflow-x:hidden;overflow-y:hidden;-webkit-overflow-scrolling:touch;visibility:hidden;opacity:0;transition:opacity .5s;background:rgba(0,0,0,0.9);word-wrap:break-word;transition:opacity 400ms}.homepage_dashboard_modal.vital_signs_container.visible{visibility:visible;opacity:1}.homepage_dashboard_modal.vital_signs_container.hide_background{background:transparent}@media (min-width: 1200px){.homepage_dashboard_modal.vital_signs_container{z-index:30}}.homepage_dashboard_modal.vital_signs_container .loading{position:absolute;left:50%;top:44vh;width:150px;margin-left:-75px;text-align:center}.homepage_dashboard_modal.vital_signs_container .loading p{color:#fcb963;padding-top:67px;font-size:15px;font-weight:300;margin:0;display:none}.homepage_dashboard_modal.vital_signs_container .vital_signs.module{padding:0;height:100%}.homepage_dashboard_modal.vital_signs_container .countdown_time .unit{color:#efe9e6}.homepage_dashboard_modal.vital_signs_container .countdown_time .unit span{color:#966b35;background-color:#000000}.homepage_dashboard_modal.vital_signs_container .content{transition:opacity .5s;opacity:0;height:100%}.homepage_dashboard_modal.vital_signs_container .content.visible{opacity:1}.homepage_dashboard_modal.vital_signs_container .vital_signs_header{margin-bottom:.8em}@media (min-width: 600px), print{.homepage_dashboard_modal.vital_signs_container .vital_signs_header{margin-bottom:1.5em}}.homepage_dashboard_modal.vital_signs_container a{color:#6bbed8;font-size:.9em}.homepage_dashboard_modal.vital_signs_container .more_link{margin:1em 0;float:right;font-weight:600;white-space:nowrap}.homepage_dashboard_modal.vital_signs_container .more_link::after{content:\" ›\"}.homepage_dashboard_modal.vital_signs_container .grid_layout{display:flex;flex-direction:column;background:rgba(62,23,0,0.75);position:relative;width:100%;margin:0;padding:2em 2em 3em;height:100%;z-index:5;left:0;top:100vh;opacity:0}@media (min-width: 769px), print{.homepage_dashboard_modal.vital_signs_container .grid_layout{padding:2em 15% 3em}}@media (min-width: 1200px){.homepage_dashboard_modal.vital_signs_container .grid_layout{display:block;padding:2em 2em 2.5em;max-height:100%;height:auto;background:rgba(39,20,5,0.95);top:4.5em;max-width:550px;width:48%;left:100%}}@media (min-width: 1200px){.homepage_dashboard_modal.vital_signs_container .grid_layout{max-width:700px;width:48%}}@media (min-width: 1700px){.homepage_dashboard_modal.vital_signs_container .grid_layout{max-width:750px;width:48%}}.homepage_dashboard_modal.vital_signs_container .background_area{width:100%;height:100%;position:absolute;top:0;left:0;-webkit-filter:none;filter:none;display:none}.homepage_dashboard_modal.vital_signs_container .background_area.blur{-webkit-filter:blur(3px);filter:blur(3px)}@media (min-width: 1200px){.homepage_dashboard_modal.vital_signs_container .background_area{display:none}}.homepage_dashboard_modal.vital_signs_container .module_title{margin-bottom:0.4em;text-align:left;color:#efe9e6;font-weight:400;font-size:1.6em;width:90%}@media (min-width: 1200px){.homepage_dashboard_modal.vital_signs_container .module_title{width:100%}}.homepage_dashboard_modal.vital_signs_container a.close_button{display:none}.homepage_dashboard_modal.vital_signs_container a.close_button.homepage_special{display:block;position:absolute;top:.8em;right:.8em;z-index:99;width:44px;height:44px}.homepage_dashboard_modal.vital_signs_container a.close_button.homepage_special .close_icon{display:block;height:100%;position:relative}.homepage_dashboard_modal.vital_signs_container a.close_button.homepage_special .close_icon:before{transform:rotate(-45deg);content:'';position:absolute;height:2px;width:100%;top:calc(50% - 1px);left:0;background:#fff}.homepage_dashboard_modal.vital_signs_container a.close_button.homepage_special .close_icon:after{transform:rotate(45deg);content:'';position:absolute;height:2px;width:100%;top:calc(50% - 1px);left:0;background:#fff}.no-touchevents .homepage_dashboard_modal.vital_signs_container a.close_button.homepage_special:hover{opacity:1}@media (min-width: 600px), print{.homepage_dashboard_modal.vital_signs_container a.close_button.homepage_special{top:1em;right:1em}}@media (min-width: 1200px){.homepage_dashboard_modal.vital_signs_container a.close_button.homepage_special{background:rgba(37,21,8,0.8)}}@media (min-width: 1700px){.homepage_dashboard_modal.vital_signs_container a.close_button.homepage_special{top:1.2em;right:1.2em;width:60px;height:60px}}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser{overflow:visible;padding-bottom:2em}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .loader{font-size:15px;color:#fcb963;display:block;margin:1em 0}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser h3,.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser h4{color:#fcb963;font-weight:400;font-size:0.9em;text-transform:uppercase;letter-spacing:0}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser p{color:#efe9e6;font-weight:300}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .desc_title{font-weight:600;margin-bottom:.3em;display:block}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser article{margin:0 0 0.5em}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser article header{margin:0}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser article header .subtitle{color:#fcb963}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser article .description{color:#efe9e6;font-weight:300}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser article .description:not(p){font-size:1.8em}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list{margin-bottom:0}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_content{padding:0}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_title{margin-bottom:.5em;text-transform:uppercase;font-size:.9em;font-weight:400;color:#fcb963}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_image{width:30%;float:right;margin:0 0 1em 1.8em}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_image .caption{font-size:0.7em;display:block;margin-top:0.4em;color:#beb0a4}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text{width:100%;float:none}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text p,.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text .description{color:#efe9e6;font-weight:300}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text p,.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text .description a{font-size:16px}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text p{margin:1em 0}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text p:first-of-type{margin-top:0}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text p:last-of-type{margin-bottom:0}.homepage_dashboard_modal.vital_signs_container .vital_signs_teaser .item_list .list_text a.more_or_less{color:#efe9e6;text-decoration:underline}.homepage_dashboard_modal.vital_signs_container .overlay_nav li{display:inline-block;color:#94623a;font-size:1.2em;cursor:pointer;transition:all 200ms;margin-right:0.8em}.homepage_dashboard_modal.vital_signs_container .overlay_nav li.current,.homepage_dashboard_modal.vital_signs_container .overlay_nav li:hover{color:white}.homepage_dashboard_modal.vital_signs_container .overlay_nav .nav_spacer{font-size:0.4em;vertical-align:middle;margin:0 .5em;color:#94623a}.homepage_dashboard_modal.vital_signs_container .column_container{display:block;overflow:auto;overflow-x:hidden;padding-right:2em;max-width:100%;height:100%}@media (min-width: 1200px){.homepage_dashboard_modal.vital_signs_container .column_container{width:100%;overflow-y:auto;height:auto;max-height:calc(80vh - 320px)}}@media (min-width: 1200px) and (min-height: 700px){.homepage_dashboard_modal.vital_signs_container .column_container{max-height:calc(88vh - 320px)}}.homepage_dashboard_modal.vital_signs_container .column_container::-webkit-scrollbar-track{background-color:rgba(252,185,99,0.2)}.homepage_dashboard_modal.vital_signs_container .column_container::-webkit-scrollbar{width:5px;left:10px}.homepage_dashboard_modal.vital_signs_container .column_container::-webkit-scrollbar-thumb{background-color:#eaeaea}.homepage_dashboard_modal.vital_signs_container .content_col{position:relative;float:left;width:100%}.homepage_dashboard_modal.vital_signs_container .content_col hr{border-top:1px solid rgba(255,255,255,0.2)}.homepage_dashboard_modal.vital_signs_container .content_col .wysiwyg_content>*{color:#efe9e6}.homepage_dashboard_modal.vital_signs_container .content_col .wysiwyg_content>*:last-child{margin-bottom:0}.homepage_dashboard_modal.vital_signs_container .content_col .wysiwyg_content p{color:#efe9e6}.homepage_dashboard_modal.vital_signs_container .content_col .wysiwyg_content h4{font-size:0.9em;font-weight:400;margin-top:0}.homepage_dashboard_modal.vital_signs_container .dsn_status_module+p{margin-top:0}#vital_signs_modal::-webkit-scrollbar-track{background-color:rgba(252,185,99,0.2)}#vital_signs_modal::-webkit-scrollbar{width:4px;left:10px}#vital_signs_modal::-webkit-scrollbar-thumb{background-color:#eaeaea}.homepage_dashboard_modal .homepage_only{display:block}.homepage_dashboard_modal .no_homepage{display:none}.homepage_only{display:none}#dashboard_modal{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1001;color:#222;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch;visibility:hidden;opacity:0;transition:opacity .5s;background:rgba(33,33,33,0.9);word-wrap:break-word}#dashboard_modal.visible{visibility:visible;opacity:1}#dashboard_modal .content{transition:opacity .5s;opacity:0}#dashboard_modal .content.visible{opacity:1}#dashboard_modal .more_link{margin:1em 0;float:right;font-weight:600;white-space:nowrap}#dashboard_modal .more_link::after{content:\" ›\"}#dashboard_modal hr.column_divider{margin:2em 0;width:100%;display:inline-block}@media (min-width: 769px), print{#dashboard_modal hr.column_divider{display:none}}#dashboard_modal .vital_signs.module{padding:1em 0}@media (min-width: 600px), print{#dashboard_modal .vital_signs.module{padding:2em 0 2em}}@media (min-width: 769px), print{#dashboard_modal .vital_signs.module{padding:3em 0 2em}}@media (min-width: 1024px), print{#dashboard_modal .vital_signs.module{padding:4em 0 2em}}@media (min-width: 1200px){#dashboard_modal .vital_signs.module{padding:5em 0 2em}}#dashboard_modal .grid_layout{background:white;position:relative;width:100%;padding:2.5%;z-index:5}@media (min-width: 480px){#dashboard_modal .grid_layout{width:95%;border-radius:4px;padding:3.5% 4.5%}}@media (min-width: 1700px){#dashboard_modal .grid_layout{width:95%;max-width:1120px}}#dashboard_modal .grid_layout>header{margin-bottom:1.4em;width:85%}#dashboard_modal .background_area{width:100%;height:100%;position:absolute;top:0;left:0;cursor:pointer}#dashboard_modal .module_title{margin-bottom:0;text-align:left;margin:0 0 .7em;font-weight:500;color:black;font-size:1.82em;margin-bottom:0em}@media (min-width: 600px), print{#dashboard_modal .module_title{font-size:2.1em;margin-bottom:0em}}@media (min-width: 769px), print{#dashboard_modal .module_title{font-size:2.38em;margin-bottom:0em}}@media (min-width: 1024px), print{#dashboard_modal .module_title{font-size:2.52em;margin-bottom:0em}}@media (min-width: 1200px){#dashboard_modal .module_title{font-size:2.66em;margin-bottom:0em}}#dashboard_modal a.close_button{position:absolute;top:.8em;right:.8em;z-index:99;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -25px;background-size:300px;opacity:.5}#dashboard_modal a.close_button:hover,#dashboard_modal a.close_button.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -25px;background-size:300px}.no-touchevents #dashboard_modal a.close_button:hover{opacity:1}@media (min-width: 600px), print{#dashboard_modal a.close_button{top:1em;right:1em}}@media (min-width: 1700px){#dashboard_modal a.close_button{top:1.2em;right:1.2em}}#dashboard_modal .close_button.homepage_special{display:none}#dashboard_modal .loader{height:100vh}#dashboard_modal .column_container{display:flex;flex-wrap:wrap}#dashboard_modal .left_col,#dashboard_modal .right_col{position:relative;float:left}#dashboard_modal .left_col{width:100%}@media (min-width: 769px), print{#dashboard_modal .left_col{width:65%;border-right:1px solid #BEBEBE;padding-right:1em}}@media (min-width: 1200px){#dashboard_modal .left_col{padding-right:3em}}#dashboard_modal .right_col{width:100%}#dashboard_modal .right_col p{color:#868686}#dashboard_modal .right_col p b{color:#222}@media (min-width: 769px), print{#dashboard_modal .right_col{width:30%;padding-left:1em;left:-1px}}@media (min-width: 1200px){#dashboard_modal .right_col{padding-left:3em}}#dashboard_modal footer{margin-bottom:1.3em}@media (min-width: 769px), print{#dashboard_modal footer{margin-bottom:.3em}}#dashboard_modal article.vital_signs_teaser{overflow:visible}.homepage_dashboard_modal .homepage_only{display:block}.homepage_dashboard_modal .no_homepage{display:none}#dashboard_modal_content .wysiwyg_content .left_col .vital_signs_teaser>:first-child,#dashboard_modal_content .right_col .vital_signs_teaser>:first-child h2{margin-top:0}.distance_travelled .sol{font-size:0.7em}section.vital_signs_menu{z-index:20}section.vital_signs_menu .slick-slider{width:80%;margin-left:auto;margin-right:auto}@media (min-width: 480px){section.vital_signs_menu .slick-slider{width:84%}}@media (min-width: 600px), print{section.vital_signs_menu .slick-slider{width:calc(100% - 85px)}}@media (min-width: 769px), print{section.vital_signs_menu .slick-slider{width:90%}}@media (min-width: 1024px), print{section.vital_signs_menu .slick-slider{width:92%}}@media (min-width: 1700px){section.vital_signs_menu .slick-slider{width:1350px}}section.vital_signs_menu .slick-slider .slick-list{z-index:22}section.vital_signs_menu .slick-slider .slick-track{margin-left:auto;margin-right:auto}section.vital_signs_menu .slick-navigation{display:block;position:absolute;top:0;width:100%;height:100%;z-index:21}@media screen and (min-width: 1550px){section.vital_signs_menu .slick-navigation{display:none}}section.vital_signs_menu .slick-navigation .slick-prev,section.vital_signs_menu .slick-navigation .slick-next{position:absolute;background-color:transparent;font-size:1.8em;color:#808080;height:77px;background-image:url(\"https://mars.nasa.gov/assets/[email protected]\");background-repeat:no-repeat;background-size:135px;width:34px;text-indent:-9999px;top:4px;z-index:999999}section.vital_signs_menu .slick-navigation .slick-prev{left:.7%;border-right:1px solid rgba(216,216,216,0.2);background-position:-27px 19px}@media (min-width: 1024px), print{section.vital_signs_menu .slick-navigation .slick-prev{left:.8%}}@media (min-width: 1200px){section.vital_signs_menu .slick-navigation .slick-prev{left:.9%}}section.vital_signs_menu .slick-navigation .slick-prev:hover{background-position:0px 19px}section.vital_signs_menu .slick-navigation .slick-next{right:.7%;border-left:1px solid rgba(216,216,216,0.2);background-position:-75px 19px}@media (min-width: 1024px), print{section.vital_signs_menu .slick-navigation .slick-next{right:.8%}}@media (min-width: 1200px){section.vital_signs_menu .slick-navigation .slick-next{right:.9%}}section.vital_signs_menu .slick-navigation .slick-next:hover{background-position:-102px 19px}section.vital_signs_menu ul .slick-slide{height:90px;margin:0}@media (min-width: 600px), print{section.vital_signs_menu ul .slick-slide{height:95px}}section.vital_signs_menu li{display:inline-block;vertical-align:top;position:relative;width:100%}section.vital_signs_menu li:last-child .image_and_description_container{border-right:none}section.vital_signs_menu .image_and_description_container{display:inline-block;overflow:visible;cursor:pointer;width:auto;height:75%;padding-right:.5em;padding-left:1em;vertical-align:middle}@media (min-width: 1700px){section.vital_signs_menu .image_and_description_container{border-right:none}}section.vital_signs_menu .readout .subtitle{color:#4e8fa4;font-size:.78em;font-weight:500;text-transform:uppercase}section.vital_signs_menu .readout{color:white;position:relative;text-align:left;margin:0 auto;float:left}section.vital_signs_menu .readout .text_container{float:left;margin-right:10px}section.vital_signs_menu .readout .title{font-size:1.4em;margin-bottom:0;letter-spacing:-.03em}@media (min-width: 480px){section.vital_signs_menu .readout .title{font-size:1.5em}}@media (min-width: 600px), print{section.vital_signs_menu .readout .title{font-size:1.2em}}@media (min-width: 769px), print{section.vital_signs_menu .readout .title{font-size:1.3em}}@media (min-width: 850px){section.vital_signs_menu .readout .title{font-size:1.1em}}@media (min-width: 950px){section.vital_signs_menu .readout .title{font-size:1.2em}}@media (min-width: 1700px){section.vital_signs_menu .readout .title{font-size:1.5em}}section.vital_signs_menu .readout .overlay_icon{position:absolute;width:37px;height:37px;background:url(\"https://mars.nasa.gov/assets/dashboard_expand.png\") no-repeat;background-size:100%;display:inline-block}#vital_signs_modal.visible ~ .vital_signs_menu{z-index:40}div.modal_open{display:none !important}.page_dashboard,.homepage_dashboard_container{position:relative}section.dashboard{position:absolute;bottom:0;overflow:hidden;width:100%;color:#F1F1F1;text-align:center;z-index:20}@media (min-width: 480px){section.dashboard{background-color:transparent}}section.dashboard a{color:#F1F1F1}section.dashboard .slick-slider{margin:0 auto;width:calc(100% - 90px)}@media (min-width: 1200px){section.dashboard .slick-slider{max-width:1400px}}@media (min-width: 1700px){section.dashboard .slick-slider{max-width:1400px;width:1600px}}section.dashboard .slick-slider .slick-track{margin-left:auto;margin-right:auto}section.dashboard .slick-prev,section.dashboard .slick-next{position:absolute;background-color:transparent;font-size:1.8em;width:40px;height:100%;z-index:21;text-indent:-9999px;top:0;color:#F1F1F1;margin-top:0}section.dashboard .slick-prev{background-image:url(\"https://mars.nasa.gov/assets/arrow_left_slim_dashboard.png\");background-repeat:no-repeat;background-size:27px 70px;background-position:7px 12px;left:-40px}section.dashboard .slick-next{background-image:url(\"https://mars.nasa.gov/assets/arrow_right_slim_dashboard.png\");background-repeat:no-repeat;background-size:27px 70px;background-position:7px 12px;right:-40px}section.dashboard .slide{outline:0;padding:1.2rem .4rem;min-width:200px}@media (min-width: 600px), print{section.dashboard .slide{padding:1.2rem 1.2rem}}@media (min-width: 1024px), print{section.dashboard .slide{min-width:0;padding:1.2rem .3rem}}section.dashboard .slide.overlay,section.dashboard .slide.link_to_page{cursor:pointer}section.dashboard .slide.overlay .transmissions,section.dashboard .slide.link_to_page .transmissions{text-align:left}section.dashboard .slide .svg_icon_container{width:37px;height:37px;margin-left:4px;stroke:#9acaf7;fill:#9acaf7;color:#9acaf7}section.dashboard .slide:hover svg{stroke:white;fill:white}section.dashboard .slide.current svg{transform:rotate(45deg);fill:black}section.dashboard a:hover{text-decoration:none}section.dashboard .image_and_description_container{padding-left:0}section.dashboard .image_and_description_container p{margin:0;display:inline-block;vertical-align:middle}section.dashboard a.image_and_description_container{cursor:pointer;display:block}section.dashboard a.image_and_description_container:hover{text-decoration:none}section.dashboard a.image_and_description_container .countdown,section.dashboard a.image_and_description_container .readout{margin-left:auto;margin-right:auto;width:100%}section.dashboard .title,section.dashboard .countdown_title{color:rgba(255,255,255,0.5);margin-bottom:.5rem;font-size:0.8em;font-weight:500;text-transform:uppercase;text-align:center;color:#DCC5AA}section.dashboard .value,section.dashboard .countdown_time{color:#F1F1F1;margin-top:2px;text-align:center;line-height:1.1}section.dashboard .value .unit,section.dashboard .countdown_time .unit{font-size:1.2em;font-weight:400}@media (min-width: 769px), print{section.dashboard .value .unit,section.dashboard .countdown_time .unit{font-size:1.4em}}section.dashboard .value .time_label,section.dashboard .countdown_time .time_label{padding:0 0.4em;margin-bottom:0}section.dashboard .value{font-size:1.1em}@media (min-width: 769px), print{section.dashboard .value{font-size:1.4em}}section.dashboard .countdown_time{margin-top:-4px}section.dashboard .change_number{font-size:2.1em}section.dashboard .units{top:0;width:45%}section.dashboard .mars_relay_connection{margin-top:-7px}section.dashboard .transmissions{text-align:center}section.dashboard .transmissions .previous span,section.dashboard .transmissions .upcoming span{display:block}section.dashboard .signal{font-size:14.5px;margin:0}section.dashboard .signal .dsn_icon{display:none}section:not(.homepage_dashboard_container) .page_dashboard .link_to_page .value:after,section:not(.homepage_dashboard_container) .page_dashboard .overlay .value:after{content:\"\";display:inline-block;background:url(\"https://mars.nasa.gov/assets/dashboard_sprite.png\") no-repeat;background-size:200px;background-position:-10px -10px;width:33px;height:33px;margin-left:.8rem;vertical-align:middle;transform:translateY(-5%)}@media (min-width: 1200px){section:not(.homepage_dashboard_container) .page_dashboard .slick-slider{max-width:1600px}}@media (min-width: 1700px){section:not(.homepage_dashboard_container) .page_dashboard .slick-slider{max-width:1600px;width:1600px}}section:not(.homepage_dashboard_container) .page_dashboard .slide:hover .value:after{background-position:-10px -60px}section:not(.homepage_dashboard_container) .page_dashboard .slide.current .value:after{background-position:-10px -110px}section:not(.homepage_dashboard_container) .page_dashboard .slide.overlay .value:after{background-position:-60px -10px}section:not(.homepage_dashboard_container) .page_dashboard .slide.overlay:hover .value:after{background-position:-60px -60px}.dashboard li .value{text-align:center}.dashboard li .value .toggle_units{display:inline-block;margin-left:.3rem}.dashboard li .value .unit_toggle{display:inline-block;font-size:.8rem;vertical-align:middle;text-transform:uppercase;font-weight:500;color:#D5D5D5}.dashboard li .value .unit_toggle+.unit_toggle{margin-left:.3rem}.dashboard li .value .unit_toggle:not(.current){text-decoration:underline;color:#9ACAF7;cursor:pointer}.dashboard .svg_icon_container{display:none}body.core section.dashboard,body.data section.dashboard{display:none}@media (min-width: 1200px){body.core section.dashboard,body.data section.dashboard{display:block}}body.info_panel_open section.dashboard{display:none}.top_feature_area section.dashboard{bottom:36px}.carousel_dashboard_container section.dashboard .slide .value,.carousel_dashboard_container section.dashboard .slide .countdown_time{color:#F1F1F1}.carousel_dashboard_container section.dashboard .slide .title,.carousel_dashboard_container section.dashboard .slide .countdown_title{color:rgba(255,255,255,0.5)}.solar_system_dashboard .readout.multiple{text-align:center}.solar_system_dashboard .readout.multiple .value_container{font-size:.7em;display:inline-block}.solar_system_dashboard .readout.multiple .value_container .value{display:inline}.solar_system_dashboard .readout.multiple .value_container::after{content:\" | \";font-size:1.5em}.solar_system_dashboard .readout.multiple .value_container.last::after{content:\"\"}.solar_system_dashboard .readout.multiple.moon_counts .value_container::after{content:\" | \";font-size:1.8rem;vertical-align:-3px;opacity:0.3}.solar_system_dashboard .readout.multiple.moon_counts .value_container.last{padding-left:5px;vertical-align:-3px}.solar_system_dashboard .readout.multiple.moon_counts .value_container.last::after{content:\"\"}.solar_system_dashboard .readout.multiple.moon_counts .moon_count_total{font-size:23px;margin-right:-3px}.solar_system_dashboard .readout.multiple.moon_counts .moon_count_types{font-size:1.1em;line-height:1.05}.homepage_dashboard_container .dashboard{position:absolute;bottom:0}.homepage_dashboard_container .dashboard .value{color:#4e8fa4;font-size:.78em;font-weight:500;text-transform:uppercase}.homepage_dashboard_container .dashboard .title{font-size:1.4em;margin-bottom:0;letter-spacing:-.03em;text-align:left}@media (min-width: 480px){.homepage_dashboard_container .dashboard .title{font-size:1.5em}}@media (min-width: 600px), print{.homepage_dashboard_container .dashboard .title{font-size:1.2em}}@media (min-width: 769px), print{.homepage_dashboard_container .dashboard .title{font-size:1.3em}}@media (min-width: 850px){.homepage_dashboard_container .dashboard .title{font-size:1.1em}}@media (min-width: 950px){.homepage_dashboard_container .dashboard .title{font-size:1.2em}}@media (min-width: 1700px){.homepage_dashboard_container .dashboard .title{font-size:1.5em}}.homepage_dashboard_container .dashboard .svg_icon_container{display:inline-block;vertical-align:middle}.homepage_dashboard_container .dashboard .slide+.slide:after{content:'';display:block;height:70px;border:1px solid rgba(216,216,216,0.2);width:1px;position:absolute;top:50%;transform:translateY(-50%)}@media (min-width: 1700px){.homepage_dashboard_container .dashboard .slide+.slide:after{content:none}}.homepage_dashboard_container .dashboard .slick-next:before{content:'';display:block;height:70px;border:1px solid rgba(216,216,216,0.2);width:1px;position:absolute;top:50%;transform:translateY(-50%)}.homepage_dashboard_container .dashboard .overlay_icon{position:relative;width:37px;height:37px;background:url(\"https://mars.nasa.gov/assets/dashboard_expand.png\") no-repeat;background-size:100%;display:inline-block;vertical-align:middle}.no-touchevents .homepage_dashboard_container .dashboard .slide:hover .overlay_icon{background:url(\"https://mars.nasa.gov/assets/dashboard_expand_hover.png\") no-repeat;background-size:100%}.homepage_dashboard_container .dashboard .slide.current .overlay_icon{background:url(\"https://mars.nasa.gov/assets/dashboard_contract.png\") no-repeat;background-size:100%}.no-touchevents .homepage_dashboard_container .dashboard .slide.current:hover .overlay_icon{background:url(\"https://mars.nasa.gov/assets/dashboard_contract_hover.png\") no-repeat;background-size:100%}.megasection_nav_present.msl section.dashboard .title,.megasection_nav_present.msl section.dashboard .countdown_title{color:#e34e41;font-weight:700}.homepage_countdown{background-color:white;height:600px}.homepage_countdown h2{position:relative;z-index:1}.homepage_countdown img{-o-object-fit:cover;object-fit:cover;position:absolute;height:100%;width:100%;left:0;bottom:0;-o-object-position:left bottom;object-position:left bottom}.homepage_countdown img.foreground{-o-object-position:10% 50%;object-position:10% 50%}@media (min-width: 600px), print{.homepage_countdown img.foreground{-o-object-position:left bottom;object-position:left bottom}}.homepage_countdown .text_area{z-index:1;position:relative}.homepage_countdown .text_area .countdown_time{font-size:2em;margin:10px 0;transition:font-size,250ms}@media (min-width: 480px){.homepage_countdown .text_area .countdown_time{font-size:2em}}@media (min-width: 600px), print{.homepage_countdown .text_area .countdown_time{font-size:3em}}@media (min-width: 1200px){.homepage_countdown .text_area .countdown_time{font-size:4em}}.homepage_countdown .text_area .countdown_time .unit{color:#6d301d;font-weight:600;padding:0 5px}@media (min-width: 480px){.homepage_countdown .text_area .countdown_time .unit{padding:0 5px}}@media (min-width: 600px), print{.homepage_countdown .text_area .countdown_time .unit{padding:0 10px}}@media (min-width: 1200px){.homepage_countdown .text_area .countdown_time .unit{padding:0 15px}}.homepage_countdown .text_area .countdown_time .time_label{color:#6d301d;font-size:16px}@media (max-width: 1199px){.homepage_countdown .text_area .countdown_time .time_label{font-size:12px}}.homepage_countdown .button_link{text-align:center;margin:0 auto;display:block}.homepage_countdown .publish_date{position:absolute;right:15%}@media (max-width: 1199px){.homepage_countdown .publish_date{left:0;right:0;text-align:center}}.image_of_the_day{overflow:hidden;z-index:10;padding:0}.image_of_the_day .gradient_container_top,.image_of_the_day .gradient_container_left,.image_of_the_day .gradient_container_bottom{display:none}.image_of_the_day .gradient_container_bottom{display:block}.image_of_the_day .window{width:100%;position:absolute;overflow:hidden;height:100%;padding:1em}.image_of_the_day .window.mobile{height:100%;min-height:100%}.image_of_the_day #featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}.image_of_the_day a.image_day{width:100%;height:100%;position:absolute;top:0;left:0;z-index:11;text-indent:-999px}.image_of_the_day .grid_layout{z-index:12;height:100%;position:relative}@media (min-width: 1024px), print{.image_of_the_day .grid_layout{width:86%}}.image_of_the_day .floating_text_area{position:absolute;bottom:0;width:100%;text-align:left}@media (min-width: 600px), print{.image_of_the_day .floating_text_area{bottom:1.3rem;text-align:left}}.image_of_the_day .description{color:white}.image_of_the_day .description p{color:inherit}.image_of_the_day header{z-index:12;width:100%}.image_of_the_day header .header_link{display:inline-block;width:100%}.image_of_the_day header .header_link:hover{text-decoration:none}.image_of_the_day header .category_title,.image_of_the_day header .homepage_carousel .floating_text_area .category_title,.homepage_carousel .floating_text_area .image_of_the_day header .category_title{color:white;font-size:0.9em;margin-bottom:0.3em;margin-top:0;font-weight:500}@media (min-width: 600px), print{.image_of_the_day header .category_title,.image_of_the_day header .homepage_carousel .floating_text_area .category_title,.homepage_carousel .floating_text_area .image_of_the_day header .category_title{margin-bottom:0.7em}}.image_of_the_day header .media_feature_title{font-size:1.75rem;font-weight:200;margin-bottom:.3rem;margin-top:0}@media (min-width: 600px), print{.image_of_the_day header .media_feature_title{margin-bottom:0;font-size:2.7rem}}@media (min-width: 769px), print{.image_of_the_day header .media_feature_title{font-size:3rem}}.image_of_the_day header .multimedia_link{display:inline-block;text-transform:uppercase;font-size:0.9em;color:white;text-align:right;font-weight:600;right:0;position:relative}@media (min-width: 600px), print{.image_of_the_day header .multimedia_link{bottom:10px;width:28%;position:absolute}}.image_of_the_day header .multimedia_link a{color:white}.image_of_the_day.homepage_iotd header .header_link{width:100%}@media (min-width: 600px), print{.image_of_the_day.homepage_iotd header .header_link{width:70%}}.image_of_the_day .outline_button,.image_of_the_day .primary_media_feature .floating_text_area .button,.primary_media_feature .floating_text_area .image_of_the_day .button,.image_of_the_day .banner_header_overlay .button,.banner_header_overlay .image_of_the_day .button{opacity:1}.image_of_the_day footer .iotd_link.button{color:white}.image_of_the_day_module a{color:#98c7fc;font-weight:500}.insight_page .image_of_the_day_module a{color:#90c9ff}.image_of_the_day.no_parallax{height:600px}@media (min-width: 1024px), print{.image_of_the_day.no_parallax{height:700px}}.image_of_the_day.no_parallax .featured_image{height:100%}.image_of_the_day.no_parallax .featured_image picture{width:100%;height:100%;display:flex}.image_of_the_day.no_parallax .featured_image picture img{-o-object-fit:cover;object-fit:cover;height:auto;width:100%}.image_of_the_day.no_parallax .floating_text_area{z-index:12;color:white;top:12px;bottom:auto}@media (min-width: 600px), print{.image_of_the_day.no_parallax .floating_text_area{width:70%;bottom:auto;top:45%;transform:translateY(-50%)}}@media (min-width: 769px), print{.image_of_the_day.no_parallax .floating_text_area{width:50%}}.image_of_the_day.no_parallax .floating_text_area p{color:inherit}.image_of_the_day.no_parallax footer{text-align:left;margin-top:1rem}.image_of_the_day.no_parallax .gradient_container_bottom{display:none}.image_of_the_day.no_parallax .gradient_container_left{display:none}@media (min-width: 600px), print{.image_of_the_day.no_parallax .gradient_container_left{display:block}}.image_of_the_day.no_parallax .gradient_container_top{display:block}@media (min-width: 600px), print{.image_of_the_day.no_parallax .gradient_container_top{display:none}}.filter_bar{z-index:20}.filter_bar .section_search{padding-bottom:1em;max-width:380px;width:100%;margin:0 auto}@media (min-width: 1024px), print{.filter_bar .section_search{width:auto;max-width:none;display:flex;padding-bottom:0}}.filter_bar .section_search .search_submit{right:0px;top:-1px}.filter_bar.fixed{position:fixed;top:0;left:0;width:100%;box-shadow:0 4px 4px -2px rgba(0,0,0,0.15)}.filter_bar .search_binder{width:100%;max-width:304px;position:relative;margin-left:auto;margin-right:auto;margin:0 auto .7em 0}@media (min-width: 480px){.filter_bar .search_binder{margin:0 0 .7em 0}}@media (min-width: 1024px), print{.filter_bar .search_binder{position:relative;vertical-align:top;display:inline-block;width:35%;margin-right:1%;max-width:300px}}.filter_bar .search_clear{width:20px;height:20px;position:absolute;right:8px;top:10px;padding:3px;cursor:pointer}.filter_bar .search_clear .search_clear_icon{display:block;height:100%;position:relative}.filter_bar .search_clear .search_clear_icon:before{transform:rotate(-45deg);content:'';position:absolute;height:2px;width:100%;top:calc(50% - 1px);left:0;background:#2b2b2b}.filter_bar .search_clear .search_clear_icon:after{transform:rotate(45deg);content:'';position:absolute;height:2px;width:100%;top:calc(50% - 1px);left:0;background:#2b2b2b}.filter_bar input.search_field{width:100%}.filter_bar input.search_field::-webkit-input-placeholder{color:#bbb !important}.filter_bar input.search_field::-moz-placeholder{color:#bbb !important}.filter_bar input.search_field:-moz-placeholder{color:#bbb !important}.filter_bar input.search_field:-ms-input-placeholder{color:#bbb !important}.filter_bar select{position:relative;padding:.5em 2em .5em 1em;font-size:16px;border:0;height:40px;vertical-align:middle;color:white;-webkit-appearance:none;-o-appearance:none;-moz-appearance:none;background:#3b788b url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat 95% 10px;background-position:right .8em top 10px;background-size:9px;font-weight:700;cursor:pointer;width:100%;border-radius:5px;max-width:304px;margin:0 .5rem .5rem auto;float:none}.filter_bar select::-ms-expand{display:none}.filter_bar select option{padding:0.5em 1em}@media (min-width: 1024px), print{.filter_bar select{margin-bottom:0;margin-left:unset;width:30%;max-width:284px}.filter_bar select+select{margin-left:1%}}.filter_bar header{display:inline-block;width:100%;text-align:left}@media (min-width: 600px), print{.filter_bar header{text-align:center}}@media (min-width: 1024px), print{.filter_bar header{display:none}}.filter_bar .arrow_box{display:inline-block;position:absolute;padding:4px;cursor:pointer;right:0;bottom:7px;float:none;transition:all .2s}@media (min-width: 600px), print{.filter_bar .arrow_box{text-align:center}}.filter_bar .arrow_box.rotate_up{transform:rotate(180deg)}.filter_bar .arrow_box.rotate_right{transform:rotate(270deg)}.filter_bar .arrow_box.rotate_left{transform:rotate(90deg)}.filter_bar .arrow_box .arrow_down{display:block;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #8597B1}.advanced_search .filter_bar .section_search{max-width:none}.advanced_search .filter_bar .suggestion_text{margin-top:0}.advanced_search .filter_bar .search_row+.search_row{margin-top:1em}@media (min-width: 600px), print{.advanced_search .filter_bar .search_row+.search_row{margin-top:0}}@media (min-width: 600px), print{.advanced_search .filter_bar .filter1{width:32.20339%;float:left;margin-right:1.69492%}}@media (min-width: 600px), print{.advanced_search .filter_bar .search_binder{width:49.15254%;float:left;margin-right:1.69492%}}@media (min-width: 600px), print{.advanced_search .filter_bar .conjunction{width:15.25424%;float:right;margin-right:0}}.advanced_search .filter_bar .search_field{background-color:transparent;border:1px solid #C1C1C1;padding-right:1.1em}.advanced_search footer{margin-top:1.5em}@media (min-width: 1024px){.sort_options{text-align:right;position:absolute;top:0;right:100px}@supports (display: grid) and (grid-template-columns: max-content){.sort_options{position:unset;top:unset;right:unset}.gallery_header{display:grid;grid-template-columns:1fr -webkit-max-content -webkit-max-content;grid-template-columns:1fr max-content max-content}.gallery_header .article_title,.gallery_header .module_title{grid-column:1/-1}.gallery_header .filter_bar .section_search{padding-right:unset;margin-right:15px}}}@media (min-width: 600px){.faceted_search_hidden_filters #secondary_column{display:none}.faceted_search_hidden_filters #primary_column{width:100% !important}@supports (display: grid) and (grid-template-columns: max-content){.faceted_search_hidden_filters #primary_column{display:grid;grid-template-columns:1fr -webkit-max-content;grid-template-columns:1fr max-content;grid-column-gap:2.8em}.faceted_search_hidden_filters #primary_column .pagination_status{grid-column:1 / 2}.faceted_search_hidden_filters #primary_column .pagination_options{grid-column:1 / 2}.faceted_search_hidden_filters #primary_column .mobile_filter_btn{grid-column:2 / 3}.faceted_search_hidden_filters #primary_column .mobile_filter_btn .button{margin-top:-0.5em}.faceted_search_hidden_filters #primary_column .filtering_results,.faceted_search_hidden_filters #primary_column .faceted_search_results,.faceted_search_hidden_filters #primary_column .raw_image_gallery,.faceted_search_hidden_filters #primary_column .errors,.faceted_search_hidden_filters #primary_column .search_footer{grid-column:1 / -1}}.faceted_search_hidden_filters .mobile_filter_btn{display:block !important;text-align:right !important}.faceted_search #secondary_column .mobile_filter_controls,.raw_images_form #secondary_column .mobile_filter_controls{display:block !important;position:absolute;top:-0.35em;right:0}.faceted_search #secondary_column .mobile_filter_controls .clear_filter,.raw_images_form #secondary_column .mobile_filter_controls .clear_filter{display:none}.faceted_search #secondary_column .mobile_filter_controls .button,.raw_images_form #secondary_column .mobile_filter_controls .button{position:relative}.faceted_search #secondary_column .mobile_filter_controls .button::after,.raw_images_form #secondary_column .mobile_filter_controls .button::after{content:\"\";display:block;background-color:white;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpolygon points='499.2,55.2 456.8,12.8 256,213.6 55.2,12.8 12.8,55.2 213.6,256 12.8,456.8 55.2,499.2 256,298.4 456.8,499.2 499.2,456.8 298.4,256 ' /%3E%3C/svg%3E\");background-size:1.4em 1.4em;background-repeat:no-repeat;background-position:right;position:absolute;top:0;left:0;width:100%;height:100%}}.rollover_description{opacity:0;height:0;z-index:1;overflow:hidden;transition:opacity .4s}.rollover_description .rollover_description_inner{height:100%;overflow:hidden}.slide{position:relative;min-height:100%}.slide .overlay_arrow{display:none}@media (min-width: 769px), print{.no-touchevents .slide:hover .rollover_description{padding:.9rem;position:absolute;opacity:1;height:auto;top:0;right:0;width:100%;height:100%;color:white;background-color:rgba(0,0,0,0.9);cursor:pointer;font-size:.95rem;line-height:1.3}.no-touchevents .slide:hover .rollover_description p{line-height:inherit;font-size:inherit;color:white}.no-touchevents .slide:hover .rollover_description p:first-child{margin-top:0}.no-touchevents .slide:hover .rollover_title{font-size:1.6em;font-weight:700;margin-bottom:.2em}.no-touchevents .slide:hover .overlay_arrow{height:14px;width:14px;position:absolute;right:14px;bottom:14px;display:block}.no-touchevents .slide:hover .overlay_arrow img{display:block}}.list_view .rollover_description{display:none}.fancybox-overlay,#fancybox-lock{background:#000 !important}.fancybox-wrap,.fancybox-wrap *{-safari-box-sizing:content-box !important;box-sizing:content-box !important}.fancybox-wrap .fancybox-inner{box-shadow:none !important;border-radius:2px !important}.fancybox-wrap .fancybox-title{font-size:16px;font-weight:600;letter-spacing:-0.01em;text-align:center;margin-top:16px;color:#E7E7E7;line-height:1.4em}@media (min-width: 769px), print{.fancybox-wrap .fancybox-title{font-size:17px}}@media (min-width: 1200px){.fancybox-wrap .fancybox-title{font-size:19px}}.fancybox-wrap .addthis_toolbox{display:inline-block;width:100%;margin-top:16px;white-space:nowrap}.fancybox-wrap a.addthis_button_compact{width:89px;border-radius:4px;overflow:hidden;height:38px}.fancybox-wrap a.addthis_button_compact img{vertical-align:top}.fancybox-wrap a.addthis_button_compact:hover{cursor:pointer}.fancybox-wrap a.addthis_button_compact,.fancybox-wrap .button{margin-right:6px;display:inline-block;vertical-align:top}.fancybox-mb-video.fancybox-wrap,.fancybox-mb-info.fancybox-wrap{background:#000}.fancybox-mb-video.fancybox-wrap .fancybox-prev span,.fancybox-mb-info.fancybox-wrap .fancybox-prev span{background-image:url(\"https://mars.nasa.gov/assets/arrow_left_darktheme.png\") !important;background-position:0 !important}.fancybox-mb-video.fancybox-wrap .fancybox-next span,.fancybox-mb-info.fancybox-wrap .fancybox-next span{background-image:url(\"https://mars.nasa.gov/assets/arrow_right_darktheme.png\") !important;background-position:0 !important}.fancybox-mb-video.fancybox-wrap .fancybox-inner,.fancybox-mb-info.fancybox-wrap .fancybox-inner{border:0}.fancybox-mb-video.fancybox-wrap .fancybox-title-float-wrap,.fancybox-mb-info.fancybox-wrap .fancybox-title-float-wrap{position:relative;right:auto;left:auto}.fancybox-mb-video.fancybox-wrap .fancybox-title-float-wrap .child,.fancybox-mb-info.fancybox-wrap .fancybox-title-float-wrap .child{display:block;margin:auto;white-space:normal;padding:1em 0;line-height:normal}.fancybox-mb-video.fancybox-wrap .fancybox-skin,.fancybox-mb-info.fancybox-wrap .fancybox-skin{background-color:black}.fancybox-mb-video.fancybox-wrap .fancybox-title-inside,.fancybox-mb-info.fancybox-wrap .fancybox-title-inside{text-align:left}.fancybox-mb-video.fancybox-wrap .fancybox-nav{top:-15%}@media (min-width: 1px) and (print: 769px){.fancybox-mb-video.fancybox-wrap,.fancybox-mb-info.fancybox-wrap{margin:0 !important;width:95% !important;margin:0 auto !important}.fancybox-mb-video.fancybox-wrap .fancybox-nav,.fancybox-mb-info.fancybox-wrap .fancybox-nav{display:none}.fancybox-mb-video.fancybox-wrap .fancybox-inner,.fancybox-mb-info.fancybox-wrap .fancybox-inner{width:100% !important;height:auto !important}.fancybox-mb-video.fancybox-wrap .fancybox-image,.fancybox-mb-info.fancybox-wrap .fancybox-image{width:100% !important;height:auto !important;margin:0 auto !important}.fancybox-mb-video.fancybox-wrap{left:0 !important;right:0 !important;position:relative !important;margin:0 auto !important;padding:0 !important;border:none}.fancybox-mb-video.fancybox-wrap .fancybox-inner{margin:0 !important}.fancybox-mb-video.fancybox-wrap .fancybox-iframe{height:600px !important}}#fancybox_video .player{min-height:200px;margin-bottom:1.5em}@media (min-width: 480px){#fancybox_video .player{min-height:300px}}@media (min-width: 600px), print{#fancybox_video .player{min-height:400px}}#fancybox_info{margin-top:1.5em}#fancybox_info,#fancybox_video{color:white}#fancybox_info p,#fancybox_info .description,#fancybox_video p,#fancybox_video .description{color:white}#fancybox_info .image_caption,#fancybox_info .image_caption p,#fancybox_video .image_caption,#fancybox_video .image_caption p{color:#aaa;font-size:.9em}#fancybox_info .image_details,#fancybox_video .image_details{overflow:hidden;display:inline-block;width:100%;min-width:inherit}#fancybox_info .image_details .text,#fancybox_video .image_details .text{float:left;text-align:left;width:100%;margin-top:10px}@media (min-width: 769px), print{#fancybox_info .image_details .text,#fancybox_video .image_details .text{margin-top:0}}@media (min-width: 1024px), print{#fancybox_info .image_details .text,#fancybox_video .image_details .text{width:60%}}#fancybox_info .image_details .text .title,#fancybox_video .image_details .text .title{font-size:1.235em;margin-bottom:.1em;line-height:1.3em;font-weight:700}@media (min-width: 600px), print{#fancybox_info .image_details .text .title,#fancybox_video .image_details .text .title{font-size:1.425em;margin-bottom:.18em}}@media (min-width: 769px), print{#fancybox_info .image_details .text .title,#fancybox_video .image_details .text .title{font-size:1.615em;margin-bottom:.26em}}@media (min-width: 1024px), print{#fancybox_info .image_details .text .title,#fancybox_video .image_details .text .title{font-size:1.71em;margin-bottom:.29em}}@media (min-width: 1200px){#fancybox_info .image_details .text .title,#fancybox_video .image_details .text .title{font-size:1.805em;margin-bottom:.32em}}#fancybox_info .image_details .buttons,#fancybox_video .image_details .buttons{width:100%;float:right}@media (min-width: 1024px), print{#fancybox_info .image_details .buttons,#fancybox_video .image_details .buttons{width:40%}}#fancybox_info .image_details .buttons .inner_buttons,#fancybox_video .image_details .buttons .inner_buttons{float:left}@media (min-width: 1024px), print{#fancybox_info .image_details .buttons .inner_buttons,#fancybox_video .image_details .buttons .inner_buttons{float:right}}#fancybox_info .image_details .buttons .addthis_toolbox,#fancybox_video .image_details .buttons .addthis_toolbox{border-radius:4px;overflow:hidden}#fancybox_info .image_details .buttons .addthis_toolbox img,#fancybox_video .image_details .buttons .addthis_toolbox img{height:37px !important;width:auto !important}@media (min-width: 1024px), print{#fancybox_info .image_details .buttons .addthis_toolbox img,#fancybox_video .image_details .buttons .addthis_toolbox img{height:38px !important}}#fancybox_info .image_details .buttons .close_button,#fancybox_video .image_details .buttons .close_button{margin-left:12px}#fancybox_info .image_details .buttons a.button,#fancybox_video .image_details .buttons a.button{padding-left:16px;padding-right:16px}#fancybox_info .image_details .buttons .addthis_toolbox,#fancybox_info .image_details .buttons a.button,#fancybox_video .image_details .buttons .addthis_toolbox,#fancybox_video .image_details .buttons a.button{float:left;margin-left:0;margin-right:12px}@media (min-width: 1024px), print{#fancybox_info .image_details .buttons .addthis_toolbox,#fancybox_info .image_details .buttons a.button,#fancybox_video .image_details .buttons .addthis_toolbox,#fancybox_video .image_details .buttons a.button{float:right;margin-left:12px;margin-right:0}}@media (min-width: 1024px), print{#fancybox_info .image_details .buttons .addthis_toolbox,#fancybox_info .image_details .buttons a.button,#fancybox_info .image_details .buttons .close_button,#fancybox_video .image_details .buttons .addthis_toolbox,#fancybox_video .image_details .buttons a.button,#fancybox_video .image_details .buttons .close_button{margin-bottom:12px}}#fancybox_info .close_button,#fancybox_video .close_button{padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0px;background-size:300px;z-index:8060;position:relative;display:block;float:right}#fancybox_info .close_button:hover,#fancybox_info .close_button.active,#fancybox_video .close_button:hover,#fancybox_video .close_button.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0px;background-size:300px}figure{margin-bottom:1em;max-width:100%}@media (min-width: 769px), print{figure{margin-bottom:2em}}figure figcaption,figure figcaption p{margin-top:.8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{figure figcaption,figure figcaption p{font-size:.88em}}.explore_overlay_page figcaption,.explore_overlay_page figcaption p{color:#b0b4b9}@media (max-width: 480px){figure.lede.full_width{width:100%}figure.lede.full_width figcaption{margin-left:auto;margin-right:auto}}#secondary_column aside figure{margin-bottom:1em}#secondary_column aside figure figcaption{margin-bottom:0}.inline_caption{margin-top:.8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.inline_caption{font-size:.88em}}.content_page #page_header{margin-bottom:1.5em}@media (min-width: 769px), print{.content_page #page_header{margin-bottom:2em}}.content_page #page_header .author{margin:.5em 0 1.8em}.content_page #page_header .crumb+.crumb:before{font-size:1.3em;color:#257cdf;content:'\\a0\\203a\\a0'}.content_page.event_page h1,.content_page.event_page h2,.content_page.event_page h3,.content_page.event_page h4,.content_page.event_page h5{margin:0}.content_page .release_date{font-size:1em;color:#222;text-transform:none}.content_page .category_title,.content_page .homepage_carousel .floating_text_area .category_title,.homepage_carousel .floating_text_area .content_page .category_title{color:#222}.content_page .category_title a,.content_page .homepage_carousel .floating_text_area .category_title a,.homepage_carousel .floating_text_area .content_page .category_title a{color:#257cdf}.content_page .audio_player{margin-top:2rem;margin-bottom:2rem}.content_page .main_feature .master-slider,.content_page .jpl_carousel .master-slider{width:100%;height:300px}@media (min-width: 600px), print{.content_page .main_feature .master-slider,.content_page .jpl_carousel .master-slider{height:400px}}.content_page .main_feature .master-slider .gradient_container_bottom,.content_page .jpl_carousel .master-slider .gradient_container_bottom{height:80px}.content_page .main_feature .master-slider .ms-nav-next,.content_page .main_feature .master-slider .ms-nav-prev,.content_page .jpl_carousel .master-slider .ms-nav-next,.content_page .jpl_carousel .master-slider .ms-nav-prev{display:none}@media (min-width: 769px), print{.content_page .main_feature .master-slider .ms-nav-next,.content_page .main_feature .master-slider .ms-nav-prev,.content_page .jpl_carousel .master-slider .ms-nav-next,.content_page .jpl_carousel .master-slider .ms-nav-prev{display:block}}.content_page .main_feature .master-slider .ms-bullets,.content_page .jpl_carousel .master-slider .ms-bullets{bottom:30px}.content_page .main_feature .master-slider .ms-bullets-count,.content_page .jpl_carousel .master-slider .ms-bullets-count{right:-50%;position:absolute}.content_page .main_feature .master-slider .ms-bullet,.content_page .jpl_carousel .master-slider .ms-bullet{background-color:white;background-image:none;border-radius:50% 50% 50% 50%;height:10px;width:10px;opacity:0.5;margin:0 10px}.content_page .main_feature .master-slider .ms-bullet:hover,.content_page .main_feature .master-slider .ms-bullet.ms-bullet-selected,.content_page .jpl_carousel .master-slider .ms-bullet:hover,.content_page .jpl_carousel .master-slider .ms-bullet.ms-bullet-selected{opacity:1.0}.content_page #primary_column{margin-bottom:5.26316%}@media (min-width: 600px), print{.content_page #primary_column{width:61.53846%;float:left;margin-right:2.5641%;margin-bottom:0}}@media (min-width: 769px), print{.content_page #primary_column{width:64.40678%;float:left;margin-right:1.69492%}}@media (min-width: 1024px), print{.content_page #primary_column{width:61.86441%;float:left;margin-right:1.69492%}}@media (min-width: 1200px){.content_page #primary_column{width:59.32203%;float:left;margin-right:1.69492%}}@media (min-width: 600px), print{.content_page #secondary_column{width:35.89744%;float:right;margin-right:0}}@media (min-width: 769px), print{.content_page #secondary_column{width:32.20339%;float:right;margin-right:0}}.content_page.full_width #primary_column,.content_page.full_width #secondary_column{width:100%}.content_page.feature{padding:2em 0 5.3em}.content_page.feature #secondary_column{display:none}.content_page.feature #primary_column{width:64.40678%;float:left;margin-right:1.69492%;margin:auto;padding:1em 0 5.3em;float:none}.content_page a[name]:not([href]){top:-58px px;visibility:hidden}@media (min-width: 769px), print{.content_page a[name]:not([href]){top:-80px}}@media (min-width: 1024px), print{.content_page a[name]:not([href]){top:-84px}}@media (min-width: 1200px){.content_page a[name]:not([href]){top:-92px}}@media (min-width: 1700px){.content_page a[name]:not([href]){top:-98px}}.content_page #on_this_page_column{width:18%;float:left;margin-right:4%;display:none;z-index:1}@media (min-width: 769px), print{.content_page #on_this_page_column{display:block}}.content_page .mb_section_anchor,.content_page .mb_anchor{top:-58px px;visibility:hidden}@media (min-width: 769px), print{.content_page .mb_section_anchor,.content_page .mb_anchor{top:-80px}}@media (min-width: 1024px), print{.content_page .mb_section_anchor,.content_page .mb_anchor{top:-84px}}@media (min-width: 1200px){.content_page .mb_section_anchor,.content_page .mb_anchor{top:-92px}}#secondary_column>:first-child{margin-top:0}#secondary_column{word-wrap:break-word}#secondary_column aside{margin-bottom:7.14286%}#secondary_column aside:last-child{margin-bottom:0}#secondary_column aside.boxed{border:1px solid #C1C1C1;padding:5.26316%}#secondary_column aside.none{border:0;padding:0}#secondary_column aside>:first-child{margin-top:0}#secondary_column aside>:last-child{margin-bottom:0}#secondary_column aside.links_module li{margin-bottom:.5em}#secondary_column aside.downloads_module .download{margin-bottom:1em}#secondary_column aside.downloads_module .download:last-of-type{margin-bottom:0}#secondary_column aside.downloads_module .button{margin-top:1em}#secondary_column aside.downloads_module .photojournal{margin:2.2em 0 1.5em 0;font-weight:500}#secondary_column aside.list_view_module a{text-decoration:none}#secondary_column aside.list_view_module ul{margin-bottom:1.5em}#secondary_column aside.list_view_module li{padding:.6em 0}#secondary_column aside.list_view_module li:last-child{padding-bottom:0}#secondary_column aside.list_view_module .list_image{float:right;margin-left:4%;margin-bottom:.5em;width:32%}@media (min-width: 600px), print{#secondary_column aside.list_view_module .list_image{margin-left:0;margin-bottom:0;float:left;width:31.03448%;float:left;margin-right:3.44828%}}@media (min-width: 600px), print{#secondary_column aside.list_view_module .list_text{width:65.51724%;float:right;margin-right:0}}#secondary_column aside.list_view_module .list_title{letter-spacing:-.01em;font-weight:700}#secondary_column aside.list_view_module .list_title:hover{color:#222}#secondary_column aside.sig_events_module h4{margin-bottom:1em}#secondary_column aside.sig_events_module h4:last-child{margin-bottom:0}#secondary_column aside.sig_events_module ul{margin-bottom:0}#secondary_column aside.sig_events_module ul li{margin-bottom:.5em}#secondary_column .inline_image{margin-bottom:7.14286%}#secondary_column .inline_image .inline_caption{display:block;margin-top:.8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{#secondary_column .inline_image .inline_caption{font-size:.88em}}#secondary_column .related_content_module{margin:0 0 7.14286% 0;padding:5.26316%;width:100%;border:1px solid #bebebe}#secondary_column .related_content_module li{width:100%;border-bottom:1px solid #bebebe}#secondary_column .related_content_module li:last-child{border-bottom:none;padding-bottom:0}#secondary_column .related_content_module li:first-child{border-top:none}#secondary_column .related_content_module>:last-child{margin-bottom:0}.insight_page a{color:#4A97E1}.event_category{background-color:#DDD;width:auto;display:inline-block;padding:.1em .3em;margin-bottom:.6em;font-weight:700;margin-top:.6em}.on_this_page_nav h4{color:#999;font-size:.74rem;text-transform:uppercase;margin-bottom:.7rem}.on_this_page_nav li{margin-bottom:0.4rem}.on_this_page_nav li a{cursor:pointer;color:#212121;font-weight:500;font-size:.9rem;display:inline-block;line-height:1.2}@media (min-width: 1200px){.on_this_page_nav li a{font-size:.97rem}}img.raw_thumbnail{width:auto}a.main_image_enlarge,a.inline_image_enlarge,.image_enlarge{display:block;position:relative;height:100%}a.main_image_enlarge .enlarge_icon,a.inline_image_enlarge .enlarge_icon,.image_enlarge .enlarge_icon{position:absolute;border-radius:6px;border:1px solid rgba(200,200,200,0.8);left:15px;bottom:15px;width:40px;height:40px;background-color:rgba(0,0,0,0.5);background-image:url(\"https://mars.nasa.gov/assets/zoom_icon.png\");background-size:50%;background-repeat:no-repeat;background-position:50%;opacity:0;transition:opacity 0.2s ease-in}a.main_image_enlarge:hover .enlarge_icon,a.inline_image_enlarge:hover .enlarge_icon,.image_enlarge:hover .enlarge_icon{opacity:0.8}body #fancybox-lock{z-index:200000}.article_nav{display:none}@media (min-width: 1024px), print{.article_nav{display:block;position:relative;z-index:11}.article_nav .article_nav_block{position:fixed;height:86px;display:inline-block;top:42.5%}.article_nav .article_nav_block .link_box{width:40px;background-color:#e4e9ef;display:inline;height:100%}.article_nav .article_nav_block .article_details{display:inline;width:250px;background-color:#FFF;text-decoration:none;color:#000;padding:10px;background-color:#e4e9ef}.article_nav .article_nav_block .article_details .img{margin-bottom:6px}.article_nav .article_nav_block .article_details .title{font-weight:700;font-size:.9em}.article_nav .article_nav_block.prev{left:0}.article_nav .article_nav_block.prev .link_box{float:left}.article_nav .article_nav_block.prev .article_details{float:left;display:none}.article_nav .article_nav_block.next{right:0}.article_nav .article_nav_block.next .link_box{float:right}.article_nav .article_nav_block.next .article_details{display:none;float:right}.no-touchevents .article_nav .article_nav_block:hover .article_details{display:block}}.feature_pages{padding:1em 0 3.8em}.feature_pages #page_header{width:94%;max-width:600px;margin-left:auto;margin-right:auto}@media (min-width: 769px), print{.feature_pages #page_header{width:80%}}@media (min-width: 1200px){.feature_pages #page_header{width:55%}}.feature_pages #on_this_page_column{display:none}@media (min-width: 1024px), print{.feature_pages #on_this_page_column{display:block;width:16%;margin-left:8px;position:absolute;z-index:1}}@media (min-width: 1200px){.feature_pages #on_this_page_column{margin-left:4%}}.feature_pages #on_this_page_column .on_this_page_nav{display:none}.feature_pages #primary_column{width:100%;margin:0}.feature_pages .wysiwyg_content>*{width:94%;max-width:600px;margin-left:auto;margin-right:auto}@media (min-width: 769px), print{.feature_pages .wysiwyg_content>*{width:80%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content>*{width:55%}}.feature_pages .wysiwyg_content p{font-size:18px;line-height:28px}@media (min-width: 769px), print{.feature_pages .wysiwyg_content p{font-size:19px;line-height:30px}}.feature_pages .wysiwyg_content>ul:not(.item_list_module):not(.item_grid_module),.feature_pages .wysiwyg_content>ol{list-style-position:outside;padding-left:1em}.feature_pages .wysiwyg_content>ul:not(.item_list_module):not(.item_grid_module) ul,.feature_pages .wysiwyg_content>ul:not(.item_list_module):not(.item_grid_module) ol,.feature_pages .wysiwyg_content>ol ul,.feature_pages .wysiwyg_content>ol ol{list-style-position:outside}.top_feature_area{text-align:center;position:relative}.top_feature_area .header_overlay{position:absolute;width:100%;padding:0 1%;top:46%;color:white;transform:translateY(-50%)}@media (min-width: 769px), print{.top_feature_area .header_overlay{padding:0 4%}}.top_feature_area .header_overlay .article_title{font-size:1.2em;margin-bottom:0}@media (min-width: 480px){.top_feature_area .header_overlay .article_title{font-size:1.6em}}@media (min-width: 600px), print{.top_feature_area .header_overlay .article_title{font-size:1.9em}}@media (min-width: 769px), print{.top_feature_area .header_overlay .article_title{font-size:2.2em}}@media (min-width: 1024px), print{.top_feature_area .header_overlay .article_title{font-size:2.8em}}@media (min-width: 1200px){.top_feature_area .header_overlay .article_title{font-size:3.2em}}@media (min-width: 1700px){.top_feature_area .header_overlay .article_title{font-size:3.4em}}.top_feature_area .header_overlay .sub_title{font-size:1.2em}@media (min-width: 480px){.top_feature_area .header_overlay .sub_title{font-size:1.5em}}@media (min-width: 769px), print{.top_feature_area .header_overlay .sub_title{font-size:1.9em}}.top_feature_area .header_overlay .author{padding:0.2em 0.5em 0.5em 0.6em;background-color:rgba(0,0,0,0.5);margin:0.2em auto 1em;display:inline-block}@media (min-width: 480px){.top_feature_area .header_overlay .author{margin-top:0.4em}}@media (min-width: 600px), print{.top_feature_area .header_overlay .author{margin-top:0.7em}}@media (min-width: 769px), print{.top_feature_area .header_overlay .author{padding:0.3em 0.5em 0.5em 0.7em;max-width:360px;margin-top:1em}}@media (min-width: 1024px), print{.top_feature_area .header_overlay .author{padding:0.4em 0.6em 0.6em 0.8em;max-width:400px;margin-top:1.5em}}@media (min-width: 1200px){.top_feature_area .header_overlay .author{margin-top:1.8em}}.top_feature_area .header_overlay .author p{color:white;margin:0;font-size:0.8em}@media (min-width: 769px), print{.top_feature_area .header_overlay .author p{font-size:0.95em}}.top_feature_area .article_title{margin-bottom:0.9em}.top_feature_area .category_title,.top_feature_area .homepage_carousel .floating_text_area .category_title,.homepage_carousel .floating_text_area .top_feature_area .category_title{color:#707070;margin-bottom:1em}.top_feature_area a.category_title,.top_feature_area .homepage_carousel .floating_text_area a.category_title,.homepage_carousel .floating_text_area .top_feature_area a.category_title{color:#257cdf}.top_feature_area .feature_header:first-child{width:94%;max-width:600px;margin-left:auto;margin-right:auto;padding:3em 0 1.7em}@media (min-width: 769px), print{.top_feature_area .feature_header:first-child{width:80%}}@media (min-width: 1200px){.top_feature_area .feature_header:first-child{width:55%}}@media (min-width: 480px){.top_feature_area .feature_header:first-child{padding:4em 0 2em}}.top_feature_area .feature_header:first-child:after{content:\"\";display:block;height:1px;width:56%;border-bottom:5px solid;max-width:200px;margin:1.7em auto 0.3em}.top_feature_area .feature_header.no_main_image{padding-bottom:.9em}.top_feature_area .release_date{text-transform:none;color:#222;margin-left:0.1em}.top_feature_area .header_overlay+.feature_header{width:94%;max-width:600px;margin-left:auto;margin-right:auto;text-align:left}@media (min-width: 769px), print{.top_feature_area .header_overlay+.feature_header{width:80%}}@media (min-width: 1200px){.top_feature_area .header_overlay+.feature_header{width:55%}}.top_feature_area figure.lede.full_width figcaption{margin:.8em;text-align:left;font-size:1em}span.mb_anchor_title{display:block;position:relative;height:0;visibility:hidden}span.mb_anchor_title a.mb_anchor{position:absolute}@media not print{p span.mb_anchor_title:first-child:last-child{margin-top:-1em}}.feature_pages .wysiwyg_content .mb_expand{width:100%;max-width:none}.feature_pages .wysiwyg_content .mb_expand .expandable_element_link{width:94%;max-width:600px;margin-left:auto;margin-right:auto;display:block}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .mb_expand .expandable_element_link{width:80%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .mb_expand .expandable_element_link{width:55%}}.feature_pages .wysiwyg_content .mb_expand .expandable_element{display:none;max-width:none;width:100%}.feature_pages .wysiwyg_content .mb_expand .expandable_element>*{width:94%;max-width:600px;margin-left:auto;margin-right:auto}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .mb_expand .expandable_element>*{width:80%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .mb_expand .expandable_element>*{width:55%}}.countdown .unit{font-weight:300;display:inline-block;position:relative;padding:0 9px 0 0;vertical-align:middle;text-align:center}.countdown .unit+.unit:before{content:\" : \";position:absolute;left:-7px;top:-3px}.countdown .unit:first-of-type{padding-left:0}.countdown .unit:last-of-type{padding-right:0}.countdown .unit span{font-weight:600;padding:0 1em;clear:both;display:block;font-size:11px;text-transform:uppercase;text-align:center;margin-bottom:.3rem}.countdown .completed{font-size:1.8em;font-weight:300;margin-top:3px}.feature_pages .countdown,.content_page .countdown{border-top:1px solid #E8E8E8;border-bottom:1px solid #E8E8E8;text-align:center;padding:0.7em 0 0.9em;margin-top:2.7em;margin-bottom:2.7em}.feature_pages .countdown>div,.content_page .countdown>div{display:inline-block;vertical-align:middle}.feature_pages #primary_column .countdown_header,.content_page #primary_column .countdown_header{margin-right:.8em;margin-left:.8em}.feature_pages .countdown_title,.content_page .countdown_title{width:100%}@media (min-width: 600px), print{.feature_pages .countdown_title,.content_page .countdown_title{width:auto;margin-right:.8em}}#secondary_column .countdown{white-space:normal;display:block;margin-bottom:7.14286%;text-align:left}#secondary_column .countdown .countdown_header{display:block}#secondary_column .countdown .countdown_title{margin-right:0;width:100%;text-align:left}#secondary_column .countdown .countdown_end{text-align:left}#explore_overlay .countdown{border-top-color:#212121;border-bottom-color:#212121}.curtain_module{margin:3em 0;clear:both}.curtain_module .curtain_caption_container{background-color:#eee;padding:1em}.curtain_module .curtain_title{margin:0 0 .5em 0}.curtain_module .curtain_subtitle{color:#777777;margin:0 0 0.5em 0}.feature_pages .curtain_module{width:94%;max-width:100%;margin:3em auto;float:none}@media (min-width: 600px), print{.feature_pages .curtain_module{max-width:600px}}.feature_pages .curtain_module.full-bleed,.feature_pages .curtain_module.full_width,.feature_pages .curtain_module.wide,.feature_pages .curtain_module.parallax{clear:both}@media (min-width: 600px), print{.feature_pages .curtain_module.full-bleed,.feature_pages .curtain_module.full_width,.feature_pages .curtain_module.wide,.feature_pages .curtain_module.parallax{margin-top:5em;margin-bottom:5em}}.feature_pages .curtain_module.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.feature_pages .curtain_module.column-width{max-width:600px}}.feature_pages .curtain_module.full-bleed{width:100%;max-width:none}.feature_pages .curtain_module.full-bleed figcaption{margin:.8em .8em 0 .8em}.feature_pages .curtain_module.full_width{clear:both}@media (min-width: 769px), print{.feature_pages .curtain_module.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.feature_pages .curtain_module.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.feature_pages .curtain_module.full_width{width:55%}}.feature_pages .curtain_module.wide{width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .curtain_module.wide{width:95%}}@media (min-width: 769px), print{.feature_pages .curtain_module.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .curtain_module.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .curtain_module.column-width{max-width:calc(600px + 15%)}}.feature_pages .curtain_module.left,.feature_pages .curtain_module.right{max-width:94%}@media (min-width: 600px), print{.feature_pages .curtain_module.left,.feature_pages .curtain_module.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.feature_pages .curtain_module.left,.feature_pages .curtain_module.right{width:27%;max-width:27%}}@media (min-width: 1700px){.feature_pages .curtain_module.left,.feature_pages .curtain_module.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.feature_pages .curtain_module.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.feature_pages .curtain_module.left{margin-left:15%}}@media (min-width: 1700px){.feature_pages .curtain_module.left{margin-left:20%}}@media (min-width: 480px){.feature_pages .curtain_module.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.feature_pages .curtain_module.right{margin-right:15%}}@media (min-width: 1700px){.feature_pages .curtain_module.right{margin-right:20%}}.feature_pages .curtain_module.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.feature_pages .curtain_module.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.feature_pages .curtain_module.parallax_module .caption{font-size:.88em}}.feature_pages .curtain_module.parallax_module img{height:auto !important}.feature_pages .curtain_module.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.feature_pages .curtain_module.parallax_module .window.mobile{height:auto;min-height:100%}.feature_pages .curtain_module.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.feature_pages .curtain_module.parallax_module .window .featured_image{position:absolute}}.explore_overlay_page .curtain_module .curtain_caption_container{background-color:#232323}.wysiwyg_content .related_content_module,#secondary_column .related_content_module{font-weight:700}.wysiwyg_content .related_content_module ul,#secondary_column .related_content_module ul{margin:0}.wysiwyg_content .related_content_module li,#secondary_column .related_content_module li{padding:1em 0;border-bottom:1px solid #E5E5E5}.wysiwyg_content .related_content_module li:first-child,#secondary_column .related_content_module li:first-child{border-top:1px solid #E5E5E5}.wysiwyg_content .related_content_module .module_title,#secondary_column .related_content_module .module_title{font-size:1.2em;text-align:left;margin-top:0}.wysiwyg_content .related_content_module .list_image,#secondary_column .related_content_module .list_image{width:25%;display:inline-block}.wysiwyg_content .related_content_module .list_image+.list_text,#secondary_column .related_content_module .list_image+.list_text{width:67%;position:relative;display:inline-block;margin-left:4%;vertical-align:middle}.wysiwyg_content .related_content_module{max-width:100%;margin-top:1.4em;margin-bottom:1.4em}@media (min-width: 769px), print{.wysiwyg_content .related_content_module{margin-top:2em;margin-bottom:2em}}.wysiwyg_content .related_content_module.left,.wysiwyg_content .related_content_module.right{float:none}@media (min-width: 480px){.wysiwyg_content .related_content_module.left,.wysiwyg_content .related_content_module.right{max-width:50%}}@media (min-width: 1200px){.wysiwyg_content .related_content_module.left,.wysiwyg_content .related_content_module.right{max-width:40%}}@media (min-width: 480px){.wysiwyg_content .related_content_module.left{float:left;margin:1em 2.5em 1.5em 0}}@media (min-width: 480px){.wysiwyg_content .related_content_module.right{float:right;margin:1em 0 1.5em 2.5em}}.wysiwyg_content .related_content_module.full-bleed,.wysiwyg_content .related_content_module.full_width,.wysiwyg_content .related_content_module.wide,.wysiwyg_content .related_content_module.parallax,.wysiwyg_content .related_content_module.column-width{clear:both}.wysiwyg_content .related_content_module.parallax_module{width:100%;position:relative}.wysiwyg_content .related_content_module.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.wysiwyg_content .related_content_module.parallax_module .caption{font-size:.88em}}.explore_overlay_page .wysiwyg_content .related_content_module.parallax_module .caption{color:#b0b4b9}.wysiwyg_content .related_content_module .sidebar_title,.wysiwyg_content #secondary_column .related_content_module .module_title,#secondary_column .wysiwyg_content .related_content_module .module_title,.wysiwyg_content .right_col .related_content_module .module_title,.right_col .wysiwyg_content .related_content_module .module_title{margin-top:0;font-size:1.5em}.wysiwyg_content .related_content_module.full_width{border:1px solid #D2D2D2;padding:5.26316%}@media (min-width: 600px), print{.wysiwyg_content .related_content_module.full_width{padding:2em}}.wysiwyg_content .related_content_module.full_width li{width:100%}.wysiwyg_content .related_content_module.full_width li:first-child{border-top:none}.wysiwyg_content .related_content_module.full_width li:last-child{border-bottom:transparent 0;padding-bottom:0}.wysiwyg_content .related_content_module.full_width .module_title{margin-top:0;font-size:1.5em}.feature_pages .wysiwyg_content .related_content_module{width:94%;max-width:100%;margin:3em auto;float:none}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .related_content_module{max-width:600px}}.feature_pages .wysiwyg_content .related_content_module.full-bleed,.feature_pages .wysiwyg_content .related_content_module.full_width,.feature_pages .wysiwyg_content .related_content_module.wide,.feature_pages .wysiwyg_content .related_content_module.parallax{clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .related_content_module.full-bleed,.feature_pages .wysiwyg_content .related_content_module.full_width,.feature_pages .wysiwyg_content .related_content_module.wide,.feature_pages .wysiwyg_content .related_content_module.parallax{margin-top:5em;margin-bottom:5em}}.feature_pages .wysiwyg_content .related_content_module.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .related_content_module.column-width{max-width:600px}}.feature_pages .wysiwyg_content .related_content_module.full-bleed{width:100%;max-width:none}.feature_pages .wysiwyg_content .related_content_module.full-bleed figcaption{margin:.8em .8em 0 .8em}.feature_pages .wysiwyg_content .related_content_module.full_width{clear:both}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .related_content_module.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.feature_pages .wysiwyg_content .related_content_module.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.feature_pages .wysiwyg_content .related_content_module.full_width{width:55%}}.feature_pages .wysiwyg_content .related_content_module.wide{width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .related_content_module.wide{width:95%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .related_content_module.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .related_content_module.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .related_content_module.column-width{max-width:calc(600px + 15%)}}.feature_pages .wysiwyg_content .related_content_module.left,.feature_pages .wysiwyg_content .related_content_module.right{max-width:94%}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .related_content_module.left,.feature_pages .wysiwyg_content .related_content_module.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .related_content_module.left,.feature_pages .wysiwyg_content .related_content_module.right{width:27%;max-width:27%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .related_content_module.left,.feature_pages .wysiwyg_content .related_content_module.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .related_content_module.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .related_content_module.left{margin-left:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .related_content_module.left{margin-left:20%}}@media (min-width: 480px){.feature_pages .wysiwyg_content .related_content_module.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .related_content_module.right{margin-right:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .related_content_module.right{margin-right:20%}}.feature_pages .wysiwyg_content .related_content_module.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.feature_pages .wysiwyg_content .related_content_module.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .related_content_module.parallax_module .caption{font-size:.88em}}.feature_pages .wysiwyg_content .related_content_module.parallax_module img{height:auto !important}.feature_pages .wysiwyg_content .related_content_module.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.feature_pages .wysiwyg_content .related_content_module.parallax_module .window.mobile{height:auto;min-height:100%}.feature_pages .wysiwyg_content .related_content_module.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .related_content_module.parallax_module .window .featured_image{position:absolute}}.feature_pages .wysiwyg_content .related_content_module .module_title{margin-bottom:0.8em}.vital_signs .related_content_module{font-weight:normal;margin-bottom:1em}.vital_signs .related_content_module li{border:none;padding:0.4em 0;font-size:0.9em}.vital_signs .related_content_module .module_title{font-size:1.2em;margin-bottom:.4em}.vital_signs .related_content_module .list_image{display:none}.vital_signs .related_content_module .list_text{width:100%;float:none;margin-left:10px}.vital_signs .related_content_module .list_text:before{content:\"›\";color:#42a0f2;margin-left:-10px}.explore_overlay_page .related_content_module.full_width{border-color:#353535}.explore_overlay_page .related_content_module ul li{border-bottom:1px solid #212121}.explore_overlay_page .related_content_module ul li:first-child{border-top:1px solid #212121}.carousel_module_container{width:100%;max-width:100%;margin-top:1.4em;margin-bottom:1.4em;clear:both}@media (min-width: 769px), print{.carousel_module_container{margin-top:2em;margin-bottom:2em}}.carousel_module_container.left,.carousel_module_container.right{float:none}@media (min-width: 480px){.carousel_module_container.left,.carousel_module_container.right{max-width:50%}}@media (min-width: 1200px){.carousel_module_container.left,.carousel_module_container.right{max-width:40%}}@media (min-width: 480px){.carousel_module_container.left{float:left;margin:1em 2.5em 1.5em 0}}@media (min-width: 480px){.carousel_module_container.right{float:right;margin:1em 0 1.5em 2.5em}}.carousel_module_container.full-bleed,.carousel_module_container.full_width,.carousel_module_container.wide,.carousel_module_container.parallax,.carousel_module_container.column-width{clear:both}.carousel_module_container.parallax_module{width:100%;position:relative}.carousel_module_container.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.carousel_module_container.parallax_module .caption{font-size:.88em}}.explore_overlay_page .carousel_module_container.parallax_module .caption{color:#b0b4b9}.carousel_module_container:last-child{margin-bottom:0}.carousel_module_container .over_carousel_header .module_title{margin-top:0}.carousel_module_container .carousel_module{height:275px;width:100%}.carousel_module_container .carousel_module .gradient_container_top{display:none}.carousel_module_container .carousel_module.medium_mid{height:500px}.carousel_module_container .carousel_module.medium_large,.carousel_module_container .carousel_module.large{height:600px}.carousel_module_container .carousel_module.xlarge{height:700px}.carousel_module_container .carousel_module.xxlarge{height:750px}.carousel_module_container .carousel_module .master-slider{width:100%;height:100%}.carousel_module_container .carousel_module .floating_text_area header{position:relative;margin-bottom:0;padding:0 22px}.carousel_module_container .carousel_module .floating_text_area header:after{background:url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat;content:\"\";position:absolute;right:0;top:.9em;background-size:12px;height:7.5px;width:12px}.carousel_module_container .carousel_module .media_feature_title{color:white;font-size:1.4em;margin:0;padding-right:24px}.carousel_module_container .carousel_module .media_feature_title a{color:white;text-decoration:none}.carousel_module_container .carousel_module .media_feature_title:hover{cursor:pointer}.carousel_module_container .carousel_module .media_feature_title:after{background:url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat;content:\"\";margin-left:14px;background-size:12px;height:7.5px;width:12px;display:inline-block;margin-right:-24px}.carousel_module_container .carousel_module .media_feature_title.hide_expand_arrow{cursor:default}.carousel_module_container .carousel_module .media_feature_title.hide_expand_arrow:after{display:none}.carousel_module_container .carousel_module .subtitle{font-size:1.1em;margin:0.4em 0 .4em}.carousel_module_container .carousel_module .description{display:block;max-height:130px;overflow-y:auto}.carousel_module_container .carousel_module .description::-webkit-scrollbar{width:6px}.carousel_module_container .carousel_module .description::-webkit-scrollbar-thumb{background-color:rgba(107,107,107,0.6)}.carousel_module_container .carousel_module .description::-webkit-scrollbar-track{background-color:rgba(157,157,157,0.4)}.carousel_module_container .carousel_module .description a{color:#69B9FF}.carousel_module_container .carousel_module .description p{color:inherit}.carousel_module_container .carousel_module .description .more_link{margin-top:0.4rem;margin-bottom:.5rem;display:block}.carousel_module_container .carousel_module.medium_large .description,.carousel_module_container .carousel_module.large .description,.carousel_module_container .carousel_module.xlarge .description,.carousel_module_container .carousel_module.xxlarge .description{max-height:none;overflow:hidden;margin-bottom:0;display:none}.carousel_module_container .carousel_module.medium_large .floating_text_area.open header,.carousel_module_container .carousel_module.large .floating_text_area.open header,.carousel_module_container .carousel_module.xlarge .floating_text_area.open header,.carousel_module_container .carousel_module.xxlarge .floating_text_area.open header{margin-bottom:.7em}.carousel_module_container .carousel_module.medium_large .floating_text_area.open header .media_feature_title:after,.carousel_module_container .carousel_module.large .floating_text_area.open header .media_feature_title:after,.carousel_module_container .carousel_module.xlarge .floating_text_area.open header .media_feature_title:after,.carousel_module_container .carousel_module.xxlarge .floating_text_area.open header .media_feature_title:after{transform:rotate(180deg)}.carousel_module_container .carousel_module.small .floating_text_area,.carousel_module_container .carousel_module.medium .floating_text_area,.carousel_module_container .carousel_module.medium_mid .floating_text_area{background:linear-gradient(transparent, rgba(0,0,0,0.6));background-size:100%;background-repeat:no-repeat;background-position:bottom}.carousel_module_container .carousel_module.small header,.carousel_module_container .carousel_module.medium header,.carousel_module_container .carousel_module.medium_mid header{cursor:pointer;margin-bottom:.4em}.carousel_module_container .carousel_module.small .description,.carousel_module_container .carousel_module.medium .description,.carousel_module_container .carousel_module.medium_mid .description{display:none;cursor:pointer}.carousel_module_container .carousel_module.small .media_feature_title:after,.carousel_module_container .carousel_module.medium .media_feature_title:after,.carousel_module_container .carousel_module.medium_mid .media_feature_title:after{display:none}.carousel_module_container .carousel_module.small .gradient_container_bottom,.carousel_module_container .carousel_module.medium .gradient_container_bottom,.carousel_module_container .carousel_module.medium_mid .gradient_container_bottom{display:none}.carousel_module_container .carousel_module .floating_text_area{width:100%;padding:2em 1.4em 2.8em;bottom:0;text-align:center;margin-left:auto;margin-right:auto;color:white}.carousel_module_container .carousel_module.medium_large .floating_text_area,.carousel_module_container .carousel_module.large .floating_text_area,.carousel_module_container .carousel_module.xlarge .floating_text_area,.carousel_module_container .carousel_module.xxlarge .floating_text_area{padding:1.4em;text-align:left;bottom:5em;background-color:black;width:auto;max-width:500px}.carousel_module_container .carousel_module.medium_large .floating_text_area.left,.carousel_module_container .carousel_module.medium_large .floating_text_area.bottom_left,.carousel_module_container .carousel_module.large .floating_text_area.left,.carousel_module_container .carousel_module.large .floating_text_area.bottom_left,.carousel_module_container .carousel_module.xlarge .floating_text_area.left,.carousel_module_container .carousel_module.xlarge .floating_text_area.bottom_left,.carousel_module_container .carousel_module.xxlarge .floating_text_area.left,.carousel_module_container .carousel_module.xxlarge .floating_text_area.bottom_left{left:5%}.carousel_module_container .carousel_module.medium_large .floating_text_area.right,.carousel_module_container .carousel_module.medium_large .floating_text_area.bottom_right,.carousel_module_container .carousel_module.large .floating_text_area.right,.carousel_module_container .carousel_module.large .floating_text_area.bottom_right,.carousel_module_container .carousel_module.xlarge .floating_text_area.right,.carousel_module_container .carousel_module.xlarge .floating_text_area.bottom_right,.carousel_module_container .carousel_module.xxlarge .floating_text_area.right,.carousel_module_container .carousel_module.xxlarge .floating_text_area.bottom_right{right:5%}.carousel_module_container .carousel_module.medium_large .floating_text_area header,.carousel_module_container .carousel_module.large .floating_text_area header,.carousel_module_container .carousel_module.xlarge .floating_text_area header,.carousel_module_container .carousel_module.xxlarge .floating_text_area header{padding:0}.carousel_module_container .carousel_module.medium_large .floating_text_area header:after,.carousel_module_container .carousel_module.large .floating_text_area header:after,.carousel_module_container .carousel_module.xlarge .floating_text_area header:after,.carousel_module_container .carousel_module.xxlarge .floating_text_area header:after{content:none}.carousel_module_container .carousel_module .floating_text_area.open header:after{transform:rotate(180deg)}.carousel_module_container .carousel_module .ms-nav-prev,.carousel_module_container .carousel_module .ms-nav-next{margin-top:-40px}.carousel_module_container .carousel_module .ms-slide-bgvideocont{background-color:#000}.carousel_module_container .carousel_module .ms-slide-bgvideocont video{max-width:none}.carousel_module_container .carousel_module .ms-nav-next,.carousel_module_container .carousel_module .ms-nav-prev{display:none}.carousel_module_container .carousel_module.medium_mid .ms-nav-next,.carousel_module_container .carousel_module.medium_mid .ms-nav-prev,.carousel_module_container .carousel_module.medium_large .ms-nav-next,.carousel_module_container .carousel_module.medium_large .ms-nav-prev,.carousel_module_container .carousel_module.large .ms-nav-next,.carousel_module_container .carousel_module.large .ms-nav-prev,.carousel_module_container .carousel_module.xlarge .ms-nav-next,.carousel_module_container .carousel_module.xlarge .ms-nav-prev,.carousel_module_container .carousel_module.xxlarge .ms-nav-next,.carousel_module_container .carousel_module.xxlarge .ms-nav-prev{display:block}.no-touchevents .carousel_module_container .carousel_module.medium .ms-nav-next,.no-touchevents .carousel_module_container .carousel_module.medium .ms-nav-prev,.no-touchevents .carousel_module_container .carousel_module.small .ms-nav-next,.no-touchevents .carousel_module_container .carousel_module.small .ms-nav-prev{display:block}.carousel_module_container .carousel_module .ms-nav-prev,.carousel_module_container .carousel_module .ms-nav-next{width:40px;height:80px;margin-top:-60px}.carousel_module_container .carousel_module .ms-nav-prev{background:url(\"https://mars.nasa.gov/assets/arrow_left_darktheme.png\");background-size:40px 95px;background-color:rgba(32,32,32,0.9);background-position:0;left:0;border-top-right-radius:6px;border-bottom-right-radius:6px}.carousel_module_container .carousel_module .ms-nav-next{background:url(\"https://mars.nasa.gov/assets/arrow_right_darktheme.png\");background-size:40px 95px;background-color:rgba(32,32,32,0.9);background-position:0;right:0;border-top-left-radius:6px;border-bottom-left-radius:6px}.carousel_module_container .carousel_module .ms-bullets{left:0;right:0;margin:0 auto;bottom:1.2em;z-index:10}.carousel_module_container .carousel_module.medium_mid .ms-bullets{bottom:1.5em}.carousel_module_container .carousel_module.medium_large .ms-bullets,.carousel_module_container .carousel_module.large .ms-bullets,.carousel_module_container .carousel_module.xlarge .ms-bullets,.carousel_module_container .carousel_module.xxlarge .ms-bullets{bottom:2.2em}.carousel_module_container .carousel_module .ms-bullet{background-color:white;background-image:none;border-radius:50% 50% 50% 50%;height:8px;width:8px;opacity:0.5;margin:0 10px}.carousel_module_container .carousel_module .ms-bullet:hover{opacity:1.0}.carousel_module_container .carousel_module .ms-bullet-selected{opacity:1.0}.carousel_module_container .carousel_module .ms-slide-layers{left:0 !important}.carousel_module_container .carousel_module .ms-container,.carousel_module_container .carousel_module .ms-slide-layers{max-width:none !important}.feature_pages .wysiwyg_content .carousel_module_container{width:94%;max-width:100%;margin:3em auto;float:none}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .carousel_module_container{max-width:600px}}.feature_pages .wysiwyg_content .carousel_module_container.full-bleed,.feature_pages .wysiwyg_content .carousel_module_container.full_width,.feature_pages .wysiwyg_content .carousel_module_container.wide,.feature_pages .wysiwyg_content .carousel_module_container.parallax{clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .carousel_module_container.full-bleed,.feature_pages .wysiwyg_content .carousel_module_container.full_width,.feature_pages .wysiwyg_content .carousel_module_container.wide,.feature_pages .wysiwyg_content .carousel_module_container.parallax{margin-top:5em;margin-bottom:5em}}.feature_pages .wysiwyg_content .carousel_module_container.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .carousel_module_container.column-width{max-width:600px}}.feature_pages .wysiwyg_content .carousel_module_container.full-bleed{width:100%;max-width:none}.feature_pages .wysiwyg_content .carousel_module_container.full-bleed figcaption{margin:.8em .8em 0 .8em}.feature_pages .wysiwyg_content .carousel_module_container.full_width{clear:both}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .carousel_module_container.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.feature_pages .wysiwyg_content .carousel_module_container.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.feature_pages .wysiwyg_content .carousel_module_container.full_width{width:55%}}.feature_pages .wysiwyg_content .carousel_module_container.wide{width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .carousel_module_container.wide{width:95%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .carousel_module_container.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .carousel_module_container.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .carousel_module_container.column-width{max-width:calc(600px + 15%)}}.feature_pages .wysiwyg_content .carousel_module_container.left,.feature_pages .wysiwyg_content .carousel_module_container.right{max-width:94%}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .carousel_module_container.left,.feature_pages .wysiwyg_content .carousel_module_container.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .carousel_module_container.left,.feature_pages .wysiwyg_content .carousel_module_container.right{width:27%;max-width:27%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .carousel_module_container.left,.feature_pages .wysiwyg_content .carousel_module_container.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .carousel_module_container.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .carousel_module_container.left{margin-left:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .carousel_module_container.left{margin-left:20%}}@media (min-width: 480px){.feature_pages .wysiwyg_content .carousel_module_container.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .carousel_module_container.right{margin-right:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .carousel_module_container.right{margin-right:20%}}.feature_pages .wysiwyg_content .carousel_module_container.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.feature_pages .wysiwyg_content .carousel_module_container.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .carousel_module_container.parallax_module .caption{font-size:.88em}}.feature_pages .wysiwyg_content .carousel_module_container.parallax_module img{height:auto !important}.feature_pages .wysiwyg_content .carousel_module_container.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.feature_pages .wysiwyg_content .carousel_module_container.parallax_module .window.mobile{height:auto;min-height:100%}.feature_pages .wysiwyg_content .carousel_module_container.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .carousel_module_container.parallax_module .window .featured_image{position:absolute}}.explore_overlay_page .carousel_module_container.full_width{width:94%;max-width:100%;margin:3em auto;float:none}@media (min-width: 600px), print{.explore_overlay_page .carousel_module_container.full_width{max-width:600px}}.explore_overlay_page .carousel_module_container.full_width.full-bleed,.explore_overlay_page .carousel_module_container.full_width.full_width,.explore_overlay_page .carousel_module_container.full_width.wide,.explore_overlay_page .carousel_module_container.full_width.parallax{clear:both}@media (min-width: 600px), print{.explore_overlay_page .carousel_module_container.full_width.full-bleed,.explore_overlay_page .carousel_module_container.full_width.full_width,.explore_overlay_page .carousel_module_container.full_width.wide,.explore_overlay_page .carousel_module_container.full_width.parallax{margin-top:5em;margin-bottom:5em}}.explore_overlay_page .carousel_module_container.full_width.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.explore_overlay_page .carousel_module_container.full_width.column-width{max-width:600px}}.explore_overlay_page .carousel_module_container.full_width.full-bleed{width:100%;max-width:none}.explore_overlay_page .carousel_module_container.full_width.full-bleed figcaption{margin:.8em .8em 0 .8em}.explore_overlay_page .carousel_module_container.full_width.full_width{clear:both}@media (min-width: 769px), print{.explore_overlay_page .carousel_module_container.full_width.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.explore_overlay_page .carousel_module_container.full_width.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.explore_overlay_page .carousel_module_container.full_width.full_width{width:55%}}.explore_overlay_page .carousel_module_container.full_width.wide{width:98%;max-width:none}@media (min-width: 769px), print{.explore_overlay_page .carousel_module_container.full_width.wide{width:95%}}@media (min-width: 769px), print{.explore_overlay_page .carousel_module_container.full_width.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.explore_overlay_page .carousel_module_container.full_width.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.explore_overlay_page .carousel_module_container.full_width.column-width{max-width:calc(600px + 15%)}}.explore_overlay_page .carousel_module_container.full_width.left,.explore_overlay_page .carousel_module_container.full_width.right{max-width:94%}@media (min-width: 600px), print{.explore_overlay_page .carousel_module_container.full_width.left,.explore_overlay_page .carousel_module_container.full_width.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.explore_overlay_page .carousel_module_container.full_width.left,.explore_overlay_page .carousel_module_container.full_width.right{width:27%;max-width:27%}}@media (min-width: 1700px){.explore_overlay_page .carousel_module_container.full_width.left,.explore_overlay_page .carousel_module_container.full_width.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.explore_overlay_page .carousel_module_container.full_width.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.explore_overlay_page .carousel_module_container.full_width.left{margin-left:15%}}@media (min-width: 1700px){.explore_overlay_page .carousel_module_container.full_width.left{margin-left:20%}}@media (min-width: 480px){.explore_overlay_page .carousel_module_container.full_width.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.explore_overlay_page .carousel_module_container.full_width.right{margin-right:15%}}@media (min-width: 1700px){.explore_overlay_page .carousel_module_container.full_width.right{margin-right:20%}}.explore_overlay_page .carousel_module_container.full_width.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.explore_overlay_page .carousel_module_container.full_width.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.explore_overlay_page .carousel_module_container.full_width.parallax_module .caption{font-size:.88em}}.explore_overlay_page .carousel_module_container.full_width.parallax_module img{height:auto !important}.explore_overlay_page .carousel_module_container.full_width.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.explore_overlay_page .carousel_module_container.full_width.parallax_module .window.mobile{height:auto;min-height:100%}.explore_overlay_page .carousel_module_container.full_width.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.explore_overlay_page .carousel_module_container.full_width.parallax_module .window .featured_image{position:absolute}}.explore_overlay_page .carousel_module_container.full_width.wide{width:98%;max-width:none}@media (min-width: 769px), print{.explore_overlay_page .carousel_module_container.full_width.wide{width:95%;max-width:1200px}}.wysiwyg_content .image_module{max-width:100%;margin-top:1.4em;margin-bottom:1.4em}@media (min-width: 769px), print{.wysiwyg_content .image_module{margin-top:2em;margin-bottom:2em}}.wysiwyg_content .image_module.left,.wysiwyg_content .image_module.right{float:none}@media (min-width: 480px){.wysiwyg_content .image_module.left,.wysiwyg_content .image_module.right{max-width:50%}}@media (min-width: 1200px){.wysiwyg_content .image_module.left,.wysiwyg_content .image_module.right{max-width:40%}}@media (min-width: 480px){.wysiwyg_content .image_module.left{float:left;margin:1em 2.5em 1.5em 0}}@media (min-width: 480px){.wysiwyg_content .image_module.right{float:right;margin:1em 0 1.5em 2.5em}}.wysiwyg_content .image_module.full-bleed,.wysiwyg_content .image_module.full_width,.wysiwyg_content .image_module.wide,.wysiwyg_content .image_module.parallax,.wysiwyg_content .image_module.column-width{clear:both}.wysiwyg_content .image_module.parallax_module{width:100%;position:relative}.wysiwyg_content .image_module.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.wysiwyg_content .image_module.parallax_module .caption{font-size:.88em}}.explore_overlay_page .wysiwyg_content .image_module.parallax_module .caption{color:#b0b4b9}.feature_pages .wysiwyg_content .image_module{width:94%;max-width:100%;margin:3em auto;float:none}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .image_module{max-width:600px}}.feature_pages .wysiwyg_content .image_module.full-bleed,.feature_pages .wysiwyg_content .image_module.full_width,.feature_pages .wysiwyg_content .image_module.wide,.feature_pages .wysiwyg_content .image_module.parallax{clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .image_module.full-bleed,.feature_pages .wysiwyg_content .image_module.full_width,.feature_pages .wysiwyg_content .image_module.wide,.feature_pages .wysiwyg_content .image_module.parallax{margin-top:5em;margin-bottom:5em}}.feature_pages .wysiwyg_content .image_module.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .image_module.column-width{max-width:600px}}.feature_pages .wysiwyg_content .image_module.full-bleed{width:100%;max-width:none}.feature_pages .wysiwyg_content .image_module.full-bleed figcaption{margin:.8em .8em 0 .8em}.feature_pages .wysiwyg_content .image_module.full_width{clear:both}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .image_module.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.feature_pages .wysiwyg_content .image_module.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.feature_pages .wysiwyg_content .image_module.full_width{width:55%}}.feature_pages .wysiwyg_content .image_module.wide{width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .image_module.wide{width:95%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .image_module.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .image_module.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .image_module.column-width{max-width:calc(600px + 15%)}}.feature_pages .wysiwyg_content .image_module.left,.feature_pages .wysiwyg_content .image_module.right{max-width:94%}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .image_module.left,.feature_pages .wysiwyg_content .image_module.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .image_module.left,.feature_pages .wysiwyg_content .image_module.right{width:27%;max-width:27%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .image_module.left,.feature_pages .wysiwyg_content .image_module.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .image_module.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .image_module.left{margin-left:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .image_module.left{margin-left:20%}}@media (min-width: 480px){.feature_pages .wysiwyg_content .image_module.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .image_module.right{margin-right:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .image_module.right{margin-right:20%}}.feature_pages .wysiwyg_content .image_module.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.feature_pages .wysiwyg_content .image_module.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .image_module.parallax_module .caption{font-size:.88em}}.feature_pages .wysiwyg_content .image_module.parallax_module img{height:auto !important}.feature_pages .wysiwyg_content .image_module.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.feature_pages .wysiwyg_content .image_module.parallax_module .window.mobile{height:auto;min-height:100%}.feature_pages .wysiwyg_content .image_module.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .image_module.parallax_module .window .featured_image{position:absolute}}.image_module figure.inline_figure{margin-bottom:0}.item_grid_module{clear:both;margin:3em auto}@media (min-width: 769px), print{.item_grid_module{margin:4em auto}}.item_grid_module li{visibility:hidden}.item_grid_module .grid_content{margin-bottom:20px}.item_grid_module .grid_content .grid_image{text-align:center}@media (min-width: 600px), print{.item_grid_module .grid_content .grid_image{text-align:left}}.item_grid_module .grid_content .grid_image img{width:auto}@media (min-width: 600px), print{.item_grid_module .grid_content .grid_image img{width:100%}}.item_grid_module .grid_content .caption{font-size:.88em;padding:1em;color:#565455}@media (min-width: 600px), print{.item_grid_module .grid_content .caption{background-color:#D8D6D7}}.feature_pages .wysiwyg_content .item_grid_module{max-width:none;width:90% !important;left:5%;margin-left:auto;margin-right:auto}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .item_grid_module{width:98% !important;left:1%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .item_grid_module{width:95% !important;left:2.5%}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .item_grid_module{width:85% !important;left:0}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .item_grid_module{width:75% !important}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .item_grid_module{width:65% !important}}.explore_overlay_page .item_grid_module .caption{background-color:transparent;color:#9C9FA4}.grid_gallery.list_view .item_grid{display:none}.grid_gallery.masonry_view .item_list{display:none}.grid_gallery.masonry_view .grid_text .caption{background-color:#e5ecf4}.grid_gallery.masonry_view .detail_link_button{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);padding:0.7em 1.5em;border:2px solid white;border-radius:12px;font-size:0.9em;font-weight:bold}.view_selectors .nav_item.masonry_icon{background-position:-62px -62px}.no-touchevents .view_selectors .nav_item.masonry_icon:hover{background-position:-62px -12px}.masonry_view .view_selectors .nav_item.masonry_icon{background-position:-62px -12px}blockquote{clear:both;color:#000}blockquote .quote{font-style:italic;margin-bottom:.5em;font-size:1.5em;line-height:1.4em;font-weight:700}blockquote footer{font-size:1em;text-align:left}blockquote cite{font-style:normal}.explore_overlay_page blockquote{color:#FFF !important}.explore_overlay_page blockquote.inspirational{color:#FFF}.feature_pages .wysiwyg_content blockquote{width:80%}@media (min-width: 769px), print{.feature_pages .wysiwyg_content blockquote{width:65%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content blockquote{width:40%}}.wysiwyg_content .video_player_container,.wysiwyg_content figure.embedded_video{max-width:100%;margin-top:1.4em;margin-bottom:1.4em}@media (min-width: 769px), print{.wysiwyg_content .video_player_container,.wysiwyg_content figure.embedded_video{margin-top:2em;margin-bottom:2em}}.wysiwyg_content .video_player_container.left,.wysiwyg_content .video_player_container.right,.wysiwyg_content figure.embedded_video.left,.wysiwyg_content figure.embedded_video.right{float:none}@media (min-width: 480px){.wysiwyg_content .video_player_container.left,.wysiwyg_content .video_player_container.right,.wysiwyg_content figure.embedded_video.left,.wysiwyg_content figure.embedded_video.right{max-width:50%}}@media (min-width: 1200px){.wysiwyg_content .video_player_container.left,.wysiwyg_content .video_player_container.right,.wysiwyg_content figure.embedded_video.left,.wysiwyg_content figure.embedded_video.right{max-width:40%}}@media (min-width: 480px){.wysiwyg_content .video_player_container.left,.wysiwyg_content figure.embedded_video.left{float:left;margin:1em 2.5em 1.5em 0}}@media (min-width: 480px){.wysiwyg_content .video_player_container.right,.wysiwyg_content figure.embedded_video.right{float:right;margin:1em 0 1.5em 2.5em}}.wysiwyg_content .video_player_container.full-bleed,.wysiwyg_content .video_player_container.full_width,.wysiwyg_content .video_player_container.wide,.wysiwyg_content .video_player_container.parallax,.wysiwyg_content .video_player_container.column-width,.wysiwyg_content figure.embedded_video.full-bleed,.wysiwyg_content figure.embedded_video.full_width,.wysiwyg_content figure.embedded_video.wide,.wysiwyg_content figure.embedded_video.parallax,.wysiwyg_content figure.embedded_video.column-width{clear:both}.wysiwyg_content .video_player_container.parallax_module,.wysiwyg_content figure.embedded_video.parallax_module{width:100%;position:relative}.wysiwyg_content .video_player_container.parallax_module .caption,.wysiwyg_content figure.embedded_video.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.wysiwyg_content .video_player_container.parallax_module .caption,.wysiwyg_content figure.embedded_video.parallax_module .caption{font-size:.88em}}.explore_overlay_page .wysiwyg_content .video_player_container.parallax_module .caption,.explore_overlay_page .wysiwyg_content figure.embedded_video.parallax_module .caption{color:#b0b4b9}.embedded_video.left:not(.webvr_module_container) .video_wrapper,.embedded_video.right:not(.webvr_module_container) .video_wrapper,.embedded_video.column-width:not(.webvr_module_container) .video_wrapper,section:not(.feature_pages) .embedded_video.wide:not(.webvr_module_container) .video_wrapper,section:not(.feature_pages) .embedded_video.full-bleed:not(.webvr_module_container) .video_wrapper{position:relative;padding-bottom:56.25%;padding-top:25px;height:0;width:100%;overflow:hidden}.embedded_video.left:not(.webvr_module_container) iframe,.embedded_video.right:not(.webvr_module_container) iframe,.embedded_video.column-width:not(.webvr_module_container) iframe,section:not(.feature_pages) .embedded_video.wide:not(.webvr_module_container) iframe,section:not(.feature_pages) .embedded_video.full-bleed:not(.webvr_module_container) iframe{position:absolute;top:0;left:0;width:100%;height:100%}#page .embedded_video.webvr .video_wrapper{padding:0;height:100%}.feature_pages .wysiwyg_content .video_player_container,.feature_pages .wysiwyg_content figure.embedded_video{width:94%;max-width:100%;margin:3em auto;float:none}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .video_player_container,.feature_pages .wysiwyg_content figure.embedded_video{max-width:600px}}.feature_pages .wysiwyg_content .video_player_container.full-bleed,.feature_pages .wysiwyg_content .video_player_container.full_width,.feature_pages .wysiwyg_content .video_player_container.wide,.feature_pages .wysiwyg_content .video_player_container.parallax,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed,.feature_pages .wysiwyg_content figure.embedded_video.full_width,.feature_pages .wysiwyg_content figure.embedded_video.wide,.feature_pages .wysiwyg_content figure.embedded_video.parallax{clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .video_player_container.full-bleed,.feature_pages .wysiwyg_content .video_player_container.full_width,.feature_pages .wysiwyg_content .video_player_container.wide,.feature_pages .wysiwyg_content .video_player_container.parallax,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed,.feature_pages .wysiwyg_content figure.embedded_video.full_width,.feature_pages .wysiwyg_content figure.embedded_video.wide,.feature_pages .wysiwyg_content figure.embedded_video.parallax{margin-top:5em;margin-bottom:5em}}.feature_pages .wysiwyg_content .video_player_container.column-width,.feature_pages .wysiwyg_content figure.embedded_video.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .video_player_container.column-width,.feature_pages .wysiwyg_content figure.embedded_video.column-width{max-width:600px}}.feature_pages .wysiwyg_content .video_player_container.full-bleed,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed{width:100%;max-width:none}.feature_pages .wysiwyg_content .video_player_container.full-bleed figcaption,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed figcaption{margin:.8em .8em 0 .8em}.feature_pages .wysiwyg_content .video_player_container.full_width,.feature_pages .wysiwyg_content figure.embedded_video.full_width{clear:both}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .video_player_container.full_width,.feature_pages .wysiwyg_content figure.embedded_video.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.feature_pages .wysiwyg_content .video_player_container.full_width,.feature_pages .wysiwyg_content figure.embedded_video.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.feature_pages .wysiwyg_content .video_player_container.full_width,.feature_pages .wysiwyg_content figure.embedded_video.full_width{width:55%}}.feature_pages .wysiwyg_content .video_player_container.wide,.feature_pages .wysiwyg_content figure.embedded_video.wide{width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .video_player_container.wide,.feature_pages .wysiwyg_content figure.embedded_video.wide{width:95%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .video_player_container.column-width,.feature_pages .wysiwyg_content figure.embedded_video.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .video_player_container.column-width,.feature_pages .wysiwyg_content figure.embedded_video.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .video_player_container.column-width,.feature_pages .wysiwyg_content figure.embedded_video.column-width{max-width:calc(600px + 15%)}}.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.left,.feature_pages .wysiwyg_content figure.embedded_video.right{max-width:94%}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.left,.feature_pages .wysiwyg_content figure.embedded_video.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.left,.feature_pages .wysiwyg_content figure.embedded_video.right{width:27%;max-width:27%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.left,.feature_pages .wysiwyg_content figure.embedded_video.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content figure.embedded_video.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content figure.embedded_video.left{margin-left:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content figure.embedded_video.left{margin-left:20%}}@media (min-width: 480px){.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.right{margin-right:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.right{margin-right:20%}}.feature_pages .wysiwyg_content .video_player_container.parallax_module,.feature_pages .wysiwyg_content figure.embedded_video.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.feature_pages .wysiwyg_content .video_player_container.parallax_module .caption,.feature_pages .wysiwyg_content figure.embedded_video.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .video_player_container.parallax_module .caption,.feature_pages .wysiwyg_content figure.embedded_video.parallax_module .caption{font-size:.88em}}.feature_pages .wysiwyg_content .video_player_container.parallax_module img,.feature_pages .wysiwyg_content figure.embedded_video.parallax_module img{height:auto !important}.feature_pages .wysiwyg_content .video_player_container.parallax_module .window,.feature_pages .wysiwyg_content figure.embedded_video.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.feature_pages .wysiwyg_content .video_player_container.parallax_module .window.mobile,.feature_pages .wysiwyg_content figure.embedded_video.parallax_module .window.mobile{height:auto;min-height:100%}.feature_pages .wysiwyg_content .video_player_container.parallax_module .window .featured_image,.feature_pages .wysiwyg_content figure.embedded_video.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .video_player_container.parallax_module .window .featured_image,.feature_pages .wysiwyg_content figure.embedded_video.parallax_module .window .featured_image{position:absolute}}@media (min-width: 600px), print{.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.left,.feature_pages .wysiwyg_content figure.embedded_video.right{width:50%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.left,.feature_pages .wysiwyg_content figure.embedded_video.right{width:44%}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.left,.feature_pages .wysiwyg_content figure.embedded_video.right{width:33%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .video_player_container.left,.feature_pages .wysiwyg_content .video_player_container.right,.feature_pages .wysiwyg_content figure.embedded_video.left,.feature_pages .wysiwyg_content figure.embedded_video.right{width:25%}}.feature_pages .wysiwyg_content .video_player_container.full-width .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.full-bleed .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.wide .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-width .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.wide .video_wrapper{max-height:98vh}.feature_pages .wysiwyg_content .video_player_container.full-width .video_wrapper iframe,.feature_pages .wysiwyg_content .video_player_container.full-bleed .video_wrapper iframe,.feature_pages .wysiwyg_content .video_player_container.wide .video_wrapper iframe,.feature_pages .wysiwyg_content figure.embedded_video.full-width .video_wrapper iframe,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed .video_wrapper iframe,.feature_pages .wysiwyg_content figure.embedded_video.wide .video_wrapper iframe{height:100%}@media (min-height: 400px){.feature_pages .wysiwyg_content .video_player_container.full-width .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.full-bleed .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.wide .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-width .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.wide .video_wrapper{height:300px}}@media (min-height: 600px){.feature_pages .wysiwyg_content .video_player_container.full-width .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.full-bleed .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.wide .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-width .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.wide .video_wrapper{height:400px}}@media (min-height: 800px){.feature_pages .wysiwyg_content .video_player_container.full-width .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.full-bleed .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.wide .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-width .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.wide .video_wrapper{height:600px}}@media (min-height: 1000px){.feature_pages .wysiwyg_content .video_player_container.full-width .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.full-bleed .video_wrapper,.feature_pages .wysiwyg_content .video_player_container.wide .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-width .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed .video_wrapper,.feature_pages .wysiwyg_content figure.embedded_video.wide .video_wrapper{max-height:90vh}}.feature_pages .wysiwyg_content .video_player_container.full-width .video_wrapper iframe,.feature_pages .wysiwyg_content .video_player_container.full-bleed .video_wrapper iframe,.feature_pages .wysiwyg_content .video_player_container.wide .video_wrapper iframe,.feature_pages .wysiwyg_content figure.embedded_video.full-width .video_wrapper iframe,.feature_pages .wysiwyg_content figure.embedded_video.full-bleed .video_wrapper iframe,.feature_pages .wysiwyg_content figure.embedded_video.wide .video_wrapper iframe{width:100%}.wysiwyg_content figure.embedded_video .video_wrapper{width:100%}.wysiwyg_content figure.embedded_video.right iframe,.wysiwyg_content figure.embedded_video.left iframe{min-height:0}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .embedded_video iframe.webvr_module{min-height:400px}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .embedded_video iframe.webvr_module{min-height:500px}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .embedded_video iframe.webvr_module{min-height:600px}}@media (min-width: 1700px){.feature_pages .wysiwyg_content .embedded_video iframe.webvr_module{min-height:700px}}.content_page:not(.feature_pages) .wysiwyg_content figure.embedded_video.left,.content_page:not(.feature_pages) .wysiwyg_content figure.embedded_video.right{width:100%;max-width:100%}@media (min-width: 769px), print{.content_page:not(.feature_pages) .wysiwyg_content figure.embedded_video.left,.content_page:not(.feature_pages) .wysiwyg_content figure.embedded_video.right{width:50%}}.content_page:not(.feature_pages) .wysiwyg_content .video_player_container.left,.content_page:not(.feature_pages) .wysiwyg_content .video_player_container.right{width:100%;max-width:100%}@media (min-width: 769px), print{.content_page:not(.feature_pages) .wysiwyg_content .video_player_container.left,.content_page:not(.feature_pages) .wysiwyg_content .video_player_container.right{width:50%}}.video_player_container .video_container{font-size:16px;position:relative;display:block;min-height:0;overflow:hidden;box-sizing:border-box;font-family:Arial,Helvetica,sans-serif;background-color:#000}.video_player_container .video_container video{width:100%}.webvr-button{padding:0px !important;margin:12px}img[title=\"Configure viewer\"]{margin-left:-12px !important}.feature_pages .wysiwyg_content #scene_container{width:94%;max-width:100%;margin:3em auto;float:none;position:relative}@media (min-width: 600px), print{.feature_pages .wysiwyg_content #scene_container{max-width:600px}}.feature_pages .wysiwyg_content #scene_container.full-bleed,.feature_pages .wysiwyg_content #scene_container.full_width,.feature_pages .wysiwyg_content #scene_container.wide,.feature_pages .wysiwyg_content #scene_container.parallax{clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content #scene_container.full-bleed,.feature_pages .wysiwyg_content #scene_container.full_width,.feature_pages .wysiwyg_content #scene_container.wide,.feature_pages .wysiwyg_content #scene_container.parallax{margin-top:5em;margin-bottom:5em}}.feature_pages .wysiwyg_content #scene_container.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.feature_pages .wysiwyg_content #scene_container.column-width{max-width:600px}}.feature_pages .wysiwyg_content #scene_container.full-bleed{width:100%;max-width:none}.feature_pages .wysiwyg_content #scene_container.full-bleed figcaption{margin:.8em .8em 0 .8em}.feature_pages .wysiwyg_content #scene_container.full_width{clear:both}@media (min-width: 769px), print{.feature_pages .wysiwyg_content #scene_container.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.feature_pages .wysiwyg_content #scene_container.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.feature_pages .wysiwyg_content #scene_container.full_width{width:55%}}.feature_pages .wysiwyg_content #scene_container.wide{width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .wysiwyg_content #scene_container.wide{width:95%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content #scene_container.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content #scene_container.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .wysiwyg_content #scene_container.column-width{max-width:calc(600px + 15%)}}.feature_pages .wysiwyg_content #scene_container.left,.feature_pages .wysiwyg_content #scene_container.right{max-width:94%}@media (min-width: 600px), print{.feature_pages .wysiwyg_content #scene_container.left,.feature_pages .wysiwyg_content #scene_container.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.feature_pages .wysiwyg_content #scene_container.left,.feature_pages .wysiwyg_content #scene_container.right{width:27%;max-width:27%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content #scene_container.left,.feature_pages .wysiwyg_content #scene_container.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.feature_pages .wysiwyg_content #scene_container.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content #scene_container.left{margin-left:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content #scene_container.left{margin-left:20%}}@media (min-width: 480px){.feature_pages .wysiwyg_content #scene_container.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.feature_pages .wysiwyg_content #scene_container.right{margin-right:15%}}@media (min-width: 1700px){.feature_pages .wysiwyg_content #scene_container.right{margin-right:20%}}.feature_pages .wysiwyg_content #scene_container.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.feature_pages .wysiwyg_content #scene_container.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.feature_pages .wysiwyg_content #scene_container.parallax_module .caption{font-size:.88em}}.feature_pages .wysiwyg_content #scene_container.parallax_module img{height:auto !important}.feature_pages .wysiwyg_content #scene_container.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.feature_pages .wysiwyg_content #scene_container.parallax_module .window.mobile{height:auto;min-height:100%}.feature_pages .wysiwyg_content #scene_container.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.feature_pages .wysiwyg_content #scene_container.parallax_module .window .featured_image{position:absolute}}.feature_pages .wysiwyg_content #scene_container:before{display:block;content:\"\";width:100%;padding-top:75%}.feature_pages .wysiwyg_content #scene_container>.content{position:absolute;top:0;left:0;right:0;bottom:0}.content_page:not(.feature_pages) .wysiwyg_content #scene_container{max-width:100%;margin-top:1.4em;margin-bottom:1.4em;position:relative}@media (min-width: 769px), print{.content_page:not(.feature_pages) .wysiwyg_content #scene_container{margin-top:2em;margin-bottom:2em}}.content_page:not(.feature_pages) .wysiwyg_content #scene_container.left,.content_page:not(.feature_pages) .wysiwyg_content #scene_container.right{float:none}@media (min-width: 480px){.content_page:not(.feature_pages) .wysiwyg_content #scene_container.left,.content_page:not(.feature_pages) .wysiwyg_content #scene_container.right{max-width:50%}}@media (min-width: 1200px){.content_page:not(.feature_pages) .wysiwyg_content #scene_container.left,.content_page:not(.feature_pages) .wysiwyg_content #scene_container.right{max-width:40%}}@media (min-width: 480px){.content_page:not(.feature_pages) .wysiwyg_content #scene_container.left{float:left;margin:1em 2.5em 1.5em 0}}@media (min-width: 480px){.content_page:not(.feature_pages) .wysiwyg_content #scene_container.right{float:right;margin:1em 0 1.5em 2.5em}}.content_page:not(.feature_pages) .wysiwyg_content #scene_container.full-bleed,.content_page:not(.feature_pages) .wysiwyg_content #scene_container.full_width,.content_page:not(.feature_pages) .wysiwyg_content #scene_container.wide,.content_page:not(.feature_pages) .wysiwyg_content #scene_container.parallax,.content_page:not(.feature_pages) .wysiwyg_content #scene_container.column-width{clear:both}.content_page:not(.feature_pages) .wysiwyg_content #scene_container.parallax_module{width:100%;position:relative}.content_page:not(.feature_pages) .wysiwyg_content #scene_container.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.content_page:not(.feature_pages) .wysiwyg_content #scene_container.parallax_module .caption{font-size:.88em}}.explore_overlay_page .content_page:not(.feature_pages) .wysiwyg_content #scene_container.parallax_module .caption{color:#b0b4b9}.content_page:not(.feature_pages) .wysiwyg_content #scene_container:before{display:block;content:\"\";width:100%;padding-top:75%}.content_page:not(.feature_pages) .wysiwyg_content #scene_container>.content{position:absolute;top:0;left:0;right:0;bottom:0}.content_page.atlas_detail #scene_container{max-width:100%;margin-top:1.4em;margin-bottom:1.4em;position:relative}@media (min-width: 769px), print{.content_page.atlas_detail #scene_container{margin-top:2em;margin-bottom:2em}}.content_page.atlas_detail #scene_container.left,.content_page.atlas_detail #scene_container.right{float:none}@media (min-width: 480px){.content_page.atlas_detail #scene_container.left,.content_page.atlas_detail #scene_container.right{max-width:50%}}@media (min-width: 1200px){.content_page.atlas_detail #scene_container.left,.content_page.atlas_detail #scene_container.right{max-width:40%}}@media (min-width: 480px){.content_page.atlas_detail #scene_container.left{float:left;margin:1em 2.5em 1.5em 0}}@media (min-width: 480px){.content_page.atlas_detail #scene_container.right{float:right;margin:1em 0 1.5em 2.5em}}.content_page.atlas_detail #scene_container.full-bleed,.content_page.atlas_detail #scene_container.full_width,.content_page.atlas_detail #scene_container.wide,.content_page.atlas_detail #scene_container.parallax,.content_page.atlas_detail #scene_container.column-width{clear:both}.content_page.atlas_detail #scene_container.parallax_module{width:100%;position:relative}.content_page.atlas_detail #scene_container.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.content_page.atlas_detail #scene_container.parallax_module .caption{font-size:.88em}}.explore_overlay_page .content_page.atlas_detail #scene_container.parallax_module .caption{color:#b0b4b9}.content_page.atlas_detail #scene_container:before{display:block;content:\"\";width:100%;padding-top:36.36364%}.content_page.atlas_detail #scene_container>.content{position:absolute;top:0;left:0;right:0;bottom:0}.magic_shell_page .wysiwyg_content #scene_container{height:100%}#scene_container{position:relative;overflow:hidden;width:100%}#scene_container .loading_webgl{width:100%;height:100%;top:0;left:0;right:0;bottom:0;position:absolute;z-index:21;opacity:1.0;color:white;background-color:black;text-align:center;transition:opacity 2s, visibility 2s}#scene_container .loading_webgl .loading_text{position:relative;top:50%;padding-bottom:6px;color:grey}#scene_container .loading_webgl .load_bar{position:relative;top:50%;left:0;width:0%;height:2px;background-color:#FFFFFF;opacity:0.5}#gl_layer{margin:0 auto}#gl_layer,#gl_fallback_layer{-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent;position:absolute;overflow:hidden;top:0;left:0;right:0;bottom:0;width:100%;height:100%;display:none}#gl_layer .module_title_wrapper,#gl_fallback_layer .module_title_wrapper{position:absolute;padding-top:8px;top:-120px;left:50%;width:90%;text-align:center;visibility:hidden;transform:translateX(-50%);transition:top 1s, visibility 1s;z-index:20}@media (min-width: 480px){#gl_layer .module_title_wrapper,#gl_fallback_layer .module_title_wrapper{padding-top:26px}}@media only screen and (min-width: 480px) and (orientation: landscape){#gl_layer .module_title_wrapper,#gl_fallback_layer .module_title_wrapper{padding-top:0px}}@media (min-width: 600px), print{#gl_layer .module_title_wrapper,#gl_fallback_layer .module_title_wrapper{padding-top:34px}}@media only screen and (min-width: 600px) and (orientation: landscape){#gl_layer .module_title_wrapper,#gl_fallback_layer .module_title_wrapper{padding-top:4px}}@media (min-width: 769px), print{#gl_layer .module_title_wrapper,#gl_fallback_layer .module_title_wrapper{padding-top:34px}}#gl_layer .module_title_wrapper.active,#gl_fallback_layer .module_title_wrapper.active{top:0px;visibility:visible}#gl_layer .module_title_wrapper .gradient_overlay_top,#gl_fallback_layer .module_title_wrapper .gradient_overlay_top{position:absolute;width:120%;height:250%;top:0;left:50%;opacity:.8;background:linear-gradient(to bottom, #000 0%, #000 14%, transparent 99%, transparent 100%);transform:translateX(-50%)}#gl_layer .module_title_wrapper .module_title,#gl_fallback_layer .module_title_wrapper .module_title{font-size:20px;margin-right:0.4em;position:relative;color:#FFFFFF;font-family:Whitney,Helvetica,Arial,sans-serif;vertical-align:middle}@media (min-width: 480px){#gl_layer .module_title_wrapper .module_title,#gl_fallback_layer .module_title_wrapper .module_title{font-size:22px}}@media (min-width: 600px), print{#gl_layer .module_title_wrapper .module_title,#gl_fallback_layer .module_title_wrapper .module_title{font-size:34px}}@media only screen and (min-width: 600px) and (orientation: landscape){#gl_layer .module_title_wrapper .module_title,#gl_fallback_layer .module_title_wrapper .module_title{font-size:24px}}@media (min-width: 769px), print{#gl_layer .module_title_wrapper .module_title,#gl_fallback_layer .module_title_wrapper .module_title{font-size:28px}}@media (min-width: 1024px), print{#gl_layer .module_title_wrapper .module_title,#gl_fallback_layer .module_title_wrapper .module_title{font-size:34px}}#gl_layer .module_title_wrapper a.close_focus,#gl_fallback_layer .module_title_wrapper a.close_focus{cursor:pointer;position:relative;display:inline-block;padding:.1em;width:26px;height:26px;vertical-align:middle}@media (min-width: 480px){#gl_layer .module_title_wrapper a.close_focus,#gl_fallback_layer .module_title_wrapper a.close_focus{width:28px;height:28px}}@media (min-width: 600px), print{#gl_layer .module_title_wrapper a.close_focus,#gl_fallback_layer .module_title_wrapper a.close_focus{width:36px;height:36px}}@media only screen and (min-width: 600px) and (orientation: landscape){#gl_layer .module_title_wrapper a.close_focus,#gl_fallback_layer .module_title_wrapper a.close_focus{width:30px;height:30px}}@media (min-width: 769px), print{#gl_layer .module_title_wrapper a.close_focus,#gl_fallback_layer .module_title_wrapper a.close_focus{width:36px;height:36px}}@media (min-width: 1024px), print{#gl_layer .module_title_wrapper a.close_focus,#gl_fallback_layer .module_title_wrapper a.close_focus{width:42px;height:42px}}#gl_layer .module_title_wrapper a.close_focus .close_icon,#gl_fallback_layer .module_title_wrapper a.close_focus .close_icon{display:block;height:100%;position:relative;opacity:0.7}#gl_layer .module_title_wrapper a.close_focus .close_icon:before,#gl_fallback_layer .module_title_wrapper a.close_focus .close_icon:before{transform:rotate(-45deg);content:'';position:absolute;height:3px;width:100%;top:calc(50% - 1.5px);left:0;background:#fff}#gl_layer .module_title_wrapper a.close_focus .close_icon:after,#gl_fallback_layer .module_title_wrapper a.close_focus .close_icon:after{transform:rotate(45deg);content:'';position:absolute;height:3px;width:100%;top:calc(50% - 1.5px);left:0;background:#fff}#gl_layer .module_title_wrapper a.close_focus:hover .close_icon,#gl_fallback_layer .module_title_wrapper a.close_focus:hover .close_icon{opacity:1.0}#gl_layer .module_description_wrapper,#gl_fallback_layer .module_description_wrapper{position:absolute;padding-bottom:26px;bottom:-110px;left:50%;width:90%;text-align:center;visibility:hidden;transform:translateX(-50%);transition:bottom 1s, visibility 1s;z-index:20}@media (min-width: 480px){#gl_layer .module_description_wrapper,#gl_fallback_layer .module_description_wrapper{padding-bottom:66px}}@media only screen and (min-width: 480px) and (orientation: landscape){#gl_layer .module_description_wrapper,#gl_fallback_layer .module_description_wrapper{padding-bottom:12px}}@media (min-width: 769px), print{#gl_layer .module_description_wrapper,#gl_fallback_layer .module_description_wrapper{padding-bottom:66px}}#gl_layer .module_description_wrapper.active,#gl_fallback_layer .module_description_wrapper.active{bottom:0px;visibility:visible}#gl_layer .module_description_wrapper .gradient_overlay,#gl_fallback_layer .module_description_wrapper .gradient_overlay{position:absolute;width:120%;height:250%;bottom:0;left:50%;opacity:.8;background:linear-gradient(to bottom, transparent 0%, transparent 7%, #000 100%);transform:translateX(-50%)}#gl_layer .module_description_wrapper .module_description,#gl_fallback_layer .module_description_wrapper .module_description{padding:0px 12px;font-size:14px;font-weight:300;position:relative;z-index:10;color:#FFFFFF;font-family:Whitney,Helvetica,Arial,sans-serif}@media (min-width: 600px), print{#gl_layer .module_description_wrapper .module_description,#gl_fallback_layer .module_description_wrapper .module_description{font-size:20px}}@media only screen and (min-width: 600px) and (orientation: landscape){#gl_layer .module_description_wrapper .module_description,#gl_fallback_layer .module_description_wrapper .module_description{font-size:16px}}@media (min-width: 1200px){#gl_layer .module_description_wrapper .module_description,#gl_fallback_layer .module_description_wrapper .module_description{font-size:22px}}#gl_layer .module_description_wrapper .explore,#gl_fallback_layer .module_description_wrapper .explore{letter-spacing:.1em;font-family:Whitney-Bold,Helvetica,Arial,sans-serif;font-size:0;vertical-align:baseline;margin:0px;color:#78BDFF;background:rgba(0,0,0,0.1);border-radius:2px;cursor:pointer;position:relative;z-index:10}#gl_layer .module_description_wrapper .explore:hover,#gl_fallback_layer .module_description_wrapper .explore:hover{color:#CFE7FF;background:rgba(0,0,0,0.2)}#gl_layer .module_description_wrapper .explore:after,#gl_fallback_layer .module_description_wrapper .explore:after{content:\"››\";font-size:20px}@media (min-width: 1024px), print{#gl_layer .module_description_wrapper .explore,#gl_fallback_layer .module_description_wrapper .explore{font-size:17px;padding:10px;border:1px solid #78BDFF;vertical-align:middle}#gl_layer .module_description_wrapper .explore:after,#gl_fallback_layer .module_description_wrapper .explore:after{content:none}}#gl_layer .label{position:absolute;padding:0;border:0;margin:0;max-width:300px;text-align:center;transform:translate(-50%, -110%);font-size:16px;color:#FFFFFF;font-family:Whitney,Helvetica,Arial,sans-serif}#gl_fallback_layer .focus_layer{position:absolute;top:0;right:0;width:100%;height:100%;background-size:cover;background-position:center center;visibility:hidden;opacity:0;transition:opacity 1s, visibility 1s;z-index:15}#gl_fallback_layer .focus_layer.active{visibility:visible;opacity:1}#gl_fallback_layer .overlay_image{position:absolute;top:0;right:0;width:100%;height:100%;height:100%;background-size:cover;background-position:center center}.hotspot_container{position:absolute;height:100%;width:100%}.hotspot_container .hotspot_wrapper{position:absolute;top:0px;left:0px;width:350px;visibility:visible;transform:translate(-12px, -12px)}.hotspot_container .hotspot_wrapper span{position:relative;visibility:visible;font-size:0.7em;color:#FFFFFF;opacity:0.0;transition:opacity 0.75s;left:6px}.hotspot_container .hotspot_wrapper.hidden{visibility:hidden}.hotspot_container .hotspot_wrapper .hotspot{width:24px;height:24px;opacity:0.8}.fallback_mode #gl_fallback_layer{height:auto}.fallback_mode #gl_fallback_layer img{height:auto}.image{height:300px;width:300px;border-color:#000000;border:4px solid #ffffff;border-radius:8px;transform:translate(-50%, -50%)}.gltf_viewer{max-width:100%;margin-top:1.4em;margin-bottom:1.4em}@media (min-width: 769px), print{.gltf_viewer{margin-top:2em;margin-bottom:2em}}.gltf_viewer.left,.gltf_viewer.right{float:none}@media (min-width: 480px){.gltf_viewer.left,.gltf_viewer.right{max-width:50%}}@media (min-width: 1200px){.gltf_viewer.left,.gltf_viewer.right{max-width:40%}}@media (min-width: 480px){.gltf_viewer.left{float:left;margin:1em 2.5em 1.5em 0}}@media (min-width: 480px){.gltf_viewer.right{float:right;margin:1em 0 1.5em 2.5em}}.gltf_viewer.full-bleed,.gltf_viewer.full_width,.gltf_viewer.wide,.gltf_viewer.parallax,.gltf_viewer.column-width{clear:both}.gltf_viewer.parallax_module{width:100%;position:relative}.gltf_viewer.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.gltf_viewer.parallax_module .caption{font-size:.88em}}.explore_overlay_page .gltf_viewer.parallax_module .caption{color:#b0b4b9}.feature_pages .gltf_viewer{width:94%;max-width:100%;margin:3em auto;float:none}@media (min-width: 600px), print{.feature_pages .gltf_viewer{max-width:600px}}.feature_pages .gltf_viewer.full-bleed,.feature_pages .gltf_viewer.full_width,.feature_pages .gltf_viewer.wide,.feature_pages .gltf_viewer.parallax{clear:both}@media (min-width: 600px), print{.feature_pages .gltf_viewer.full-bleed,.feature_pages .gltf_viewer.full_width,.feature_pages .gltf_viewer.wide,.feature_pages .gltf_viewer.parallax{margin-top:5em;margin-bottom:5em}}.feature_pages .gltf_viewer.column-width{max-width:94%;margin-top:3em;margin-bottom:3em;clear:both}@media (min-width: 600px), print{.feature_pages .gltf_viewer.column-width{max-width:600px}}.feature_pages .gltf_viewer.full-bleed{width:100%;max-width:none}.feature_pages .gltf_viewer.full-bleed figcaption{margin:.8em .8em 0 .8em}.feature_pages .gltf_viewer.full_width{clear:both}@media (min-width: 769px), print{.feature_pages .gltf_viewer.full_width{width:94%;max-width:600px;margin-left:auto;margin-right:auto}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px), print and (min-width: 769px), print{.feature_pages .gltf_viewer.full_width{width:80%}}@media (min-width: 769px) and (min-width: 1200px), print and (min-width: 1200px){.feature_pages .gltf_viewer.full_width{width:55%}}.feature_pages .gltf_viewer.wide{width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .gltf_viewer.wide{width:95%}}@media (min-width: 769px), print{.feature_pages .gltf_viewer.column-width{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .gltf_viewer.column-width{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .gltf_viewer.column-width{max-width:calc(600px + 15%)}}.feature_pages .gltf_viewer.left,.feature_pages .gltf_viewer.right{max-width:94%}@media (min-width: 600px), print{.feature_pages .gltf_viewer.left,.feature_pages .gltf_viewer.right{width:50%;max-width:50%}}@media (min-width: 769px), print{.feature_pages .gltf_viewer.left,.feature_pages .gltf_viewer.right{width:27%;max-width:27%}}@media (min-width: 1700px){.feature_pages .gltf_viewer.left,.feature_pages .gltf_viewer.right{width:25%;max-width:25%}}@media (min-width: 600px), print{.feature_pages .gltf_viewer.left{float:left;margin:1em 2.5em 1.5em 0;margin-left:3%}}@media (min-width: 1200px){.feature_pages .gltf_viewer.left{margin-left:15%}}@media (min-width: 1700px){.feature_pages .gltf_viewer.left{margin-left:20%}}@media (min-width: 480px){.feature_pages .gltf_viewer.right{float:right;margin:1em 0 1.5em 2.5em;margin-right:3%}}@media (min-width: 1200px){.feature_pages .gltf_viewer.right{margin-right:15%}}@media (min-width: 1700px){.feature_pages .gltf_viewer.right{margin-right:20%}}.feature_pages .gltf_viewer.parallax_module{position:relative;overflow:hidden;z-index:10;padding-bottom:0;width:100%;max-width:none}.feature_pages .gltf_viewer.parallax_module .caption{margin:.8em .8em 0 .8em;font-size:.8em;color:#5a6470}@media (min-width: 769px), print{.feature_pages .gltf_viewer.parallax_module .caption{font-size:.88em}}.feature_pages .gltf_viewer.parallax_module img{height:auto !important}.feature_pages .gltf_viewer.parallax_module .window{width:100%;height:auto;position:absolute;overflow:hidden;padding:2em}.feature_pages .gltf_viewer.parallax_module .window.mobile{height:auto;min-height:100%}.feature_pages .gltf_viewer.parallax_module .window .featured_image{z-index:9;top:0;left:0;height:100%;overflow:hidden}@media (min-width: 769px), print{.feature_pages .gltf_viewer.parallax_module .window .featured_image{position:absolute}}.feature_pages .gltf_viewer.full-bleed .gltf_caption{margin:.8em .8em 0 .8em}.gltf_viewer .gltf_caption{margin-top:.8rem;font-size:.8rem;color:#5a6470}@media (min-width: 769px), print{.gltf_viewer .gltf_caption{font-size:.88rem}}.gltf_viewer .gltf_link{display:block;font-weight:600}.gltf_viewer:not(.full) iframe,.gltf_container:not(.full) iframe{width:1px;max-width:100%;min-width:100%}.gltf_viewer.full,.gltf_container.full{margin:0}.gltf_viewer.full iframe,.gltf_container.full iframe{position:fixed;top:0;left:0;z-index:99999}.touchevents .feature_pages .gltf_viewer{max-width:86%}.gltf_container{margin-bottom:1em}.wysiwyg_content p{line-height:1.4em}.wysiwyg_content p,.wysiwyg_content a{word-wrap:break-word}.wysiwyg_content table a{word-break:break-word}#primary_column .wysiwyg_content>:first-child{margin-top:0}#primary_column .wysiwyg_content .inset_box{padding:.5em 2em;margin:2em 0;border:4px solid #DCE0E5}.wysiwyg_content strong,.wysiwyg_content b,.wysiwyg_content .bold{font-weight:bold}.wysiwyg_content .content_title{font-size:1.04em;margin-bottom:.1em}@media (min-width: 600px), print{.wysiwyg_content .content_title{font-size:1.2em;margin-bottom:.18em}}@media (min-width: 769px), print{.wysiwyg_content .content_title{font-size:1.36em;margin-bottom:.26em}}@media (min-width: 1024px), print{.wysiwyg_content .content_title{font-size:1.44em;margin-bottom:.29em}}@media (min-width: 1200px){.wysiwyg_content .content_title{font-size:1.52em;margin-bottom:.32em}}.wysiwyg_content .article_teaser_body{font-size:1em}.wysiwyg_content .indent1{margin-left:3.5em}.wysiwyg_content .indent2{margin-left:7em}.wysiwyg_content .indent3{margin-left:10.5em}.wysiwyg_content .publish_date{font-weight:700}.wysiwyg_content .item_list_module{clear:both}.wysiwyg_content .expandable_element_link.style_1{font-size:.8em;font-weight:700;text-transform:uppercase}.wysiwyg_content .expandable_element{display:none}.wysiwyg_content table{border-spacing:1px;border-collapse:separate;font-size:15px;line-height:normal}.wysiwyg_content table th,.wysiwyg_content table td{padding:13px}.wysiwyg_content table th{background-color:#ddd;font-weight:600;text-align:left}.wysiwyg_content table td{background-color:#eee}.wysiwyg_content .table_wrapper{width:100%;margin:1em 0;-webkit-overflow-scrolling:touch}.wysiwyg_content .table_wrapper>div::-webkit-scrollbar{height:12px}.wysiwyg_content .table_wrapper>div::-webkit-scrollbar-track{box-shadow:0 0 2px rgba(0,0,0,0.15) inset;background:#f0f0f0}.wysiwyg_content .table_wrapper>div::-webkit-scrollbar-thumb{border-radius:6px;background:#ccc}.feature_pages .wysiwyg_content .table_wrapper,.feature_pages .wysiwyg_content .expandable_table_wrapper{margin-left:auto;margin-right:auto;margin:3em auto;width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .table_wrapper,.feature_pages .wysiwyg_content .expandable_table_wrapper{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .table_wrapper,.feature_pages .wysiwyg_content .expandable_table_wrapper{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .table_wrapper,.feature_pages .wysiwyg_content .expandable_table_wrapper{max-width:calc(600px + 15%)}}.feature_pages .wysiwyg_content .expandable_table_wrapper .table_wrapper{width:100%;max-width:none;margin:0 0 1rem}.feature_pages .wysiwyg_content .mars_legacy_table{margin-left:auto;margin-right:auto;margin:3em auto;width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages .wysiwyg_content .mars_legacy_table{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages .wysiwyg_content .mars_legacy_table{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages .wysiwyg_content .mars_legacy_table{max-width:calc(600px + 15%)}}.feature_pages .wysiwyg_content .mars_legacy_table .table_wrapper{width:100%;max-width:none;margin:0 0 1rem}.wysiwyg_content .table_wrapper.has-scroll{position:relative;overflow:hidden}.wysiwyg_content .table_wrapper.has-scroll:after{position:absolute;top:0;left:100%;width:50px;height:100%;border-radius:10px 0 0 10px / 50% 0 0 50%;box-shadow:-5px 0 10px rgba(0,0,0,0.25);content:''}.wysiwyg_content .table_wrapper.has-scroll>div{overflow-x:auto}.wysiwyg_content table.mb_table{border-collapse:collapse;width:100%}.wysiwyg_content table.mb_table td{background-color:transparent}.wysiwyg_content table.mb_table th{background-color:white;color:black;font-size:.75em;font-weight:500;text-align:left;padding:13px}@media (min-width: 600px), print{.wysiwyg_content table.mb_table th{font-size:.9em}}.wysiwyg_content table.mb_table tbody td{font-size:.9em}@media (min-width: 600px), print{.wysiwyg_content table.mb_table tbody td{font-size:1.1em}}.wysiwyg_content table.mb_table tr:nth-child(even){background-color:#edf4fb}.wysiwyg_content table.mb_table tr:nth-child(odd){background-color:#ffffff}.wysiwyg_content table.mb_table td{border:1px solid #d2d2d2;padding:.8em}.wysiwyg_content table.mb_table td:first-child{border-left:transparent}.wysiwyg_content table.mb_table td:last-child{border-right:transparent}.wysiwyg_content table.small_table,.wysiwyg_content table.mb_table.small_table{font-size:.75em;padding:.6em}#main_container form.gsc-search-box{padding:0}#main_container form.gsc-search-box td.gsc-input{padding:0}#main_container table[class^=\"gsc-\"] td,#main_container table[class^=\"gcsc-\"] td{background-color:transparent}#main_container.placeholder{-webkit-font-smoothing:antialiased}#main_container:-moz-placeholder{-webkit-font-smoothing:antialiased}#main_container::-moz-placeholder{-webkit-font-smoothing:antialiased}#main_container::-webkit-input-placeholder{-webkit-font-smoothing:antialiased}#main_container .gsc-control-cse table{margin:0}#main_container input.gsc-input{padding:10px 12px;border-radius:6px;font-size:15px}#main_container input.gsc-search-button{border-color:#fff;background-color:#3b788b;padding:10px 14px 10px;height:38px;color:white;font-size:15px;font-weight:500;border-radius:6px;text-transform:uppercase}#main_container input.gsc-search-button:hover{background-color:#5097ad}#main_container .gsc-selected-option-container{width:auto !important;max-width:none}#main_container td.gsc-clear-button{padding-left:4px}#main_container .cse .gsc-control-cse,#main_container .gsc-control-cse{padding:0}#main_container .cse .gsc-control-cse tr,#main_container .gsc-control-cse tr{background:none !important}#main_container td.gsib_b *{padding:0;vertical-align:middle}#main_container td.gsc-result-info-container{padding-left:0}#main_container .gs-no-results-result .gs-snippet,#main_container .gs-error-result .gs-snippet{padding:5px 0;margin:5px 0;border:none;background-color:transparent}#main_container .gsc-webResult.gsc-results{margin-top:0px}#main_container div.gsc-webResult.gsc-result{border-bottom:1px solid #CFD7E1;padding-bottom:16px;padding-top:16px;padding-left:0;margin-bottom:0px;margin-top:0px}#main_container td.gsc-table-cell-snippet-close{padding:0}#main_container div.gs-title{padding:0;height:auto;line-height:1.4em;text-decoration:none}#main_container .gs-result a.gs-title,#main_container .gs-result a.gs-title b{color:#388FDA;text-decoration:none;font-weight:700;letter-spacing:-.035em;height:auto;padding:0}@media (min-width: 600px), print{#main_container .gs-result a.gs-title,#main_container .gs-result a.gs-title b{font-size:18px}}@media (min-width: 769px), print{#main_container .gs-result a.gs-title,#main_container .gs-result a.gs-title b{font-size:20px}}#main_container a.gs-title:hover{color:#115FA3;text-decoration:underline}#main_container a.gs-title:hover b{color:#115FA3}#main_container .gs-webResult .gs-snippet,#main_container .gs-imageResult .gs-snippet,#main_container .gs-fileFormatType{color:#333;line-height:1.4em}@media (min-width: 1024px), print{#main_container .gs-webResult .gs-snippet,#main_container .gs-imageResult .gs-snippet,#main_container .gs-fileFormatType{font-size:15px}}#main_container .gs-webResult div.gs-visibleUrl,#main_container .gs-imageResult div.gs-visibleUrl{color:#888}#main_container .gsc-table-cell-thumbnail{padding:0 6px 0 0}@media (min-width: 600px), print{#main_container .gsc-table-cell-thumbnail{padding:0 12px 0 0}}@media (min-width: 1024px), print{#main_container .gsc-table-cell-thumbnail{padding:0 16px 0 0}}#main_container .gs-web-image-box{margin-right:10px;width:100px}@media (min-width: 600px), print{#main_container .gs-web-image-box{padding:0;width:125px}}#main_container img.gs-image,#main_container .gs-promotion-image-box img.gs-promotion-image{border:none;width:100%;height:auto;max-width:none;max-height:none}#main_container a.gs-image{display:block}#main_container .gsc-results .gsc-cursor-box{padding-top:2px}#main_container .gsc-results .gsc-cursor-box .gsc-cursor-page{color:#388FDA;font-size:17px}#main_container .gsc-results .gsc-cursor-box .gsc-cursor-current-page{color:#333;background-color:transparent;text-shadow:none;padding:0}#main_container .gsc-adBlock{display:none !important}.aaa{border:0 solid green}.shareline{width:100%;margin:1.7em 0 2.7em;display:block;position:relative;clear:both}.shareline .shareline_heading{margin-bottom:.5em;position:relative;margin-top:0}.shareline.top_attached_sl{margin-bottom:0}.shareline.bottom_attached_sl{margin-top:-1px;margin-top:0}.shareline.bottom_attached_sl article{border-top:none}.shareline.bottom_attached_sl .shareline_heading{display:none}.shareline article{padding:17px 0em 18px;border-top:1px solid #BEBEBE;border-bottom:1px solid #BEBEBE;position:relative;overflow:visible}.shareline .share_container{display:inline-block;vertical-align:top;width:75px}.shareline .share_container .selector{display:inline-block}.shareline .share_container .selected{display:inline-block;position:relative;top:1px;height:25px;width:25px;cursor:pointer}.shareline .share_container .selected:before{font-size:32px;margin-top:-3px}.shareline .share_container .arrow_box{display:inline-block;position:relative;padding:9px 11px;cursor:pointer}.shareline .share_container .arrow_down{width:0;height:0;border-top:6px solid transparent !important;border-bottom:6px solid transparent !important;border-left:8px solid #b2b2b2;display:inline-block;transform:rotate(90deg)}.shareline .share_container .arrow_down:hover{border-color:black}.shareline .share_options{display:none;position:absolute;top:47px;left:0;z-index:2;background-color:#FFF;border:1px solid #BEBEBE;padding:5px 6px 0 6px}.shareline .share_options .share_btn{width:40px;height:40px;font-size:40px;display:inline;margin:0.1em;cursor:pointer}.shareline a.fi-social-twitter,.shareline a.fi-social-facebook{color:#2b2b2b;text-decoration:none}.shareline .share_text{display:inline-block;vertical-align:middle;width:calc(100% - 75px);color:#555;font-size:95%}#explore_overlay .shareline a.fi-social-twitter,#explore_overlay .shareline a.fi-social-facebook,#explore_overlay .shareline .share_text,.explore_overlay_page .shareline a.fi-social-twitter,.explore_overlay_page .shareline a.fi-social-facebook,.explore_overlay_page .shareline .share_text{color:#FFF}#explore_overlay .shareline .share_options a.fi-social-twitter,#explore_overlay .shareline .share_options a.fi-social-facebook,.explore_overlay_page .shareline .share_options a.fi-social-twitter,.explore_overlay_page .shareline .share_options a.fi-social-facebook{color:#2b2b2b}#explore_overlay .shareline .arrow_down:hover,.explore_overlay_page .shareline .arrow_down:hover{border-color:white}#explore_overlay .shareline article,.explore_overlay_page .shareline article{border-color:#6d6b6b}.keypoint .share_container{width:28px;margin-top:-1px;margin-left:1em}.keypoint .keypoint_icon{font-size:1.2em}section.missions_teaser{background:#edecec;z-index:10}section.missions_teaser header{margin-bottom:2em}section.missions_teaser ul.missions_circles{text-align:center;margin-bottom:2em}section.missions_teaser ul.missions_circles li.mission_item{display:block;margin-left:auto;margin-right:auto;width:300px;text-decoration:none;margin-bottom:3%;border-radius:150px;overflow:hidden}@media (max-width: 480px){section.missions_teaser ul.missions_circles li.mission_item{width:290px;border-radius:145px}}@media (min-width: 769px), print{section.missions_teaser ul.missions_circles li.mission_item{width:210px;border-radius:105px;margin-right:2%;display:inline-block;margin-bottom:0}section.missions_teaser ul.missions_circles li.mission_item:last-child{margin-right:0}}@media (min-width: 1024px), print{section.missions_teaser ul.missions_circles li.mission_item{margin-right:3%;width:300px;border-radius:150px}}@media (min-width: 1200px){section.missions_teaser ul.missions_circles li.mission_item{margin-right:5%}}section.missions_teaser ul.missions_circles li.mission_item:first-child{border:5px solid #3b788b}section.missions_teaser ul.missions_circles li.mission_item:nth-child(2){border:5px solid #c25b28}section.missions_teaser ul.missions_circles li.mission_item:nth-child(3){border:5px solid #fda43c}@media (min-width: 769px), print{section.missions_teaser ul.missions_circles li.mission_item .rollover_description{transition:opacity .4s}}@media (min-width: 769px), print{section.missions_teaser ul.missions_circles li.mission_item .rollover_description .rollover_description_inner{font-size:0.9em}}@media (min-width: 1024px), print{section.missions_teaser ul.missions_circles li.mission_item .rollover_description .rollover_description_inner{font-size:1em}}section.missions_teaser ul.missions_circles li.mission_item .rollover_description *{color:white}section.missions_teaser ul.missions_circles li.mission_item:hover .rollover_description{display:none}@media (min-width: 769px), print{section.missions_teaser ul.missions_circles li.mission_item:hover .rollover_description{display:block;opacity:1;height:100%;width:100%;z-index:1;top:0;right:0;overflow:hidden;position:absolute;background-color:rgba(0,0,0,0.6);border-radius:50%;padding:2em;color:white;font-weight:500;font-size:1.1em}}@media (min-width: 1024px), print{section.missions_teaser ul.missions_circles li.mission_item:hover .rollover_description{padding:6em 1.5em}}@media (min-width: 769px), print{section.missions_teaser ul.missions_circles li.mission_item:hover li.mission_item .title{opacity:0}}section.missions_teaser ul.missions_circles a{height:300px;display:block;position:relative;text-decoration:none}@media (max-width: 480px){section.missions_teaser ul.missions_circles a{height:290px}}@media (min-width: 769px), print{section.missions_teaser ul.missions_circles a{height:210px}}@media (min-width: 1024px), print{section.missions_teaser ul.missions_circles a{height:300px}}section.missions_teaser ul.missions_circles a .title{text-align:center;position:relative;display:block;top:80%;color:white;text-transform:uppercase;font-size:1.2em;font-weight:500;transition:opacity .4s}@media (min-width: 769px), print{section.missions_teaser ul.missions_circles a .title{top:72%}}@media (min-width: 1024px), print{section.missions_teaser ul.missions_circles a .title{top:80%}}section.missions_teaser footer .detail_link{display:block;margin:0.5em 1em 0 0;white-space:nowrap}@media (min-width: 769px), print{section.missions_teaser footer{float:right;text-align:right}}section.missions_teaser footer a{color:#4e8fa4}.megasection_nav_present.msl .missions_teaser{background:#000}.megasection_nav_present.msl .missions_teaser header{margin-bottom:4em}.megasection_nav_present.msl .missions_teaser .module_title{color:#e0cec7;font-weight:500}.megasection_nav_present.msl .missions_teaser footer a{font-weight:700;color:#33a0bd;background:#000;border:0}.wysiwyg_content .footnotes li{position:relative;font-size:.85em;margin-bottom:1em}.wysiwyg_content .footnotes li .footnote h2{margin:0;color:#222;font-size:1.2em}.wysiwyg_content .footnotes li p{margin:0.4em 0 0.6em}.wysiwyg_content .footnote{font-size:.8em}#secondary_column .footnote{font-size:.8em}.primary_media_feature{margin-bottom:0}@media (min-width: 769px), print{.primary_media_feature{padding:0}}.primary_media_feature.single{position:relative;margin-bottom:0;overflow:hidden}.primary_media_feature.single .feature_container{height:300px;background-size:cover;position:relative;z-index:3;background-position:center}@media (min-width: 769px), print{.primary_media_feature.single .feature_container{height:700px}}.primary_media_feature.single.video .play{display:none;position:absolute;top:47%;left:47%;top:calc(50%- 30px);left:calc(50%- 30px);top:-webkit-calc(50% - 30px);left:-webkit-calc(50% - 30px);width:60px;height:60px;padding-top:0;cursor:pointer;background:url(\"https://mars.nasa.gov/assets/play-button.png\") 0 0 no-repeat;z-index:10}.primary_media_feature.single.video .player{width:100%;height:100%;position:absolute;top:0;left:0;z-index:2}.primary_media_feature.single .video_header_overlay{position:absolute;bottom:2em;margin:0 auto;left:0;right:0;width:auto;text-align:center;color:white;z-index:5}.primary_media_feature.single .video_header_overlay .media_feature_title{font-size:3em}.custom_banner_container{position:relative}.faq_section h2{margin-top:0}.faq_section ul.q_and_a{margin-bottom:1em}.faq_section ul.q_and_a .question{margin-bottom:1em}.faq_section ul.q_and_a .question:last-child{margin-bottom:0.6em}.faq_section ul.q_and_a .title_container{cursor:pointer}.faq_section ul.q_and_a .title{font-weight:600;font-size:1.1em}.faq_section ul.q_and_a .text.answer{visibility:hidden;position:absolute;left:-9999px}.faq_section ul.q_and_a .text.answer.open{visibility:visible;position:relative;left:0}.faq_section hr:last-child{display:none}.fullscreen_element{position:absolute;top:7px;right:7px;cursor:pointer;background-color:rgba(0,0,0,0.5);width:50px;height:50px;border-radius:5px;z-index:10}@media (min-width: 769px), print{.fullscreen_element{top:20px;right:20px}}.fullscreen_element .fullscreen-icon{height:25px;width:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") 1px -25px;background-size:25px;margin:13px 0 0 13px}.fullscreen_element:hover .fullscreen-icon{background:url(\"https://mars.nasa.gov/assets/[email protected]\") 1px 0px;background-size:25px}.fullscreen_element.fullscreen-mode .fullscreen-icon{background:url(\"https://mars.nasa.gov/assets/[email protected]\") 1px -74px;background-size:25px}.fullscreen_element.fullscreen-mode:hover .fullscreen-icon{background:url(\"https://mars.nasa.gov/assets/[email protected]\") 1px -49px;background-size:25px}#timeline-embed:-webkit-full-screen{height:100%;width:100%;min-height:none;max-height:none}#timeline-embed:-ms-fullscreen{height:100%;width:100%;min-height:none;max-height:none}#timeline-embed:fullscreen{height:100%;width:100%;min-height:none;max-height:none}@media (min-width: 1024px), print{.double_teaser{padding-left:12%;padding-right:12%}}.double_teaser .column{width:100%}@media (min-width: 600px), print{.double_teaser .column{box-sizing:border-box;width:45.83333%;float:left;padding-left:1.66667%;padding-right:1.66667%}}.double_teaser .column+.column{margin-top:2em}@media (min-width: 600px), print{.double_teaser .column+.column{margin-top:0;width:43.96552%;float:right;margin-right:0}}.double_teaser header{margin-bottom:1.3em}.double_teaser footer{text-align:left}.double_teaser .module_title_small{font-size:1.5em}@media (min-width: 600px), print{.double_teaser .module_title_small{font-size:1.9em}}.double_teaser .img_area{margin-bottom:1em;float:none;width:100%}.double_teaser .item_list{margin-bottom:1em}.double_teaser .item_list li{border-bottom:1px solid #BEBEBE;padding:3.44828% 0}.double_teaser .item_list li:first-child{padding-top:0}.double_teaser .item_list .list_image{width:39.65517%;float:left;margin-right:3.44828%;margin-left:0}@media (min-width: 769px), print{.double_teaser .item_list .list_image{width:31.03448%;float:left;margin-right:3.44828%}}.double_teaser .item_list .list_text{width:56.89655%;float:right;margin-right:0}@media (min-width: 769px), print{.double_teaser .item_list .list_text{width:65.51724%;float:right;margin-right:0}}.double_teaser .item_list .list_text .date{color:#707070;font-size:0.8em;font-weight:500;margin-bottom:0.3em}.double_teaser .item_list .list_text .date span:before{content:\" \\2022 \"}.double_teaser .item_list .list_text .title{font-size:1em;font-weight:500}.insight_page .double_teaser .teaser_container{padding:0 1em}@media (min-width: 1024px), print{.insight_page .double_teaser .teaser_container{padding:0}}.insight_page .double_teaser .teaser_container .module_title{color:#222;text-align:left}.insight_page .double_teaser .teaser_container .upcoming_events footer ul{margin-bottom:1em;margin-left:0}.megasection_nav_present.msl section.module.double_teaser{background:#edecec}.megasection_nav_present.msl section.module.double_teaser h2,.megasection_nav_present.msl section.module.double_teaser a{font-weight:500;text-align:left}.triple_teaser{background-color:white;z-index:11}.triple_teaser .column{width:100%}@media (min-width: 769px), print{.triple_teaser .column{width:31.03448%;float:left}.triple_teaser .column:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.triple_teaser .column:nth-child(3n+2){margin-left:34.48276%;margin-right:-100%;clear:none}.triple_teaser .column:nth-child(3n+3){margin-left:68.96552%;margin-right:-100%;clear:none}}@media (min-width: 1024px), print{.triple_teaser .column{width:28.57143%;float:left}.triple_teaser .column:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.triple_teaser .column:nth-child(3n+2){margin-left:35.71429%;margin-right:-100%;clear:none}.triple_teaser .column:nth-child(3n+3){margin-left:71.42857%;margin-right:-100%;clear:none}}.triple_teaser .column:last-child{margin-bottom:1em}.triple_teaser .column+.column{margin-top:3em}@media (min-width: 769px), print{.triple_teaser .column+.column{margin-top:0}}.triple_teaser header{margin-bottom:1.3em}.triple_teaser .module_title{text-align:left}@media (min-width: 600px), print{.triple_teaser .module_title{font-size:2em}}@media (min-width: 600px), print{.triple_teaser footer{text-align:left}}.triple_teaser footer .detail_link{float:left;clear:both;text-align:left;white-space:nowrap}.triple_teaser .img_area{margin-bottom:1em;float:none;width:100%}.triple_teaser .item_list{margin-bottom:1em}.triple_teaser .item_list li{border-bottom:1px solid #BEBEBE;padding:3.44828% 0}.triple_teaser .item_list li:first-child{padding-top:0}.triple_teaser .item_list li:last-child{border-bottom:none}.triple_teaser .item_list .list_image{width:39.65517%;float:left;margin-right:3.44828%;margin-left:0}@media (min-width: 600px), print{.triple_teaser .item_list .list_image{width:31.03448%;float:left;margin-right:3.44828%}}.triple_teaser .item_list .list_text{width:56.89655%;float:right;margin-right:0}@media (min-width: 600px), print{.triple_teaser .item_list .list_text{width:65.51724%;float:right;margin-right:0}}.triple_teaser .item_list .list_text .date{color:#707070;font-size:0.8em;font-weight:500;margin-bottom:0.3em}.triple_teaser .item_list .list_text .date span:before{content:\" \\2022 \"}.triple_teaser .item_list .list_text .title{font-size:1em;font-weight:500}.triple_teaser .upcoming_events .item_list li{padding:3.44828% 0}.triple_teaser .upcoming_events .item_list li:first-child{padding-top:0}.triple_teaser .upcoming_events .item_list .list_text .date{margin-bottom:.7em}.triple_teaser .follow_teaser .text_area{font-weight:300;font-size:1rem}.triple_teaser .follow_teaser .text_area footer{margin-top:2em}ul.item_list{margin-bottom:2em}ul.item_list .list_title{font-size:1.3em;font-weight:700;margin-bottom:.5em}ul.item_list .list_title a{color:#222}ul.item_list .text_only .list_text{width:100%;padding:0}ul.item_list>li hr{margin:0}ul.item_list .list_image{width:37.5%;float:right;margin-right:0;margin-left:4.16667%;margin-bottom:.5em}@media (min-width: 600px), print{ul.item_list .list_image{margin-left:0;margin-bottom:0;width:35.89744%;float:left;margin-right:2.5641%}}@media (min-width: 769px), print{ul.item_list .list_image{width:22.41379%;float:left;margin-right:3.44828%}}@media (min-width: 1024px), print{ul.item_list .list_image{width:31.03448%;float:left;margin-right:3.44828%}}@media (min-width: 600px), print{ul.item_list .list_text{width:61.53846%;float:right;margin-right:0}}@media (min-width: 769px), print{ul.item_list .list_text{width:74.13793%;float:right;margin-right:0}}@media (min-width: 1024px), print{ul.item_list .list_text{width:65.51724%;float:right;margin-right:0}}ul.item_list .list_text h2,ul.item_list .list_text h3,ul.item_list .list_text h4{margin-top:0}ul.item_list .list_content{padding:1em 0}ul.item_list .list_description{margin-top:0}ul.item_list .description .long{display:none}ul.item_list .description .long p:first-of-type{margin-top:0}ul.people.item_list li.person{padding:4.16667% 0}ul.people.item_list li.person:first-child{padding-top:0}ul.people.item_list .person_header{margin-bottom:1.2em}ul.people.item_list .list_title.list_name{padding-top:7%}@media (min-width: 600px), print{ul.people.item_list .list_title.list_name{padding:0}}ul.people.item_list .person_title{font-weight:300}ul.people.item_list .description{clear:both}@media (min-width: 600px), print{ul.people.item_list .description{clear:none}}ul.people.item_list .person+.person{border-top:1px solid #BEBEBE}ul.item_list.text_item_list .list_text{width:100%}ul.item_list.text_item_list .list_text .date{margin-bottom:.3em}ul.item_list.text_item_list a{color:#257cdf}ul.item_list.text_item_list a:hover{text-decoration:underline}ul.item_list.text_item_list .publication_authors{margin-bottom:.4em}ul.item_list.text_item_list .citation{font-size:.85em;margin-bottom:.4em;font-weight:300}ul.item_list.text_item_list .publication_title{font-size:1.1em;font-weight:700;margin-bottom:.4em}ul.item_list.text_item_list .publication_title a{color:#222}ul.item_list.text_item_list .list_title a{color:#222}.explore_overlay_page .feature_pages .wysiwyg_content .item_list_module{margin-left:auto}.feature_pages ul.item_list{margin-left:auto;margin-right:auto;margin:3em auto;width:98%;max-width:none}@media (min-width: 769px), print{.feature_pages ul.item_list{max-width:calc(600px + 6%)}}@media (min-width: 1024px), print{.feature_pages ul.item_list{max-width:calc(600px + 10%)}}@media (min-width: 1200px){.feature_pages ul.item_list{max-width:calc(600px + 15%)}}@media (min-width: 1200px){.secondary_nav_desktop{overflow-x:auto}}@media (min-width: 1200px){.custom_banner_container .secondary_nav_desktop{overflow-x:visible}}@media (min-width: 1200px){.custom_banner_container .fixed_secondary_nav{overflow-x:auto}}nav.secondary_nav{font-weight:400}nav.secondary_nav .grid_layout{width:100%;padding-left:10px;padding-right:10px;max-width:none}@media (min-width: 600px), print{nav.secondary_nav .grid_layout{padding-left:17px;padding-right:17px}}nav.secondary_nav.secondary_nav_mobile{display:block;width:100%}nav.secondary_nav.secondary_nav_mobile select{position:relative;padding:.5em 2em .5em 1em;font-size:16px;border:0;height:40px;vertical-align:middle;color:white;-webkit-appearance:none;-o-appearance:none;-moz-appearance:none;background:#3b788b url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat 95% 10px;background-position:right .8em top 10px;background-size:9px;font-weight:700;cursor:pointer;width:100%;border-radius:5px;max-width:304px;margin:0;background-color:#AFB3B9;width:100%;max-width:none;border-radius:0}nav.secondary_nav.secondary_nav_mobile select::-ms-expand{display:none}nav.secondary_nav.secondary_nav_mobile select option{padding:0.5em 1em}@media (min-width: 1200px){nav.secondary_nav.secondary_nav_mobile{display:none}}nav.secondary_nav.secondary_nav_desktop{display:none}@media (min-width: 1200px){nav.secondary_nav.secondary_nav_desktop{padding:0.8em 0 0.9em;display:block;margin:0;background-color:#eee;text-align:center}}nav.secondary_nav.secondary_nav_desktop .section_title{display:none}nav.secondary_nav.secondary_nav_desktop .section_title a{padding-left:0;text-decoration:none}nav.secondary_nav.secondary_nav_desktop li{display:inline-block;position:relative;margin-bottom:0}nav.secondary_nav.secondary_nav_desktop a{color:#777;font-size:1em;font-weight:600;display:block;padding:.3em .3em}@media (min-width: 769px), print{nav.secondary_nav.secondary_nav_desktop a{padding:.3em .6em}}@media (min-width: 1200px){nav.secondary_nav.secondary_nav_desktop a{padding:.3em .9em}}@media (min-width: 1700px){nav.secondary_nav.secondary_nav_desktop a{font-size:1.1em}}.custom_banner_container nav.secondary_nav.secondary_nav_desktop a{color:white}nav.secondary_nav.secondary_nav_desktop ul{white-space:nowrap}nav.secondary_nav.secondary_nav_desktop li.current a,nav.secondary_nav.secondary_nav_desktop li:hover a{text-decoration:none;color:#222}nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav .grid_layout{display:flex;flex-wrap:nowrap;justify-content:space-between}@media (min-width: 1200px){nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav{position:fixed;width:100%;top:0;left:0;z-index:100;box-shadow:0 4px 4px -2px rgba(0,0,0,0.15)}nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav.secondary_nav_desktop{padding:1em 0 0.8em;white-space:nowrap}nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav .section_title{display:inline-block;margin-top:3px;margin-right:1.6em;font-size:1.2em;flex-shrink:0}nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav .section_title a{padding:0;color:#2B2B2B}}@media (min-width: 1200px) and (min-width: 1700px){nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav .section_title{margin-top:6px}}@media (min-width: 1200px){nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav ul{display:inline-block;text-align:right;width:100%}}@media (min-width: 1200px) and (min-width: 1024px), print and (min-width: 1200px){nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li a{padding:.3em .5em;font-size:0.9em}}@media (min-width: 1200px) and (min-width: 1200px){nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li a{padding:.3em .6em;font-size:0.95em}}@media (min-width: 1200px) and (min-width: 1700px){nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li a{padding:.3em .8em;font-size:1em}}@media (min-width: 1200px){nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li.current a,nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav a:hover,nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav .section_title a:hover{text-decoration:none;color:#2B2B2B}nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li:last-of-type a{padding-right:0}}.custom_banner_container nav.secondary_nav.secondary_nav_desktop,.homepage_feature_container nav.secondary_nav.secondary_nav_desktop{text-align:center;margin:0;background-color:transparent}.custom_banner_container nav.secondary_nav.secondary_nav_desktop li,.homepage_feature_container nav.secondary_nav.secondary_nav_desktop li{margin-bottom:6px}.custom_banner_container nav.secondary_nav.secondary_nav_desktop li a,.homepage_feature_container nav.secondary_nav.secondary_nav_desktop li a{color:white}.custom_banner_container nav.secondary_nav.secondary_nav_desktop li.current:after,.homepage_feature_container nav.secondary_nav.secondary_nav_desktop li.current:after{bottom:-60px;left:50%;border:solid transparent;content:\" \";height:0;width:0;position:absolute;pointer-events:none;border-top-color:black;border-width:20px;margin-left:-20px}.custom_banner_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav,.homepage_feature_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav{background-color:#e4e7ec}.custom_banner_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li.current:after,.homepage_feature_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li.current:after{content:none}.custom_banner_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li a,.homepage_feature_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li a{color:#fff}.custom_banner_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li a:hover,.homepage_feature_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li a:hover{color:#2B2B2B}.custom_banner_container nav.secondary_nav.secondary_nav_mobile,.homepage_feature_container nav.secondary_nav.secondary_nav_mobile{text-align:center;padding:0 2.5%}.custom_banner_container nav.secondary_nav.secondary_nav_mobile select,.homepage_feature_container nav.secondary_nav.secondary_nav_mobile select{position:relative;padding:.5em 2em .5em 1em;font-size:16px;border:0;height:40px;vertical-align:middle;color:white;-webkit-appearance:none;-o-appearance:none;-moz-appearance:none;background:#3b788b url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat 95% 10px;background-position:right .8em top 10px;background-size:9px;font-weight:700;cursor:pointer;width:100%;border-radius:5px;max-width:304px;margin:0.9em 0 1.1em}.custom_banner_container nav.secondary_nav.secondary_nav_mobile select::-ms-expand,.homepage_feature_container nav.secondary_nav.secondary_nav_mobile select::-ms-expand{display:none}.custom_banner_container nav.secondary_nav.secondary_nav_mobile select option,.homepage_feature_container nav.secondary_nav.secondary_nav_mobile select option{padding:0.5em 1em}.homepage_feature_container nav.secondary_nav{position:absolute;bottom:0;z-index:2}.homepage_feature_container nav.secondary_nav.secondary_nav_desktop{width:100%}.homepage_feature_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav{bottom:auto}.homepage_feature_container nav.secondary_nav.secondary_nav_desktop.fixed_secondary_nav li.current:after{content:none}#explore_overlay nav.secondary_nav{display:none}.megasection_nav_present.msl nav.secondary_nav.secondary_nav_desktop,.megasection_nav_present.msl nav.secondary_nav.secondary_nav_mobile select{background-color:#e34e41;border:0}.megasection_nav_present.msl nav.secondary_nav.secondary_nav_desktop li.current a,.megasection_nav_present.msl nav.secondary_nav.secondary_nav_mobile select li.current a{color:#2B2B2B}.megasection_nav_present.msl nav.secondary_nav.secondary_nav_desktop li a,.megasection_nav_present.msl nav.secondary_nav.secondary_nav_mobile select li a{color:white}.megasection_nav_present.msl nav.secondary_nav.secondary_nav_desktop li a:hover,.megasection_nav_present.msl nav.secondary_nav.secondary_nav_mobile select li a:hover{color:#2B2B2B}body#facts nav.secondary_nav_mobile select{color:initial;background:#AFB3B9 url(http://localhost:3000/assets/[email protected]) no-repeat 95% 10px;background-position:right .8em top 10px;background-size:9px}nav.tertiary_nav{position:relative;margin-top:0.8em;font-weight:400;display:block;text-align:center}@media (min-width: 600px), print{nav.tertiary_nav{text-align:left}}nav.tertiary_nav select{position:relative;padding:.5em 2em .5em 1em;font-size:16px;border:0;height:40px;vertical-align:middle;color:white;-webkit-appearance:none;-o-appearance:none;-moz-appearance:none;background:#3b788b url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat 95% 10px;background-position:right .8em top 10px;background-size:9px;font-weight:700;cursor:pointer;width:100%;border-radius:5px;max-width:304px;font-weight:400;color:black;margin:0 auto;border:1px solid #B3B3B3;border-radius:0;background:#fff url(\"https://mars.nasa.gov/assets/triangle_down.svg\") no-repeat 94% 15px}nav.tertiary_nav select::-ms-expand{display:none}nav.tertiary_nav select option{padding:0.5em 1em}nav.tertiary_nav ul li{position:relative;display:inline-block;vertical-align:middle}nav.tertiary_nav ul li:hover a,nav.tertiary_nav ul li.current a{color:black}nav.tertiary_nav ul li+li:before{content:\" | \";padding:0 .5em;vertical-align:middle;font-weight:100;color:#BEBEBE}nav.tertiary_nav ul a{display:inline-block;vertical-align:middle;color:#909090}nav.tertiary_nav ul a:hover{text-decoration:none}@media (min-width: 769px), print{nav.tertiary_nav ul a{font-size:1.2em}}@media (min-width: 1024px), print{nav.tertiary_nav ul a{font-size:1.3em}}@media (min-width: 1200px){nav.tertiary_nav ul a{font-size:1.4em}}.tertiary_nav.feature_tertiary_nav{text-align:center}.tertiary_nav.feature_tertiary_nav ul li{position:relative;display:inline-block;vertical-align:middle}.tertiary_nav.feature_tertiary_nav ul li:hover a,.tertiary_nav.feature_tertiary_nav ul li.current a{color:black}.tertiary_nav.feature_tertiary_nav ul li+li:before{content:\" \";padding:0 .5em;vertical-align:middle;font-weight:100;color:#BEBEBE}@media (min-width: 769px), print{.tertiary_nav.feature_tertiary_nav ul a{font-size:1.1em}}@media (min-width: 1024px), print{.tertiary_nav.feature_tertiary_nav ul a{font-size:1.2em}}@media (min-width: 1200px){.tertiary_nav.feature_tertiary_nav ul a{font-size:1.3em}}.condense_control{color:#257cdf}.condense_control:hover{text-decoration:underline}.condense_control:before{content:' › ';white-space:nowrap}section.intro{display:block;background-color:#000;position:absolute;top:0;left:0;z-index:99;width:100%;overflow:hidden;height:100vh}section.intro .brand_area{background:url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat;background-size:100%;z-index:301;position:absolute;top:2%;left:4%;width:60%;height:80%;max-width:500px}@media (min-width: 769px), print{section.intro .brand_area{width:45%;left:2%}}section.intro img{-o-object-fit:cover;object-fit:cover;height:100%;width:100%}@media (min-width: 480px){section.intro img{margin-top:0}}body.intro_screen_visible .vital_signs_menu,body.intro_screen_visible .more_bar{z-index:100}body.intro_screen_visible .vital_signs_menu .overlay_icon{display:none}body.intro_screen_visible section.more_bar .title,body.intro_screen_visible section.more_bar .arrow_down{display:none}body.intro_screen_visible section.more_bar:after{content:\"loading...\";display:inline-block;padding:0.6em 0;font-size:.9em}html.explore_overlay_open,body.explore_overlay_open{overflow:hidden;width:100%;height:100%;position:fixed;-ms-overflow-style:-ms-autohiding-scrollbar}#explore_overlay{position:fixed;top:0;left:0;height:100vh;width:100%;z-index:1000001;overflow-x:hidden;visibility:hidden;opacity:0;padding:0 0 6px;background-color:rgba(0,0,0,0.9)}.overlay_loaded #explore_overlay{background-color:#000}#explore_overlay.visible{visibility:visible}#explore_overlay .content{position:relative;height:100%;visibility:hidden;opacity:0}#explore_overlay .content.visible{visibility:visible}#explore_overlay .content>iframe{top:0;left:0;position:absolute}#explore_overlay .loading{position:absolute;left:50%;top:42vh;transform:translateX(-50%);width:auto;text-align:center;display:none}#explore_overlay .loading img{width:44px;height:44px}#explore_overlay .loading p{font-family:Whitney, Helvetica, Arial, sans-serif;position:relative;color:#76aee6;font-size:14px;letter-spacing:0.1em}#explore_overlay .loading .spinner div{background:#ccc !important}#explore_overlay .background_area{-webkit-tap-highlight-color:transparent;-webkit-tap-highlight-color:transparent;width:100%;height:100%;position:absolute;top:0;left:0;cursor:pointer;z-index:-1}#explore_overlay.lightbox_overlay{background-color:rgba(0,0,0,0.75);text-align:center;padding:0}#explore_overlay.lightbox_overlay .content{position:fixed;background-color:#1f1f1f;width:95%;height:92% !important;max-width:1400px;margin:2em auto 0;border-radius:4px;left:auto;right:calc(50vw - 47.5%)}@media only screen and (min-width: 1480px){#explore_overlay.lightbox_overlay .content{right:calc(50vw - 697px)}}@media only screen and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 1){#explore_overlay.lightbox_overlay .content{overflow-y:scroll;-webkit-overflow-scrolling:touch}}.overlay_close_button{position:absolute;top:1em;right:1.1em;z-index:1000003;width:40px;height:40px;position:fixed;background:#000;text-decoration:none;text-align:center;line-height:1em;transition:.3s opacity;visibility:hidden;opacity:0}.overlay_close_button.visible{visibility:visible}.no-touchevents .overlay_close_button:hover{opacity:1}.overlay_close_button .close_icon{display:block;height:100%;position:relative}.overlay_close_button .close_icon:before{transform:rotate(-45deg);content:'';position:absolute;height:1px;width:100%;top:calc(50% - .5px);left:0;background:#fff}.overlay_close_button .close_icon:after{transform:rotate(45deg);content:'';position:absolute;height:1px;width:100%;top:calc(50% - .5px);left:0;background:#fff}@media (min-width: 769px), print{.overlay_close_button{width:60px;height:60px;top:1.1em;right:1.1em}}@media (min-width: 1700px){.overlay_close_button{width:70px;height:70px;top:1.2em;right:1.2em}}.overlay_close_button.lightbox_overlay{background-color:#1f1f1f;top:2.5em;right:calc(50vw - 45.5%)}@media (min-width: 600px), print{.overlay_close_button.lightbox_overlay{right:calc(50vw - 45%)}}@media (min-width: 769px), print{.overlay_close_button.lightbox_overlay{top:2.6em;width:50px;height:50px}}@media (min-width: 1024px), print{.overlay_close_button.lightbox_overlay{right:calc(50vw - 45.5%)}}@media only screen and (min-width: 1480px){.overlay_close_button.lightbox_overlay{right:calc(50vw - 680px)}}@media (min-width: 1700px){.overlay_close_button.lightbox_overlay{top:2.7em;width:60px;height:60px}}#iframe_overlay,#iframe_overlay body{height:100%;overflow-y:auto;-webkit-overflow-scrolling:touch;font-weight:400}#iframe_overlay{width:1px;min-width:100%;word-wrap:break-word;color:#e4e3e3}#iframe_overlay p,#iframe_overlay .release_date{color:#e4e3e3}#iframe_overlay hr{border-color:#3c3c3c}#iframe_overlay a{color:#98c7fc}#iframe_overlay .header_mask{display:none}#iframe_overlay .explore_overlay_page{padding-bottom:4em}#iframe_overlay .done_btn{text-align:center}#iframe_overlay .done_btn button{color:#6bbed8;margin:2em 0;padding:.3em .7em .4em;background:none;cursor:pointer;letter-spacing:1px;font-weight:300;outline:none;position:relative;font-size:1.8em;border:1px solid #6bbed8;transition:color 200ms, border-color 200ms}#iframe_overlay .done_btn button::after{content:'Close'}#iframe_overlay .done_btn button:hover{color:#82ddf9;border-color:#82ddf9}#iframe_overlay .left_col,#iframe_overlay .right_col{position:relative;float:left}#iframe_overlay .left_col{width:100%}@media (min-width: 769px), print{#iframe_overlay .left_col{width:65%;border-right:1px solid #BEBEBE;padding-right:1em}}@media (min-width: 1200px){#iframe_overlay .left_col{padding-right:3em}}#iframe_overlay .right_col{width:100%}#iframe_overlay .right_col p{color:#868686}#iframe_overlay .right_col p b{color:#222}@media (min-width: 769px), print{#iframe_overlay .right_col{width:35%;padding-left:1em;left:-1px}}@media (min-width: 1200px){#iframe_overlay .right_col{padding-left:3em}}#iframe_overlay .suggested_features{display:none}#iframe_overlay #secondary_column aside.boxed{border-color:#5a5a5a}#iframe_overlay #secondary_column .related_content_module{border-color:#5a5a5a}#iframe_overlay #secondary_column .related_content_module li{border-color:#3c3c3c;padding:.8em 0}#iframe_overlay table th{background-color:#1f1f1f}#iframe_overlay table td{background-color:#000}#iframe_overlay table.mb_table td{background-color:transparent}#iframe_overlay table.mb_table th{background-color:#1f1f1f;color:#e4e3e3}#iframe_overlay table.mb_table tr:nth-child(even){background-color:#1f1f1f}#iframe_overlay table.mb_table tr:nth-child(odd){background-color:#000}#iframe_overlay table.mb_table td{border:1px solid #505050}#iframe_overlay table.mb_table td:first-child{border-left:transparent}#iframe_overlay table.mb_table td:last-child{border-right:transparent}#iframe_overlay .table_wrapper>div::-webkit-scrollbar-track{box-shadow:0 0 2px rgba(0,0,0,0.15) inset;background:#f0f0f0}#iframe_overlay .table_wrapper>div::-webkit-scrollbar-thumb{background:#ccc}#iframe_overlay .table_wrapper.has-scroll:after{box-shadow:-5px 0 10px rgba(0,0,0,0.25)}#iframe_overlay .article_nav{display:none}.info_tabs_module{position:relative;color:black;background:url(\"https://mars.nasa.gov/assets/mars_landscape.jpg\") center top no-repeat;background-size:cover}@media (min-width: 769px), print{.info_tabs_module{height:620px;background-position:center bottom}}.info_tabs_module div[data-react-class=\"InfoTabs\"]{height:100%}.info_tabs_module .grid_layout{padding-bottom:10em}@media (min-width: 769px), print{.info_tabs_module .grid_layout{padding-bottom:0}}.info_tabs_module .gradient_container_bottom{display:none}.info_tabs_module .info_tabs{padding:2.7em 0 5em;height:100%}@media (min-width: 769px), print{.info_tabs_module .info_tabs{padding:5.3em 0 5em}}.info_tabs_module .col1,.info_tabs_module .col2{width:100%}@media (min-width: 769px), print{.info_tabs_module .col1,.info_tabs_module .col2{width:48%}}.info_tabs_module .col2{display:none;float:right;margin-top:2rem}@media (min-width: 769px), print{.info_tabs_module .col2{display:block;margin-top:0}}.info_tabs_module .col1{float:left}.info_tabs_module .info_tabs_header{width:100%;margin-bottom:1.8em;display:inline-block;text-align:center}@media (min-width: 769px), print{.info_tabs_module .info_tabs_header{text-align:left;margin-bottom:3em}}.info_tabs_module .info_tabs_header h2{font-size:1.69em;margin-bottom:0em;margin-top:1.2em;font-weight:300}@media (min-width: 600px), print{.info_tabs_module .info_tabs_header h2{font-size:1.95em;margin-bottom:0em}}@media (min-width: 769px), print{.info_tabs_module .info_tabs_header h2{font-size:2.21em;margin-bottom:0em}}@media (min-width: 1024px), print{.info_tabs_module .info_tabs_header h2{font-size:2.34em;margin-bottom:0em}}@media (min-width: 1200px){.info_tabs_module .info_tabs_header h2{font-size:2.47em;margin-bottom:0em}}@media (min-width: 769px), print{.info_tabs_module .info_tabs_header h2{margin-top:0}}.info_tabs_module .info_tabs_links{padding-left:2rem;position:relative;z-index:2;font-size:1.3rem;font-weight:300;width:90%}@media (min-width: 769px), print{.info_tabs_module .info_tabs_links{width:auto}}.info_tabs_module .info_tabs_links li{cursor:pointer;position:relative;margin-bottom:0.3em}.info_tabs_module .info_tabs_links .tab_title{margin-bottom:0.2em;letter-spacing:-0.02em}.info_tabs_module .info_tabs_links .info_tabs_link:before{content:'';width:0;height:0;border-top:7px solid transparent !important;border-bottom:7px solid transparent !important;border-left:11px solid #943b2b;display:inline-block;transform:none;position:absolute;left:-20px;top:7px;opacity:0;transition:all 200ms}.no-touchevents .info_tabs_module .info_tabs_links .info_tabs_link:not(.active):hover:before,.info_tabs_module .info_tabs_links .active:before{opacity:1;left:-28px}.no-touchevents .info_tabs_module .info_tabs_links .info_tabs_link:not(.active):hover:before{opacity:.7}.info_tabs_module .info_tabs_detail,.info_tabs_module .active .mobile_tab_detail{float:right;max-height:320px;overflow-y:auto;padding-right:1em;position:relative;z-index:2;font-weight:300;width:100%;-webkit-overflow-scrolling:touch}.info_tabs_module .info_tabs_detail::-webkit-scrollbar,.info_tabs_module .active .mobile_tab_detail::-webkit-scrollbar{width:5px}.info_tabs_module .info_tabs_detail::-webkit-scrollbar-thumb,.info_tabs_module .active .mobile_tab_detail::-webkit-scrollbar-thumb{background-color:rgba(107,107,107,0.6)}.info_tabs_module .info_tabs_detail::-webkit-scrollbar-track,.info_tabs_module .active .mobile_tab_detail::-webkit-scrollbar-track{background-color:rgba(157,157,157,0.4)}@media (min-width: 769px), print{.info_tabs_module .info_tabs_detail,.info_tabs_module .active .mobile_tab_detail{padding-right:3em;top:0.8em}}.info_tabs_module .info_tabs_detail .info_tabs_title,.info_tabs_module .active .mobile_tab_detail .info_tabs_title{display:none}@media (min-width: 769px), print{.info_tabs_module .info_tabs_detail .info_tabs_title,.info_tabs_module .active .mobile_tab_detail .info_tabs_title{display:block;font-size:1.1em;margin-bottom:1em;margin-top:0;text-transform:uppercase}}.info_tabs_module .mobile_tab_detail{display:none}.info_tabs_module .active .mobile_tab_detail{font-size:0.95rem;float:none;display:block}@media (min-width: 769px), print{.info_tabs_module .active .mobile_tab_detail{display:none}}.info_tabs_module .active .tab_title{margin-bottom:.5em}@media (min-width: 769px), print{.info_tabs_module .active .tab_title{margin-bottom:.2em}}.info_tabs_module .info_tabs_content *:first-child,.info_tabs_module .active .mobile_tab_detail *:first-child{margin-top:0}.info_tabs_module .info_tabs_content>h2,.info_tabs_module .info_tabs_content>h3,.info_tabs_module .info_tabs_content>h4,.info_tabs_module .info_tabs_content>p,.info_tabs_module .active .mobile_tab_detail>h2,.info_tabs_module .active .mobile_tab_detail>h3,.info_tabs_module .active .mobile_tab_detail>h4,.info_tabs_module .active .mobile_tab_detail>p{margin:1em 0}.info_tabs_module .info_tabs_content>h2,.info_tabs_module .info_tabs_content>h3,.info_tabs_module .info_tabs_content>h4,.info_tabs_module .active .mobile_tab_detail>h2,.info_tabs_module .active .mobile_tab_detail>h3,.info_tabs_module .active .mobile_tab_detail>h4{font-size:1.1em;margin-top:2em}@media (min-width: 769px), print{.info_tabs_module .info_tabs_content>h2,.info_tabs_module .info_tabs_content>h3,.info_tabs_module .info_tabs_content>h4,.info_tabs_module .active .mobile_tab_detail>h2,.info_tabs_module .active .mobile_tab_detail>h3,.info_tabs_module .active .mobile_tab_detail>h4{margin-top:0}}.info_tabs_module .info_tabs_content>h3,.info_tabs_module .info_tabs_content>h4,.info_tabs_module .active .mobile_tab_detail>h3,.info_tabs_module .active .mobile_tab_detail>h4{margin-top:1.5em}.info_tabs_module .info_tabs_content>p:last-child{margin-bottom:1em}.info_tabs_module .info_tabs_content ol{margin-bottom:0}.info_tabs_module .active .mobile_tab_detail>p:last-child{margin-bottom:0}.info_tabs_module .less_option,.info_tabs_module .more_option{display:inline-block;font-size:.95rem;margin-bottom:0.5em}@media (min-width: 769px), print{.info_tabs_module .less_option,.info_tabs_module .more_option{display:none}}.info_tabs_module .less_option:after{content:\"- less\";display:block}.info_tabs_module .more_option:after{content:\"+ more\";display:block}.info_tabs_module footer{width:90%;max-width:1330px;position:absolute;bottom:50px;right:0;left:0;margin:auto;text-align:right}.info_tabs_module .more_link{font-size:1rem;font-weight:500;text-transform:uppercase;color:white;cursor:pointer}span.no_wrap{display:inline;white-space:nowrap}.info_tip{white-space:normal;display:inline-block;vertical-align:middle;padding:14px 3px 0 3px;margin-top:-10px}.info_tip:hover svg path{fill:black}.homepage_dashboard_modal .info_tip svg circle{fill:#d9cbbe}.homepage_dashboard_modal .info_tip svg .inner_icon{fill:black}#iframe_overlay .info_tip svg circle{fill:#d9cbbe}#iframe_overlay .info_tip svg .inner_icon{fill:black}#primary_column .info_tip{margin-top:-17px}.info_tip .info_icon{display:inline;text-align:center;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -100px 0;background-size:300px;background:none}.info_tip .info_text{display:none}.info_tip .info_icon:before{display:none;content:'';position:absolute;width:15px;height:15px;background:white;border-right:1px solid #c9c9c9;border-bottom:1px solid #c9c9c9;z-index:1;transform:rotate(45deg);margin-top:-24px;margin-left:2px}.info_tip .info_text{display:none;position:absolute;color:#222;font-size:.9em;background-color:white;padding:18px;border:1px solid #c9c9c9;border-radius:4px;width:calc(100% + 12px);left:-6px;transform:translateY(-100%);margin-top:-41px}.homepage_dashboard_modal .info_tip .info_text{left:0}@media (min-width: 1200px){.info_tip .info_text{font-size:.8em}}.info_tip.open .info_icon:before{display:block}.info_tip.open .info_text{display:block}.homepage_dashboard_modal .info_tip .info_icon:before{background-color:#221307;border-right:1px solid #5f4326;border-bottom:1px solid #5f4326}.homepage_dashboard_modal .info_tip .info_text{color:#beb0a4;background-color:#221307;border:1px solid #5f4326}@media (min-width: 769px){.parallax_categorized_teaser .bubble_container{max-height:788px}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px){.parallax_categorized_teaser .bubble_container .oculus{transform:scale(0.8)}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(1){top:-30px;left:-20px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(2){top:-30px;left:224px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(3){top:214px;left:-20px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(4){top:214px;left:224px}}@media (min-width: 769px) and (min-width: 1024px), print and (min-width: 769px){.parallax_categorized_teaser .bubble_container .oculus{transform:scale(0.9)}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(1){top:0;left:119px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(2){top:70px;left:408px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(3){left:0;top:269px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(4){top:347px;left:290px}}@media (min-width: 769px) and (min-width: 1200px){.parallax_categorized_teaser .bubble_container .oculus{position:absolute;transform:scale(1)}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(1){top:0;left:179px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(2){top:104px;left:495px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(3){top:282px;left:0}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(4){top:390px;left:324px}}@media (min-width: 769px) and (min-width: 1700px){.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(1){top:0;left:229px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(2){top:134px;left:565px}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(3){top:272px;left:0}.parallax_categorized_teaser .bubble_container .oculus:nth-of-type(4){top:420px;left:354px}}@media (min-width: 769px){.parallax_categorized_teaser .bubble_container{height:75vh}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px){.parallax_categorized_teaser .definition_teasers.two .oculus{transform:scale(0.8)}.parallax_categorized_teaser .definition_teasers.two .oculus:nth-of-type(1){top:-30px;left:-20px}.parallax_categorized_teaser .definition_teasers.two .oculus:nth-of-type(2){top:-30px;left:224px}}@media (min-width: 769px) and (min-width: 1024px), print and (min-width: 769px){.parallax_categorized_teaser .definition_teasers.two .oculus{transform:scale(0.9)}.parallax_categorized_teaser .definition_teasers.two .oculus:nth-of-type(1){top:30px;left:70px}.parallax_categorized_teaser .definition_teasers.two .oculus:nth-of-type(2){top:30px;left:378px}}@media (min-width: 769px) and (min-width: 1200px){.parallax_categorized_teaser .definition_teasers.two .oculus{position:absolute;transform:scale(1)}.parallax_categorized_teaser .definition_teasers.two .oculus:nth-of-type(1){top:40px;left:70px}.parallax_categorized_teaser .definition_teasers.two .oculus:nth-of-type(2){top:40px;left:422px}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px){.parallax_categorized_teaser .definition_teasers.three .oculus{transform:scale(0.8)}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(1){top:-30px;left:100px}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(2){top:185px;left:-20px}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(3){top:185px;left:224px}}@media (min-width: 769px) and (min-width: 1024px), print and (min-width: 769px){.parallax_categorized_teaser .definition_teasers.three .oculus{transform:scale(0.9)}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(1){top:0;left:204px}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(2){top:280px;left:30px}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(3){top:280px;left:378px}}@media (min-width: 769px) and (min-width: 1200px){.parallax_categorized_teaser .definition_teasers.three .oculus{position:absolute;transform:scale(1)}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(1){top:20px;left:226px}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(2){top:310px;left:30px}.parallax_categorized_teaser .definition_teasers.three .oculus:nth-of-type(3){top:310px;left:432px}}@media (min-width: 769px){.parallax_categorized_teaser .definition_teasers.four{max-height:788px}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px){.parallax_categorized_teaser .definition_teasers.four .oculus{transform:scale(0.8)}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(1){top:-30px;left:-20px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(2){top:-30px;left:224px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(3){top:214px;left:-20px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(4){top:214px;left:224px}}@media (min-width: 769px) and (min-width: 1024px), print and (min-width: 769px){.parallax_categorized_teaser .definition_teasers.four .oculus{transform:scale(0.9)}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(1){top:0;left:119px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(2){top:70px;left:408px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(3){left:0;top:269px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(4){top:347px;left:290px}}@media (min-width: 769px) and (min-width: 1200px){.parallax_categorized_teaser .definition_teasers.four .oculus{position:absolute;transform:scale(1)}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(1){top:0;left:179px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(2){top:104px;left:495px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(3){top:282px;left:0}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(4){top:390px;left:324px}}@media (min-width: 769px) and (min-width: 1700px){.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(1){top:0;left:229px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(2){top:134px;left:565px}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(3){top:272px;left:0}.parallax_categorized_teaser .definition_teasers.four .oculus:nth-of-type(4){top:420px;left:354px}}@media (min-width: 769px) and (min-width: 769px), print and (min-width: 769px){.parallax_categorized_teaser .definition_teasers.five .oculus{transform:scale(0.8)}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(1){top:-30px;left:-20px}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(2){top:-30px;left:224px}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(3){top:214px;left:-20px}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(4){top:214px;left:224px}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(5){top:432px;left:102px}}@media (min-width: 769px) and (min-width: 1024px), print and (min-width: 769px){.parallax_categorized_teaser .definition_teasers.five .oculus{transform:scale(0.9)}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(1){top:0;left:0}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(2){top:0;left:408px}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(3){top:200px;left:204px}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(4){top:400px;left:0}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(5){top:400px;left:408px}}@media (min-width: 769px) and (min-width: 1200px){.parallax_categorized_teaser .definition_teasers.five .oculus{position:absolute;transform:scale(1)}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(1){top:0;left:0}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(2){top:0;left:452px}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(3){top:200px;left:226px}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(4){top:400px;left:0}.parallax_categorized_teaser .definition_teasers.five .oculus:nth-of-type(5){top:400px;left:452px}}.parallax_categorized_teaser{height:auto;background:url(\"https://mars.nasa.gov/assets/red_planet_bg.jpg\") center no-repeat;background-size:cover;color:#eeaaa1;overflow:hidden;position:relative;padding-top:3em}@media (min-width: 769px){.parallax_categorized_teaser{height:calc(100vh - 74px);padding-top:4em;min-height:860px}}@media (min-width: 1200px){.parallax_categorized_teaser{padding-top:5em}}@media (min-width: 769px){.parallax_categorized_teaser .module_content{height:calc(100% - 36px)}}.parallax_categorized_teaser .module_content.fixed{position:fixed;top:82px;left:0}.parallax_categorized_teaser .module_title{font-size:2em;font-weight:200;text-align:center;margin-bottom:0.85em}@media (min-width: 769px){.parallax_categorized_teaser .module_title{text-align:left;margin-bottom:1em}}@media (min-width: 1200px){.parallax_categorized_teaser .module_title{font-size:2.2em}}.parallax_categorized_teaser .mobile_only{display:block}@media (min-width: 769px){.parallax_categorized_teaser .mobile_only{display:none}}.parallax_categorized_teaser .categorized_content{width:100%;top:0;left:0;right:0;bottom:0;margin-bottom:0}@media (min-width: 769px){.parallax_categorized_teaser .categorized_content{width:55%;max-width:795px;position:absolute;top:80px;left:38%}}@media (min-width: 769px) and (min-width: 600px), print and (min-width: 769px){.parallax_categorized_teaser .categorized_content{width:58%}}@media (min-width: 769px) and (min-width: 1024px), print and (min-width: 769px){.parallax_categorized_teaser .categorized_content{left:33.5%;width:61.2%}}@media (min-width: 769px) and (min-width: 1200px){.parallax_categorized_teaser .categorized_content{left:34.5%;top:100px}}@media (min-width: 769px) and (min-width: 1700px){.parallax_categorized_teaser .categorized_content{position:relative;left:0;top:20px}}.parallax_categorized_teaser .categorized_content .content_for{position:relative;display:none}@media (min-width: 769px){.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents{padding:0 40px 0 0;max-height:71vh;overflow:hidden;overflow-y:auto}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents::-webkit-scrollbar{width:5px}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0.4)}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents::-webkit-scrollbar-track{background-color:rgba(255,255,255,0.1)}}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h2,.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h3,.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h4,.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>p{margin:1em 1.5em}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h2,.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h3,.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h4{color:#eeaaa1;font-size:1.1em;font-weight:400;margin-top:2em}@media (min-width: 769px){.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h2,.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h3,.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h4{margin-top:0}}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h2{text-transform:uppercase}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h3,.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>h4{margin-top:1.5em}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>p{color:#e3e3e3;max-width:640px}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>p:last-child{margin-bottom:2em}@media (min-width: 769px){.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>p:last-child{margin-bottom:1em}}.parallax_categorized_teaser .categorized_content .content_for .bubble_container_contents>p a{color:#54b3da}.parallax_categorized_teaser .categorized_content .content_for.current{display:block}@media (min-width: 769px){.parallax_categorized_teaser .categorized_content .content_for{position:absolute;display:block;opacity:0;left:1000px;top:0;transition:all 400ms;width:100%}.parallax_categorized_teaser .categorized_content .content_for.current{left:0;top:0;opacity:1;display:block !important}}.parallax_categorized_teaser .carousels{height:100%;width:100%}.parallax_categorized_teaser footer{position:absolute;height:50px;bottom:0;left:0;width:100vw;background-color:rgba(129,33,24,0.6)}.parallax_categorized_teaser .oculus{position:relative;text-align:center;background-size:cover;height:186px;padding:1.5em 0;border-bottom:3px solid #5fb4ce;margin-bottom:0;overflow:hidden;background-color:rgba(32,52,66,0.39);color:#c7d9de}@media (min-width: 769px){.parallax_categorized_teaser .oculus{padding:0;position:absolute;width:275px;height:275px}}.parallax_categorized_teaser .oculus h3.carousel_title{position:absolute;font-size:.9rem;text-align:center;margin:0 auto 12px;width:auto;font-weight:300}@media (max-width: 768px){.parallax_categorized_teaser .oculus h3.carousel_title{left:50%;transform:translateX(-50%)}}@media (min-width: 769px){.parallax_categorized_teaser .oculus h3.carousel_title{position:relative;width:50%;margin:24px auto 12px}}.parallax_categorized_teaser .oculus h3.description_title{font-size:.9rem;font-weight:400;margin:0 0 12px}@media (min-width: 769px){.parallax_categorized_teaser .oculus h3.description_title{margin:17px 0 12px}}.parallax_categorized_teaser .oculus span.mobile_only_title{font-weight:200}@media (min-width: 769px){.parallax_categorized_teaser .oculus span.mobile_only_title{display:none}}.parallax_categorized_teaser .oculus .slide_description{padding:0 2em;font-weight:400}.parallax_categorized_teaser .oculus .cols{display:flex;margin-left:-6px;margin-right:-6px}.parallax_categorized_teaser .oculus .cols .col{margin:0 auto;max-width:55%}.parallax_categorized_teaser .oculus .cols .val{font-size:2rem;font-weight:400;letter-spacing:-.05em}.parallax_categorized_teaser .oculus .cols .val.small_text{font-size:1.6rem}.parallax_categorized_teaser .oculus .cols .val_label{font-size:.9rem;font-weight:300}@media (min-width: 769px){.parallax_categorized_teaser .oculus{border:3px solid #5fb4ce;border-radius:50%}}.parallax_categorized_teaser .oculus .carousel_title{color:#445c64}.parallax_categorized_teaser .oculus .title,.parallax_categorized_teaser .oculus .hover{color:#c7d9de}.parallax_categorized_teaser .oculus .slick-prev:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #5998ac;display:inline-block;transform:rotate(180deg)}.parallax_categorized_teaser .oculus .slick-prev:before,.parallax_categorized_teaser .oculus .slick-next:before{background-image:none}.parallax_categorized_teaser .oculus .slick-next:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #5998ac;display:inline-block;transform:none}.parallax_categorized_teaser .oculus.data{border-bottom:3px solid #5fb4ce;margin-bottom:0;overflow:hidden;background-color:rgba(32,52,66,0.39);color:#c7d9de}@media (min-width: 769px){.parallax_categorized_teaser .oculus.data{border:3px solid #5fb4ce;border-radius:50%}}.parallax_categorized_teaser .oculus.data .carousel_title{color:#445c64}.parallax_categorized_teaser .oculus.data .title,.parallax_categorized_teaser .oculus.data .hover{color:#c7d9de}.parallax_categorized_teaser .oculus.data .slick-prev:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #5998ac;display:inline-block;transform:rotate(180deg)}.parallax_categorized_teaser .oculus.data .slick-prev:before,.parallax_categorized_teaser .oculus.data .slick-next:before{background-image:none}.parallax_categorized_teaser .oculus.data .slick-next:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #5998ac;display:inline-block;transform:none}.parallax_categorized_teaser .oculus.data h3.carousel_title{display:none}@media (min-width: 769px){.parallax_categorized_teaser .oculus.data h3.carousel_title{display:block}}.parallax_categorized_teaser .oculus.data .carousel_title{color:#6b93a0}.parallax_categorized_teaser .oculus.data .val{color:white}.parallax_categorized_teaser .oculus.data .note{margin-top:15px;font-size:.75rem;font-weight:300}@media (min-width: 769px){.parallax_categorized_teaser .oculus.data .slick-slide.slide{background-color:rgba(95,180,206,0.1)}}.parallax_categorized_teaser .oculus.images{border-bottom:3px solid #f56b60;margin-bottom:0;overflow:hidden;background-color:rgba(0,0,0,0.39);color:#f06c60;padding:0}@media (min-width: 769px){.parallax_categorized_teaser .oculus.images{border:3px solid #f56b60;border-radius:50%}}.parallax_categorized_teaser .oculus.images .carousel_title{color:#f06c60}.parallax_categorized_teaser .oculus.images .title,.parallax_categorized_teaser .oculus.images .hover{color:#ffddcf}.parallax_categorized_teaser .oculus.images .slick-prev:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f06c60;display:inline-block;transform:rotate(180deg)}.parallax_categorized_teaser .oculus.images .slick-prev:before,.parallax_categorized_teaser .oculus.images .slick-next:before{background-image:none}.parallax_categorized_teaser .oculus.images .slick-next:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f06c60;display:inline-block;transform:none}.parallax_categorized_teaser .oculus.images h3.carousel_title{z-index:1;background-color:rgba(86,42,42,0.65);text-align:center;padding:5px 14px;border-radius:6px;margin-top:1.2em}@media (max-width: 768px){.parallax_categorized_teaser .oculus.images h3.carousel_title{color:#ffbdb7}}@media (min-width: 769px){.parallax_categorized_teaser .oculus.images h3.carousel_title{background-color:transparent;padding:0;margin-top:24px}}.parallax_categorized_teaser .oculus.images a.hover_state{display:block;height:100%;width:100%;position:absolute;top:0}.parallax_categorized_teaser .oculus.images .rollover_description{background-color:rgba(86,42,42,0.85);padding:1em 2em;text-align:left}.parallax_categorized_teaser .oculus.images .rollover_description .title{font-size:.9rem;color:#f5dddb}.parallax_categorized_teaser .oculus.compare{border-bottom:3px solid #fcb963;margin-bottom:0;overflow:hidden;background-color:rgba(0,0,0,0.39);color:#f7ca99;background:linear-gradient(to right, rgba(53,30,1,0.46) 0%, rgba(53,30,1,0.46) 49%, rgba(10,8,9,0.47) 50%, rgba(10,8,9,0.47) 100%)}@media (min-width: 769px){.parallax_categorized_teaser .oculus.compare{border:3px solid #fcb963;border-radius:50%}}.parallax_categorized_teaser .oculus.compare .carousel_title{color:#f7ca99}.parallax_categorized_teaser .oculus.compare .title,.parallax_categorized_teaser .oculus.compare .hover{color:#f7ca99}.parallax_categorized_teaser .oculus.compare .slick-prev:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f5b460;display:inline-block;transform:rotate(180deg)}.parallax_categorized_teaser .oculus.compare .slick-prev:before,.parallax_categorized_teaser .oculus.compare .slick-next:before{background-image:none}.parallax_categorized_teaser .oculus.compare .slick-next:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f5b460;display:inline-block;transform:none}.parallax_categorized_teaser .oculus.compare h3.carousel_title{display:none}@media (min-width: 769px){.parallax_categorized_teaser .oculus.compare h3.carousel_title{display:block}}.parallax_categorized_teaser .oculus.compare .thing_one .val{color:white}.parallax_categorized_teaser .oculus.compare .thing_two{color:#66c8eb}.parallax_categorized_teaser .oculus.compare .thing{font-weight:300}.parallax_categorized_teaser .oculus.compare .details{font-size:.9rem;font-weight:300}.parallax_categorized_teaser .oculus.news{border-bottom:3px solid #f56b60;margin-bottom:0;overflow:hidden;background-color:rgba(0,0,0,0.39);color:#f06c60}@media (min-width: 769px){.parallax_categorized_teaser .oculus.news{border:3px solid #f56b60;border-radius:50%}}.parallax_categorized_teaser .oculus.news .carousel_title{color:#f06c60}.parallax_categorized_teaser .oculus.news .title,.parallax_categorized_teaser .oculus.news .hover{color:#ffddcf}.parallax_categorized_teaser .oculus.news .slick-prev:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f06c60;display:inline-block;transform:rotate(180deg)}.parallax_categorized_teaser .oculus.news .slick-prev:before,.parallax_categorized_teaser .oculus.news .slick-next:before{background-image:none}.parallax_categorized_teaser .oculus.news .slick-next:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f06c60;display:inline-block;transform:none}.parallax_categorized_teaser .oculus.news .slide_description{text-align:left}@media (max-width: 768px){.parallax_categorized_teaser .oculus.news .slide_description{margin-top:32px;padding:0 18%}}.parallax_categorized_teaser .oculus.news .slide_description a{color:#f5dddb}.parallax_categorized_teaser .oculus.news .slide_description .description{font-size:.9rem;font-weight:400}@media (min-width: 769px){.parallax_categorized_teaser .oculus.news .slick-slide.slide{background-color:rgba(86,42,42,0.58)}}.parallax_categorized_teaser .more_bar{background-color:rgba(129,33,24,0.4);transition:background-color 200ms}.parallax_categorized_teaser .more_bar:hover{background-color:rgba(129,33,24,0.7)}.parallax_categorized_teaser .more_bar .arrow_down{padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -50px -100px;background-size:300px}.parallax_categorized_teaser .more_bar .arrow_down:hover,.parallax_categorized_teaser .more_bar .arrow_down.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -50px -100px;background-size:300px}.parallax_categorized_teaser .slick-prev,.parallax_categorized_teaser .slick-next{top:calc(50% - 20px)}@media (min-width: 769px){.parallax_categorized_teaser .slick-prev,.parallax_categorized_teaser .slick-next{top:83%}}.parallax_categorized_teaser .slick-slider .slick-prev{left:2%}@media (min-width: 769px){.parallax_categorized_teaser .slick-slider .slick-prev{left:calc(50% - 35px)}}.parallax_categorized_teaser .slick-slider .slick-next{right:2%}@media (min-width: 769px){.parallax_categorized_teaser .slick-slider .slick-next{right:calc(50% - 35px)}}.parallax_categorized_teaser .slick-slide.slide{overflow:hidden;height:186px}@media (min-width: 769px){.parallax_categorized_teaser .slick-slide.slide{height:160px}}.parallax_categorized_teaser .definition_teasers .oculus{cursor:pointer}.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme{border-bottom:3px solid #fcb963;margin-bottom:0;overflow:hidden;background-color:rgba(0,0,0,0.39);color:#f7ca99}@media (min-width: 769px){.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme{border:3px solid #fcb963;border-radius:50%}}.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme .carousel_title{color:#f7ca99}.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme .title,.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme .hover{color:#f7ca99}.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme .slick-prev:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f5b460;display:inline-block;transform:rotate(180deg)}.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme .slick-prev:before,.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme .slick-next:before{background-image:none}.parallax_categorized_teaser .definition_teasers .oculus.warm_color_theme .slick-next:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f5b460;display:inline-block;transform:none}.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme{border-bottom:3px solid #5fb4ce;margin-bottom:0;overflow:hidden;background-color:rgba(32,52,66,0.39);color:#c7d9de}@media (min-width: 769px){.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme{border:3px solid #5fb4ce;border-radius:50%}}.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme .carousel_title{color:#445c64}.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme .title,.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme .hover{color:#c7d9de}.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme .slick-prev:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #5998ac;display:inline-block;transform:rotate(180deg)}.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme .slick-prev:before,.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme .slick-next:before{background-image:none}.parallax_categorized_teaser .definition_teasers .oculus.cool_color_theme .slick-next:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #5998ac;display:inline-block;transform:none}.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme{border-bottom:3px solid #f56b60;margin-bottom:0;overflow:hidden;background-color:rgba(0,0,0,0.39);color:#f06c60}@media (min-width: 769px){.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme{border:3px solid #f56b60;border-radius:50%}}.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme .carousel_title{color:#f06c60}.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme .title,.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme .hover{color:#ffddcf}.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme .slick-prev:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f06c60;display:inline-block;transform:rotate(180deg)}.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme .slick-prev:before,.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme .slick-next:before{background-image:none}.parallax_categorized_teaser .definition_teasers .oculus.sunset_color_theme .slick-next:before{width:0;height:0;border-top:9px solid transparent !important;border-bottom:9px solid transparent !important;border-left:9px solid #f06c60;display:inline-block;transform:none}.parallax_categorized_teaser .definition_teasers .title{margin-bottom:12px;font-size:1.6em}.no-touchevents .parallax_categorized_teaser .definition_teasers .title{margin-bottom:0}.parallax_categorized_teaser .definition_teasers .hover{font-size:1.2em}.parallax_categorized_teaser .definition_teasers .title,.parallax_categorized_teaser .definition_teasers .hover{margin-top:0;margin-right:10%;margin-left:10%;top:30%;position:relative;font-weight:300}.parallax_categorized_teaser .definition_teasers .title_container{position:relative;top:50%;transform:translateY(-50%)}.no-touchevents .parallax_categorized_teaser .definition_teasers .hover{display:none}.parallax_categorized_teaser .definition_teasers .bg_container{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0.25;background-size:cover;transition:-webkit-filter .4s;transition:filter .4s;transition:filter .4s, -webkit-filter .4s;-webkit-filter:brightness(60%);filter:brightness(60%)}@media (min-width: 769px){.parallax_categorized_teaser .definition_teasers .bg_container{-webkit-filter:brightness(100%);filter:brightness(100%);border-radius:50%}}.no-touchevents .parallax_categorized_teaser .definition_teasers .oculus:hover .hover{display:block}.no-touchevents .parallax_categorized_teaser .definition_teasers .oculus:hover .title{display:none}.no-touchevents .parallax_categorized_teaser .definition_teasers .oculus:hover .bg_container{-webkit-filter:brightness(60%);filter:brightness(60%)}.parallax_categorized_teaser .definition_teasers .mobile_detailed_definition{display:none;position:relative}.parallax_categorized_teaser .detailed_def_visible .detailed_definition{padding:1.4em .8em;width:98%;position:relative;display:none}@media (min-width: 769px){.parallax_categorized_teaser .detailed_def_visible .detailed_definition{padding:0;max-width:680px;width:90%;left:3%;float:left;display:block}}@media (min-width: 1024px), print{.parallax_categorized_teaser .detailed_def_visible .detailed_definition{max-width:740px;left:6%}}.parallax_categorized_teaser .detailed_def_visible .mobile_detailed_definition{display:none;padding:0 1.5em;text-align:left}@media (min-width: 769px){.parallax_categorized_teaser .detailed_def_visible .mobile_detailed_definition{display:none}}.parallax_categorized_teaser .detailed_def_visible .mobile_detailed_definition .mobile_detailed_definition_contents a{color:#54b3da}.parallax_categorized_teaser .detailed_def_visible .close_button{display:block;height:35px;width:33px;position:absolute;right:0;top:0;padding:3px;text-decoration:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none}@media (min-width: 769px){.parallax_categorized_teaser .detailed_def_visible .close_button{top:0;right:-5px}}.parallax_categorized_teaser .detailed_def_visible .close_button .close_icon{display:block;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0;background-size:300px}.parallax_categorized_teaser .detailed_def_visible .close_button .close_icon:hover,.parallax_categorized_teaser .detailed_def_visible .close_button .close_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0;background-size:300px}.parallax_categorized_teaser .detailed_def_visible p{color:#e3e3e3}.parallax_categorized_teaser .detailed_def_visible .detailed_def_title{padding:0 3%;text-decoration:none;cursor:pointer;color:#eeaaa1;font-size:1.1em;font-weight:400;display:block;text-transform:uppercase}@media (min-width: 769px){.parallax_categorized_teaser .detailed_def_visible .detailed_def_title{padding:0 10% 0 0;margin:.1em 0 0.5em;transition:color 200ms}.parallax_categorized_teaser .detailed_def_visible .detailed_def_title:hover{color:white}}.parallax_categorized_teaser .detailed_def_visible .definition_contents{padding:3%}@media (min-width: 769px){.parallax_categorized_teaser .detailed_def_visible .definition_contents{padding:0 20px 0 0}}.parallax_categorized_teaser .detailed_def_visible .definition_contents h1,.parallax_categorized_teaser .detailed_def_visible .definition_contents h2,.parallax_categorized_teaser .detailed_def_visible .definition_contents h3,.parallax_categorized_teaser .detailed_def_visible .definition_contents h4,.parallax_categorized_teaser .detailed_def_visible .definition_contents h5{font-weight:500}.parallax_categorized_teaser .detailed_def_visible .definition_contents h3{font-size:1.1em;margin:0.6em 0 0.6em}.parallax_categorized_teaser .detailed_def_visible .definition_contents h3:first-child{margin-top:0}.parallax_categorized_teaser .detailed_def_visible .definition_contents a{color:#54b3da}.parallax_categorized_teaser .detailed_def_visible .oculus{display:block}@media (min-width: 769px){.parallax_categorized_teaser .detailed_def_visible .oculus{display:none}}.parallax_categorized_teaser .detailed_def_visible .oculus.current{height:auto;pointer-events:none}.parallax_categorized_teaser .detailed_def_visible .oculus.current a{pointer-events:auto}.parallax_categorized_teaser .detailed_def_visible .oculus.current h2.title,.parallax_categorized_teaser .detailed_def_visible .oculus.current .hover{display:none !important}.parallax_categorized_teaser .detailed_def_visible .oculus.current .mobile_detailed_definition{display:block}.parallax_categorized_teaser .detailed_def_visible .oculus.current .mobile_detailed_definition h1,.parallax_categorized_teaser .detailed_def_visible .oculus.current .mobile_detailed_definition h2,.parallax_categorized_teaser .detailed_def_visible .oculus.current .mobile_detailed_definition h3,.parallax_categorized_teaser .detailed_def_visible .oculus.current .mobile_detailed_definition h4,.parallax_categorized_teaser .detailed_def_visible .oculus.current .mobile_detailed_definition h5{font-weight:500}.parallax_categorized_teaser .detailed_def_visible .oculus.current .mobile_detailed_definition .mobile_detailed_definition_title{margin-top:0;width:85%;font-weight:300}.parallax_categorized_teaser .detailed_def_visible .oculus.current .mobile_detailed_definition .close_button{pointer-events:auto;right:1em}.parallax_categorized_teaser .detailed_def_visible .detailed_def_nav{margin-bottom:1.5em;width:93%}.parallax_categorized_teaser .detailed_def_visible .detailed_def_nav li{cursor:pointer;display:inline-block;font-weight:300;font-size:1.1em;line-height:1.7em;margin-right:1em;transition:color 200ms}.parallax_categorized_teaser .detailed_def_visible .detailed_def_nav li:hover{color:white}.parallax_categorized_teaser .detailed_def_visible .detailed_def_nav li:last-child{margin-right:0}.parallax_categorized_teaser .detailed_def_visible .detailed_def_nav .current{color:white}#iframe_overlay .explore_overlay_page{background-color:black}@-webkit-keyframes pulse{0%{opacity:1}50%{opacity:.3}100%{opacity:1}}@keyframes pulse{0%{opacity:1}50%{opacity:.3}100%{opacity:1}}.dsn_connection .target_name,.mars_relay_connection .target_name{display:inline-block;width:calc(100% - 61px);vertical-align:middle;white-space:normal}.dsn_connection .mars_relay_title,.dsn_connection .dsn_title,.mars_relay_connection .mars_relay_title,.mars_relay_connection .dsn_title{display:inline}.dsn_connection .signal,.mars_relay_connection .signal{font-size:13px;margin:0.7em 0;white-space:nowrap;font-weight:300}@media (min-width: 480px){.dsn_connection .signal,.mars_relay_connection .signal{font-size:15px}}@media (min-width: 600px), print{#secondary_column .dsn_connection .signal,#secondary_column .mars_relay_connection .signal{font-size:13px;line-height:1.3}}@media (min-width: 769px), print{#secondary_column .dsn_connection .signal,#secondary_column .mars_relay_connection .signal{font-size:14px}}.dsn_connection .signal .dsn_icon,.mars_relay_connection .signal .dsn_icon{display:inline-block;width:54px;height:54px;vertical-align:middle;margin-right:0.8em}.homepage_dashboard_modal .dsn_connection .signal .sending_receiving,.homepage_dashboard_modal .dsn_connection .signal .sending,.homepage_dashboard_modal .dsn_connection .signal .receiving,.homepage_dashboard_modal .mars_relay_connection .signal .sending_receiving,.homepage_dashboard_modal .mars_relay_connection .signal .sending,.homepage_dashboard_modal .mars_relay_connection .signal .receiving{color:white}.homepage_dashboard_modal .dsn_connection .signal .sending_receiving .target_name,.homepage_dashboard_modal .dsn_connection .signal .sending .target_name,.homepage_dashboard_modal .dsn_connection .signal .receiving .target_name,.homepage_dashboard_modal .mars_relay_connection .signal .sending_receiving .target_name,.homepage_dashboard_modal .mars_relay_connection .signal .sending .target_name,.homepage_dashboard_modal .mars_relay_connection .signal .receiving .target_name{color:white}.homepage_dashboard_modal .dsn_connection .signal .transmissions,.homepage_dashboard_modal .dsn_connection .signal .target_name,.homepage_dashboard_modal .mars_relay_connection .signal .transmissions,.homepage_dashboard_modal .mars_relay_connection .signal .target_name{color:#fcb963}.dsn_connection .signal .sending_receiving,.mars_relay_connection .signal .sending_receiving{-webkit-animation:pulse 1s infinite;animation:pulse 1s infinite}.dsn_connection .signal .sending_receiving .dsn_icon,.mars_relay_connection .signal .sending_receiving .dsn_icon{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -146px -130px no-repeat;background-size:300px}.dsn_connection .signal .sending_receiving .target_name:before,.mars_relay_connection .signal .sending_receiving .target_name:before{content:\" SENDING/RECEIVING\"}.dsn_connection .signal .sending,.mars_relay_connection .signal .sending{-webkit-animation:pulse 1s infinite;animation:pulse 1s infinite}.dsn_connection .signal .sending .dsn_icon,.mars_relay_connection .signal .sending .dsn_icon{background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0 -130px no-repeat;background-size:300px}.dsn_connection .signal .sending .target_name:before,.mars_relay_connection .signal .sending .target_name:before{content:\" SENDING\"}.dsn_connection .signal .receiving,.mars_relay_connection .signal .receiving{-webkit-animation:pulse 1s infinite;animation:pulse 1s infinite}.dsn_connection .signal .receiving .dsn_icon,.mars_relay_connection .signal .receiving .dsn_icon{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -73px -130px no-repeat;background-size:300px}.dsn_connection .signal .receiving .target_name:before,.mars_relay_connection .signal .receiving .target_name:before{content:\" RECEIVING\"}.dsn_connection .signal .disconnected .dsn_icon,.mars_relay_connection .signal .disconnected .dsn_icon{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -219px -130px no-repeat;background-size:300px}.dsn_connection .signal .disconnected .target_name:before,.mars_relay_connection .signal .disconnected .target_name:before{content:\" AWAITING NEXT TRANSMISSION\"}.homepage_dashboard_modal .dsn_connection .signal .dsn_icon,.homepage_dashboard_modal .mars_relay_connection .signal .dsn_icon{background-position-y:0px}#iframe_overlay .dsn_connection .signal .dsn_icon,#iframe_overlay .mars_relay_connection .signal .dsn_icon{background-position-y:-62px}.mars_relay_connection .transmissions{display:inline-block;vertical-align:middle;width:calc(100% - 70px);white-space:normal;word-wrap:initial}.parallax_categorized_teaser{font-weight:400}.parallax_categorized_teaser nav.mobile_catcont_nav{display:block}@media (min-width: 769px){.parallax_categorized_teaser nav.mobile_catcont_nav{display:none}}.parallax_categorized_teaser nav.desktop_catcont_nav{display:none}@media (min-width: 769px){.parallax_categorized_teaser nav.desktop_catcont_nav{display:block}}.parallax_categorized_teaser .nav_content_container{display:block}@media (min-width: 769px){.parallax_categorized_teaser .nav_content_container{max-width:1300px;width:94%;margin:auto;display:flex;height:100%}}.parallax_categorized_teaser nav.catcont_nav{width:260px;margin-right:3%}@media (min-width: 1024px), print{.parallax_categorized_teaser nav.catcont_nav{width:300px;margin-right:4%}}@media (min-width: 1200px){.parallax_categorized_teaser nav.catcont_nav{width:340px;margin-right:5.5%}}@media (min-width: 1700px){.parallax_categorized_teaser nav.catcont_nav{margin-right:7.5%}}.parallax_categorized_teaser nav.catcont_nav .section{background-color:rgba(129,33,24,0.4);margin-bottom:1px;cursor:pointer;text-align:center;padding:14px 5%;transition:background-color 200ms}.no-touchevents .parallax_categorized_teaser nav.catcont_nav .section:hover:not(.current){background-color:rgba(129,33,24,0.8)}@media (min-width: 480px){.parallax_categorized_teaser nav.catcont_nav .section{padding:14px 10%}}@media (min-width: 600px), print{.parallax_categorized_teaser nav.catcont_nav .section{padding:14px 15%}}@media (min-width: 769px){.parallax_categorized_teaser nav.catcont_nav .section{text-align:left;padding:10px 15px}}.parallax_categorized_teaser nav.catcont_nav .section .nav_title,.parallax_categorized_teaser nav.catcont_nav .section .title{text-transform:uppercase;font-size:15px;letter-spacing:0}.parallax_categorized_teaser nav.catcont_nav .section.default .category_info .description{display:block}.parallax_categorized_teaser nav.catcont_nav .category_info .description{display:none;font-size:16px;margin:.5em 0}@media (min-width: 480px){.parallax_categorized_teaser nav.catcont_nav .category_info .description{font-size:15px}}@media (min-width: 769px){.parallax_categorized_teaser nav.catcont_nav .current{background-color:#822118}.parallax_categorized_teaser nav.catcont_nav .current .category_info .title{color:white}}.parallax_categorized_teaser nav.mobile_catcont_nav{width:100%}.parallax_categorized_teaser nav.mobile_catcont_nav.current .category_info .description{display:block}.parallax_categorized_teaser nav.mobile_catcont_nav .category_info .description{margin:.5em 0;display:none}.raw_image_gallery{margin-bottom:1em}.raw_image_gallery .mission_selector{background-color:#e1e1e1;padding:1em 1.2em;position:relative}.raw_image_gallery .mission_selector .active_mission_selector{width:100px;height:100px;display:inline-block;border:1px solid black;position:relative;background-color:gray;border-radius:50%}.raw_image_gallery .mission_selector .active_mission_header{display:inline-block;vertical-align:28px;margin-left:1em}.raw_image_gallery .mission_selector .circle{position:relative}.raw_image_gallery .mission_selector .circle:hover{opacity:1}.raw_image_gallery .mission_selector .circle:hover .mission_counts{display:block}.raw_image_gallery .mission_selector .mission_title{bottom:20px;position:absolute;width:100%;margin:auto}.raw_image_gallery .mission_selector .mission_counts{display:none;padding-top:3em}.raw_image_gallery .mission_selector_toggle{font-weight:600;right:0;top:0;position:absolute;margin-top:3em;padding-right:1em}.raw_image_gallery .mission_selector_toggle .mission_selector_arrow{margin-left:0.8em;width:0;height:0;border-radius:3px;border-left:11px solid transparent;border-right:11px solid transparent;border-top:11px solid #000;display:inline-block}.raw_image_gallery .mission_selector_toggle.open .mission_selector_arrow{border-top:none;border-left:11px solid transparent;border-right:11px solid transparent;border-bottom:11px solid #000}.raw_image_gallery .missions{margin:1.5em 0}.raw_image_gallery .missions .mission{display:inline-block;text-align:center;width:175px;margin-right:2em;font-size:0.9em;font-weight:600;vertical-align:top;opacity:0.4}.raw_image_gallery .missions .mission .circle{width:150px;height:150px;background-color:#9a9a9a;border-radius:50%;margin:0 auto;color:white;background-size:cover;background-position:center}.raw_image_gallery .missions .mission.current{opacity:1}.raw_image_gallery .missions .mission.msl .circle{background-color:#da9a9a}.raw_image_gallery .missions .mission.mera .circle{background-color:#9ada9a}.raw_image_gallery .missions .mission.merb .circle{background-color:#9a9ada}.raw_image_gallery .missions .mission.insight .circle{background-color:#ba9aba}.raw_image_gallery #primary_column.full_width_grid{width:100%}@media (min-width: 600px), print{.raw_image_gallery #primary_column.full_width_grid .raw_image_container{margin-bottom:.80645%;width:19.35484%;float:left}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(5n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(5n+2){margin-left:20.16129%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(5n+3){margin-left:40.32258%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(5n+4){margin-left:60.48387%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(5n+5){margin-left:80.64516%;margin-right:-100%;clear:none}}@media (min-width: 769px), print{.raw_image_gallery #primary_column.full_width_grid .raw_image_container{margin-bottom:.67114%;width:16.10738%;float:left}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(6n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(6n+2){margin-left:16.77852%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(6n+3){margin-left:33.55705%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(6n+4){margin-left:50.33557%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(6n+5){margin-left:67.11409%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(6n+6){margin-left:83.89262%;margin-right:-100%;clear:none}}@media (min-width: 1024px), print{.raw_image_gallery #primary_column.full_width_grid .raw_image_container{margin-bottom:.57471%;width:13.7931%;float:left}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(7n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(7n+2){margin-left:14.36782%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(7n+3){margin-left:28.73563%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(7n+4){margin-left:43.10345%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(7n+5){margin-left:57.47126%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(7n+6){margin-left:71.83908%;margin-right:-100%;clear:none}.raw_image_gallery #primary_column.full_width_grid .raw_image_container:nth-child(7n+7){margin-left:86.2069%;margin-right:-100%;clear:none}}@media (min-width: 1024px), print{.raw_image_gallery .faceted_search_hidden_filters .raw_image_container{margin-bottom:.84034%;width:15.96639%;float:left}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(6n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(6n+2){margin-left:16.80672%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(6n+3){margin-left:33.61345%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(6n+4){margin-left:50.42017%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(6n+5){margin-left:67.22689%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(6n+6){margin-left:84.03361%;margin-right:-100%;clear:none}}@media (min-width: 1200px){.raw_image_gallery .faceted_search_hidden_filters .raw_image_container{margin-bottom:.62893%;width:11.94969%;float:left}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(8n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(8n+2){margin-left:12.57862%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(8n+3){margin-left:25.15723%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(8n+4){margin-left:37.73585%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(8n+5){margin-left:50.31447%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(8n+6){margin-left:62.89308%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(8n+7){margin-left:75.4717%;margin-right:-100%;clear:none}.raw_image_gallery .faceted_search_hidden_filters .raw_image_container:nth-child(8n+8){margin-left:88.05031%;margin-right:-100%;clear:none}}.raw_image_gallery .raw_image_container{position:relative;cursor:pointer;margin-bottom:2.04082%;width:48.97959%;float:left}.raw_image_gallery .raw_image_container:nth-child(2n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery .raw_image_container:nth-child(2n+2){margin-left:51.02041%;margin-right:-100%;clear:none}@media (min-width: 480px){.raw_image_gallery .raw_image_container{margin-bottom:1.35135%;width:32.43243%;float:left}.raw_image_gallery .raw_image_container:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery .raw_image_container:nth-child(3n+2){margin-left:33.78378%;margin-right:-100%;clear:none}.raw_image_gallery .raw_image_container:nth-child(3n+3){margin-left:67.56757%;margin-right:-100%;clear:none}}@media (min-width: 769px), print{.raw_image_gallery .raw_image_container{margin-bottom:1.0101%;width:24.24242%;float:left}.raw_image_gallery .raw_image_container:nth-child(4n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery .raw_image_container:nth-child(4n+2){margin-left:25.25253%;margin-right:-100%;clear:none}.raw_image_gallery .raw_image_container:nth-child(4n+3){margin-left:50.50505%;margin-right:-100%;clear:none}.raw_image_gallery .raw_image_container:nth-child(4n+4){margin-left:75.75758%;margin-right:-100%;clear:none}}@media (min-width: 1024px), print{.raw_image_gallery .raw_image_container{margin-bottom:.80645%;width:19.35484%;float:left}.raw_image_gallery .raw_image_container:nth-child(5n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.raw_image_gallery .raw_image_container:nth-child(5n+2){margin-left:20.16129%;margin-right:-100%;clear:none}.raw_image_gallery .raw_image_container:nth-child(5n+3){margin-left:40.32258%;margin-right:-100%;clear:none}.raw_image_gallery .raw_image_container:nth-child(5n+4){margin-left:60.48387%;margin-right:-100%;clear:none}.raw_image_gallery .raw_image_container:nth-child(5n+5){margin-left:80.64516%;margin-right:-100%;clear:none}}.raw_image_gallery .raw_image_container .latest_triangle{position:absolute;width:0;height:0;top:0;left:0;z-index:1;border-left:26px solid #F45C48;border-bottom:26px solid transparent}.raw_image_gallery .raw_image_container .raw_list_image{position:relative;width:100%;padding-bottom:100%}.raw_image_gallery .raw_image_container .raw_list_image_inner{position:absolute;width:100%;height:100%;background-color:#777777;display:flex;justify-content:center;align-items:center}.raw_image_gallery .raw_image_container .raw_list_image_inner img{position:relative;max-height:100%;width:auto}.raw_image_gallery .raw_image_container.thumbnail .raw_list_image_inner img{width:50%;height:50%}.raw_image_gallery .raw_image_container .raw_image_detail_arrow{position:absolute;top:-13px;left:50%;transform:translateX(-50%);width:0;height:0;margin-top:4px;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:9px solid #222}.raw_image_gallery .raw_image_container .raw_image_detail_container{position:relative;cursor:default}.raw_image_gallery .raw_image_container .raw_image_detail{position:relative;margin:13px 0 8px;padding:2.7em 3em;background-color:#222}.raw_image_gallery .raw_image_container .raw_image_detail.rid_mobile{position:fixed;height:100%;width:100%;left:0;top:0;right:0;bottom:0;margin:0;padding:1em;z-index:21;overflow-y:scroll;-webkit-overflow-scrolling:touch}.raw_image_gallery .raw_image_container .rid_inner{height:100%;display:flex;flex-direction:column;justify-content:space-between;position:relative}@media (min-width: 600px), print{.raw_image_gallery .raw_image_container .rid_inner{display:block}}@media (min-width: 1024px), print{.raw_image_gallery .raw_image_container .rid_inner{display:flex;min-height:0;flex-direction:row}}.raw_image_gallery .raw_image_container .info_open .rid_inner{display:flex;min-height:0;flex-direction:row;margin:0 2em}.raw_image_gallery .raw_image_container .rid_mobile .rid_inner{margin-bottom:2em}.raw_image_gallery .raw_image_container .rid_mobile .rid_inner.left,.raw_image_gallery .raw_image_container .rid_mobile .rid_inner.right{transition:transform 0.2s}.raw_image_gallery .raw_image_container .rid_mobile .rid_inner.left{transform:translateX(-120%)}.raw_image_gallery .raw_image_container .rid_mobile .rid_inner.right{transform:translateX(120%)}.raw_image_gallery .raw_image_container .rid_mobile .rid_inner .rid_right_col{padding-bottom:4em}.raw_image_gallery .raw_image_container .rid_left_col,.raw_image_gallery .raw_image_container .rid_right_col{vertical-align:top}@media (min-width: 1024px), print{.raw_image_gallery .raw_image_container .rid_left_col,.raw_image_gallery .raw_image_container .rid_right_col{display:inline-block}}.rid_mobile .raw_image_gallery .raw_image_container .rid_left_col,.rid_mobile .raw_image_gallery .raw_image_container .rid_right_col{display:block;width:100%}.raw_image_gallery .raw_image_container .info_open .rid_left_col,.raw_image_gallery .raw_image_container .info_open .rid_right_col{display:inline-block}.raw_image_gallery .raw_image_container .rid_left_col{position:relative;text-align:center;width:100%;margin-bottom:2em}@media (min-width: 600px), print{.raw_image_gallery .raw_image_container .rid_left_col{max-width:33%;margin-left:0.5em;margin-bottom:1em;float:right}}@media (min-width: 1024px), print{.raw_image_gallery .raw_image_container .rid_left_col{max-width:100%;width:48%;margin-left:0;margin-bottom:0;display:inline-flex;flex-direction:column;flex:0 0 48%}.raw_image_gallery .raw_image_container .rid_left_col .rid_image_container{position:relative}}.raw_image_gallery .raw_image_container .info_open .rid_left_col{max-width:100%;width:41%;margin-left:0;margin-bottom:0;display:inline-flex;flex-direction:column;flex:0 0 41%}.raw_image_gallery .raw_image_container .rid_image_container{margin-bottom:10px}.raw_image_gallery .raw_image_container .rid_image_container .zoom_icon{display:none;position:absolute;bottom:4px;right:5px;padding:0;cursor:pointer;width:50px;height:50px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -125px -150px;background-size:300px}.raw_image_gallery .raw_image_container .rid_image_container .zoom_icon:hover,.raw_image_gallery .raw_image_container .rid_image_container .zoom_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -125px -150px;background-size:300px}.raw_image_gallery .raw_image_container .rid_image_container:hover .zoom_icon{display:block}.raw_image_gallery .raw_image_container .rid_image_container>a{position:relative;display:block;height:100%;width:100%}.raw_image_gallery .raw_image_container .rid_image_container .fs_icon{position:absolute;right:5px;bottom:5px;padding:0;cursor:pointer;width:50px;height:50px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -175px -150px;background-size:300px}.raw_image_gallery .raw_image_container .rid_image_container .fs_icon:hover,.raw_image_gallery .raw_image_container .rid_image_container .fs_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -175px -150px;background-size:300px}.raw_image_gallery .raw_image_container .rid_image_container img{-o-object-fit:contain;object-fit:contain;max-height:100%}.raw_image_gallery .raw_image_container .rid_image_container.thumbnail_detail{background-color:black}.raw_image_gallery .raw_image_container .rid_image_container.thumbnail_detail img{position:absolute;width:auto;top:50%;left:50%;transform:translate(-50%, -50%)}.raw_image_gallery .raw_image_container .rid_mobile .rid_image_container:hover .zoom_icon{display:none}.raw_image_gallery .raw_image_container .rid_image_links{position:relative;width:100%}@media (min-width: 1024px), print{.raw_image_gallery .raw_image_container .rid_image_links{margin:1.5em 0 0.6em;flex:1 0 0}}.raw_image_gallery .raw_image_container .rid_image_links a.addthis_button_compact{width:89px;border-radius:4px;overflow:hidden;height:38px;margin-right:12px;margin-bottom:12px}.raw_image_gallery .raw_image_container .rid_image_links a.addthis_button_compact img{vertical-align:top}.raw_image_gallery .raw_image_container .rid_image_links a.addthis_button_compact:hover{cursor:pointer}.raw_image_gallery .raw_image_container .rid_image_links a.addthis_button_compact,.raw_image_gallery .raw_image_container .rid_image_links .button{display:inline-block;vertical-align:top}.raw_image_gallery .raw_image_container .rid_image_links .button{margin-right:12px;padding:12px 14px}.raw_image_gallery .raw_image_container .info_open .rid_image_links{margin-top:10px}.raw_image_gallery .raw_image_container .info_open .rid_image_links .button{margin-right:0}.raw_image_gallery .raw_image_container .info_open .rid_image_links a.addthis_button_compact{margin-bottom:0}.raw_image_gallery .raw_image_container .rid_right_col{text-align:left;width:100%;flex:1;margin-bottom:1em}@media (min-width: 1024px), print{.raw_image_gallery .raw_image_container .rid_right_col{margin-left:1em;width:47%}}@media (min-width: 1200px){.raw_image_gallery .raw_image_container .rid_right_col{margin-left:2em;width:42%}}.raw_image_gallery .raw_image_container .rid_right_col h2{color:#fefefe;font-size:1.5em;margin-bottom:0.7em;width:50%}@media (min-width: 600px), print{.raw_image_gallery .raw_image_container .rid_right_col h2{font-size:1.2em;width:100%}}.raw_image_gallery .raw_image_container .rid_right_col .rid_description p{font-size:0.95em;line-height:1.4em;color:#d0d0d0}.raw_image_gallery .raw_image_container .info_open .rid_right_col{margin-left:2em;width:47%;overflow-y:auto;touch-action:pan-y;-webkit-overflow-scrolling:touch}.raw_image_gallery .raw_image_container .info_open .rid_right_col h2{width:100%}.raw_image_gallery .raw_image_container .rid_mobile .rid_title{display:inline-block}.raw_image_gallery .raw_image_container .rid_prev,.raw_image_gallery .raw_image_container .rid_next{height:62px;width:30px;background-color:#000;position:absolute;top:50%;transform:translateY(-50%)}.raw_image_gallery .raw_image_container .rid_prev.disabled,.raw_image_gallery .raw_image_container .rid_next.disabled{opacity:0.3}.raw_image_gallery .raw_image_container .rid_prev{left:0;border-top-right-radius:6px;border-bottom-right-radius:6px}.raw_image_gallery .raw_image_container .rid_prev .icon{left:0;position:absolute;top:50%;transform:translateY(-50%);padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0px -225px;background-size:300px}.raw_image_gallery .raw_image_container .rid_prev .icon:hover,.raw_image_gallery .raw_image_container .rid_prev .icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -225px;background-size:300px}.raw_image_gallery .raw_image_container .rid_prev.disabled .icon{padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0px -225px;background-size:300px}.raw_image_gallery .raw_image_container .rid_prev.disabled .icon:hover,.raw_image_gallery .raw_image_container .rid_prev.disabled .icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0px -225px;background-size:300px}.raw_image_gallery .raw_image_container .rid_next{right:0;border-top-left-radius:6px;border-bottom-left-radius:6px}.raw_image_gallery .raw_image_container .rid_next .icon{right:0;position:absolute;top:50%;transform:translateY(-50%);padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0px -200px;background-size:300px}.raw_image_gallery .raw_image_container .rid_next .icon:hover,.raw_image_gallery .raw_image_container .rid_next .icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -200px;background-size:300px}.raw_image_gallery .raw_image_container .rid_next.disabled .icon{padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0px -200px;background-size:300px}.raw_image_gallery .raw_image_container .rid_next.disabled .icon:hover,.raw_image_gallery .raw_image_container .rid_next.disabled .icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") 0px -200px;background-size:300px}.raw_image_gallery .raw_image_container .rid_mobile:not(.landscape):not(.info_open) .rid_prev_next_btns{display:inline-block;float:right}.raw_image_gallery .raw_image_container .rid_mobile:not(.landscape):not(.info_open) .rid_prev_next_btns .rid_prev,.raw_image_gallery .raw_image_container .rid_mobile:not(.landscape):not(.info_open) .rid_prev_next_btns .rid_next{height:40px;width:40px;position:relative;top:0;transform:translate(0, 0);display:inline-block}.raw_image_gallery .raw_image_container .rid_mobile:not(.landscape):not(.info_open) .rid_prev_next_btns .rid_prev{border-top-left-radius:6px;border-bottom-left-radius:6px;border-top-right-radius:0px;border-bottom-right-radius:0px}.raw_image_gallery .raw_image_container .rid_mobile:not(.landscape):not(.info_open) .rid_prev_next_btns .rid_prev .icon{left:7px}.raw_image_gallery .raw_image_container .rid_mobile:not(.landscape):not(.info_open) .rid_prev_next_btns .rid_next{margin-left:4px;border-top-left-radius:0px;border-bottom-left-radius:0px;border-top-right-radius:6px;border-bottom-right-radius:6px}.raw_image_gallery .raw_image_container .rid_mobile:not(.landscape):not(.info_open) .rid_prev_next_btns .rid_next .icon{right:7px}.raw_image_gallery .raw_image_container .rid_close{position:absolute;top:-10px;right:-9px;width:32px;height:32px;padding:9px;z-index:1;border-radius:50%;background-color:rgba(0,0,0,0.5);cursor:pointer}.raw_image_gallery .raw_image_container .rid_close .icon{width:100%;height:100%;background:url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat;background-size:contain}@media (min-width: 600px), print{.raw_image_gallery .raw_image_container .rid_close{top:-2.3em;right:-2.7em}}@media (min-width: 769px), print{.raw_image_gallery .raw_image_container .rid_close{top:-2em;right:-2.4em;width:17px;height:17px;padding:0;background-color:transparent}}.raw_image_gallery .raw_image_container .landscape .rid_close{top:10px;right:10px;width:22px;height:22px;padding:0;background-color:transparent}.raw_image_gallery .raw_image_container .info_open .rid_close{top:-5px;right:-37px;width:22px;height:22px;padding:0;background-color:transparent}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#222;z-index:21;text-align:center}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container.left,.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container.right{transition:transform 0.2s}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container.left{transform:translateX(-120%)}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container.right{transform:translateX(120%)}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container img{height:100vh;width:auto}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container .rid_close{z-index:22;top:10px;right:10px;width:22px;height:22px;padding:0;background-color:transparent}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container .info_button{position:absolute;cursor:pointer;right:12%;width:50px;height:50px;bottom:1.5em}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container .info_button .icon{padding:0;cursor:pointer;width:50px;height:50px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -175px -100px;background-size:300px}.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container .info_button .icon:hover,.raw_image_gallery .raw_image_container .raw_image_mobile_landscape_container .info_button .icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -175px -100px;background-size:300px}.raw_image_gallery .select_button{display:none}@media (min-width: 600px), print{.raw_image_gallery .select_button{position:absolute;cursor:pointer;right:0;bottom:0;height:50px;width:50px;display:block}}.touchevents .raw_image_gallery .select_button{display:none}.raw_image_gallery .select_button .triangle{border-top:25px solid transparent;border-left:25px solid transparent;border-right:25px solid rgba(107,163,228,0.2);border-bottom:25px solid rgba(107,163,228,0.2)}.raw_image_gallery .select_button .checkbox_icon{position:absolute;bottom:3px;right:3px;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -74px -201px;background-size:300px}.raw_image_gallery .select_button .checkbox_icon:hover,.raw_image_gallery .select_button .checkbox_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -74px -201px;background-size:300px}.raw_image_gallery .select_button:hover .triangle{border-right:25px solid rgba(107,163,228,0.5);border-bottom:25px solid rgba(107,163,228,0.5)}.raw_image_gallery .raw_image_container.selected .triangle{border-right:25px solid rgba(107,163,228,0.9);border-bottom:25px solid rgba(107,163,228,0.9)}.raw_image_gallery .raw_image_container.selected .checkbox_icon{background-position:-74px -226px}.raw_image_gallery .latest_info h4{font-weight:normal}.raw_image_gallery .latest_info span{margin-right:1.5em}.raw_image_gallery .latest_info .new_raw_images_count{color:#E35948}.grid_list_page .raw_images_form{margin-top:-1.5em}.raw_images_form.coming_soon h1.article_title{margin-bottom:0.7em}.raw_images_form h2.sub_title{font-weight:600}.raw_images_form #modals>div>div{position:fixed !important}.raw_images_form .article_title{margin-bottom:1em}.raw_images_form input[type=\"text\"]:not(.begin_date):not(.end_date):not(.page_num){border:1px solid rgba(0,0,0,0.3);background-color:white;border-radius:4px;padding:8px 12px;margin-bottom:0.6em;font-size:16px}.raw_images_form input[type=\"text\"]:not(.begin_date):not(.end_date):not(.page_num).wide{width:100%}.raw_images_form ::-ms-clear{display:none;width:0;height:0}.raw_images_form select{font-size:16px;margin-top:1px}@media (min-width: 480px){.raw_images_form select{font-size:15px}.touchevents .raw_images_form select{font-size:16px}}.raw_images_form header>hr{margin-bottom:1em}.raw_images_form .download_status{display:block;width:100%;background-color:#e9eef4;position:relative;padding:1em 2em 1em 1em;margin-bottom:1em;border-radius:5px}.raw_images_form .download_status p{margin:0;padding:0}.raw_images_form .download_status .close_icon{position:absolute;right:10px;top:16px;padding:0 0.8em;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -99px -226px;background-size:300px}.raw_images_form .download_status .close_icon:hover,.raw_images_form .download_status .close_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -99px -226px;background-size:300px}.raw_images_form .download_status #spinner{position:absolute;width:100%;height:100%}.raw_images_form .filter_remove{padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -101px -201px;background-size:300px;display:inline-block;top:-1px;vertical-align:middle}.raw_images_form .filter_remove:hover,.raw_images_form .filter_remove.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -101px -201px;background-size:300px}.raw_images_form .download_links{display:none}@media (min-width: 600px), print{.raw_images_form .download_links{position:absolute;right:0;top:0;font-weight:700;font-size:0.9em;display:block;text-align:right}}@media (min-width: 769px), print{.raw_images_form .download_links{top:16px;display:inline-flex}}@media (min-width: 1200px){.raw_images_form .download_links{font-size:1em}}.touchevents .raw_images_form .download_links{display:none}.raw_images_form .download_links .download_link{margin-left:0.5em;display:inline-block;cursor:pointer}.raw_images_form .download_links .download_link.selections:hover{text-decoration:none;cursor:default}.raw_images_form .download_links .download_link .download_icon{padding:0 0.8em;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -124px -201px;background-size:300px}.raw_images_form .download_links .download_link .download_icon:hover,.raw_images_form .download_links .download_link .download_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -124px -201px;background-size:300px}.raw_images_form .download_links .disabled .download_link{cursor:default;text-decoration:none;color:#b0b0b0}.raw_images_form .download_links .disabled .download_link .download_icon{padding:0 0.8em;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -124px -226px;background-size:300px}.raw_images_form .download_links .disabled .download_link .download_icon:hover,.raw_images_form .download_links .disabled .download_link .download_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -124px -226px;background-size:300px}.raw_images_form .clear_filter{margin-left:1em;cursor:pointer}.raw_images_form #secondary_column .latest_toggle{margin-bottom:.6rem;display:flex}.raw_images_form #secondary_column .latest_toggle .input_container{margin-right:2rem;display:inline-flex;align-items:baseline}.raw_images_form #secondary_column .latest_toggle .input_container:last-child{margin-right:0}.raw_images_form #secondary_column .latest_toggle label{margin-left:.3rem}.raw_images_form #secondary_column ul{margin-left:0;padding-left:1px}.raw_images_form #secondary_column .target ul{margin-bottom:1em}.raw_images_form #secondary_column .mobile_filter_controls,.raw_images_form #secondary_column .expand_section{display:none}.raw_images_form #secondary_column .form_section_header h3{margin-bottom:0.8em}@media (max-width: 599px){.raw_images_form #secondary_column{position:fixed;right:0;top:0;z-index:21;width:100%;height:100%;background-color:rgba(0,0,0,0.5)}.raw_images_form #secondary_column.open{display:block}.raw_images_form #secondary_column .raw_images_sidebar{border:none;background-color:white;height:100%;float:right;width:87.5%;padding:0;overflow-y:scroll;-webkit-overflow-scrolling:touch}.raw_images_form #secondary_column h3,.raw_images_form #secondary_column h4,.raw_images_form #secondary_column fieldset{padding:0.8em;margin:0}.raw_images_form #secondary_column .form_section_header h3{margin-bottom:0}.raw_images_form #secondary_column .form_section.open p{display:block;padding:0 0.8em}.raw_images_form #secondary_column p{display:none}.raw_images_form #secondary_column .form_section.open fieldset{padding-bottom:0}.raw_images_form #secondary_column .form_section.open fieldset.target,.raw_images_form #secondary_column .form_section.open fieldset.colors{padding-bottom:.8em}.raw_images_form #secondary_column header{padding:1em;margin:0}.raw_images_form #secondary_column hr{display:none}.raw_images_form #secondary_column .mobile_filter_controls{display:block;position:absolute;top:10px;right:10px}.raw_images_form #secondary_column .mobile_filter_controls a{padding:1em}.raw_images_form #secondary_column h4{background-color:#f3f3f3}.raw_images_form #secondary_column .form_section{position:relative;margin-bottom:2px}.raw_images_form #secondary_column .form_section fieldset{display:none}.raw_images_form #secondary_column .form_section .expand_section{display:block;position:absolute;top:5px;right:0px;cursor:pointer;padding:12px}.raw_images_form #secondary_column .form_section .expand_section .arrow_down{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #57585a;transition:transform 0.2s}.raw_images_form #secondary_column .form_section h3 ~ .expand_section{top:65px}.raw_images_form #secondary_column .form_section.open fieldset,.raw_images_form #secondary_column .form_section.open .featured_links{display:block}.raw_images_form #secondary_column .form_section.open .expand_section .arrow_down{transform:rotate(180deg)}.raw_images_form #secondary_column .form_section.open .distance{margin-bottom:1.6em}.raw_images_form #secondary_column .form_section:last-of-type{margin-bottom:50px}}.raw_images_form .featured_links{display:none;padding:.8em}@media (min-width: 600px), print{.raw_images_form .featured_links{display:block;padding:0}}.raw_images_form .featured_link{cursor:pointer;font-size:.95rem}.raw_images_form .featured_link+.featured_link{margin-top:.3rem}.touchevents .raw_images_form .question_tooltip{display:none}@media (min-width: 600px), print{.raw_images_form .question_tooltip{display:block;width:14px;height:14px;display:inline-block;vertical-align:middle;margin-left:0.35rem;margin-top:-2px;background:url(\"https://mars.nasa.gov/assets/tooltip_indicator.png\") no-repeat center;background-size:100%}}.raw_images_form .target.truncated ul li:nth-child(n+8){display:none !important}.raw_images_form .target.truncated .truncation_toggle:after{content:\"+ more\"}.raw_images_form .target.expanded .truncation_toggle:after{content:\"- less\"}.raw_images_form .target input.search_field{margin-top:0.3em}.raw_images_form .ri_checkbox{display:block;margin-bottom:0.4em}.raw_images_form .ri_checkbox label{font-size:0.9em;font-weight:400;display:flex;align-items:baseline}.raw_images_form .ri_checkbox label input{vertical-align:middle;flex-basis:calc(14px + .4em)}.raw_images_form .ri_checkbox label input+span{pointer-events:none}.raw_images_form .target_count{pointer-events:none}.raw_images_form .filter_link_container{position:relative}.raw_images_form .date_filters{margin:1em 0 -0.2em}.raw_images_form .date_filters input[type=\"submit\"]{text-indent:-9999px;width:100%;padding:13.5px 16px}@media (min-width: 600px), print{.raw_images_form .date_filters input[type=\"submit\"]{text-indent:0;padding:12px 13px}}.raw_images_form .date_filters .right_arrow{position:absolute;left:0;right:0;margin:auto;top:30%;height:0px;width:0px;display:inline-block;border-radius:3px;border-top:6px solid transparent;border-left:9px solid white;border-bottom:6px solid transparent}@media (min-width: 600px), print{.raw_images_form .date_filters .right_arrow{display:none}}.raw_images_form .date_filters .observation_time{position:relative}.raw_images_form .date_filters .observation_time label.preposition{display:block}.raw_images_form .calendar_input_binder{position:relative;display:inline-block;width:100%;margin-bottom:.7em;cursor:pointer}.raw_images_form .begin_date,.raw_images_form .end_date,.raw_images_form .begin_sol,.raw_images_form .end_sol{height:40px;font-size:16px;border:1px solid rgba(0,0,0,0.3);border-radius:4px;width:100%}.raw_images_form .begin_date:-webkit-autofill,.raw_images_form .end_date:-webkit-autofill,.raw_images_form .begin_sol:-webkit-autofill,.raw_images_form .end_sol:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#222}.raw_images_form .begin_date,.raw_images_form .end_date{margin:0 0.4em 0 0;padding:8px 32px 8px 8px;width:150px}.raw_images_form .begin_sol,.raw_images_form .end_sol{width:88px;padding:8px}.raw_images_form .date_option_wrapper{display:inline-block;margin-right:1%}.raw_images_form .date_option_wrapper+.date_option_wrapper{margin-right:0}@media (min-width: 600px), print{.raw_images_form .date_option_wrapper{margin-left:0;width:auto;margin-right:0}}.raw_images_form .date_option_wrapper label.preposition{font-weight:bold;display:block}.raw_images_form .date_option_wrapper label.preposition_small{display:none}.raw_images_form .date_submit{position:absolute;right:0;top:0;width:9%;display:inline-block}@media (min-width: 600px), print{.raw_images_form .date_submit{position:relative;width:auto}}.raw_images_form button.ui-datepicker-trigger{vertical-align:middle;position:absolute;display:inline-block;right:6px;top:12px;width:38px;max-width:150px;height:100%;padding:6px 8px 8px 8px;background:transparent;border:transparent}.raw_images_form button.ui-datepicker-trigger:hover{opacity:.8}.raw_images_form button.ui-datepicker-trigger img{width:22px;height:22px}.touchevents .raw_images_form button.ui-datepicker-trigger{width:100%}.touchevents .raw_images_form button.ui-datepicker-trigger img{float:right}.raw_images_form .mobile_filter_btn{text-align:center;display:block}.raw_images_form .mobile_filter_btn .button{margin-bottom:1.2em}@media (min-width: 600px), print{.raw_images_form .mobile_filter_btn{display:none}}.raw_images_form .filtering_results{display:none;margin-bottom:1em;font-weight:600}@media (min-width: 600px), print{.raw_images_form .filtering_results{display:block}}.raw_images_form .filtering_results .applied_filter{display:inline-block;margin:0 .5em .3em}.raw_images_form .select{display:block;margin:0.3em 0}.raw_images_form .pagination_status.no_results_text{float:none;font-weight:600;text-align:center;padding:1em 0}@media (min-width: 600px), print{.raw_images_form .pagination_status.no_results_text{padding:0}}.raw_images_form .mobile_clear_filters{padding-right:20px}.raw_images_sidebar h2{margin-top:.5em}.raw_images_sidebar h4{margin-bottom:0.6em}.tooltip_content{display:none}.selections_link{padding-bottom:0.5em}.selections_link:last-child{padding-bottom:0}.download_modal{padding:20px;border-radius:6px}.download_modal p{font-weight:700;color:#FFF;text-align:center;margin-bottom:.5em}.download_modal .loader>div{top:25px !important}.download_request{padding:2.7em 2em 2em;border-radius:6px;width:475px;color:black;transform:translate(-50%, -50%)}.download_request h1{font-size:1.3em;font-weight:600}.download_request input[name=\"email\"]{border:none;height:40px;border-radius:5px;padding:0 1em;font-size:0.9em;width:100%;margin-bottom:1em;background-color:#f3f4f8}.download_request footer{text-align:left;margin-top:1em}.download_request footer a{margin-right:1em}.download_request footer a:last-child{margin-right:0;font-size:.9em;float:right}.download_request footer a.disabled{opacity:0.5}.download_request footer .button.gray_background{background-color:#a3a3a3}.download_request .close_icon{position:absolute;right:10px;top:16px;opacity:.6;padding:0 0.8em;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -25px;background-size:300px}.download_request .close_icon:hover,.download_request .close_icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -25px;background-size:300px}.no-touchevents .download_request .close_icon:hover{opacity:.8}.download_request .loader{display:inline-block;height:50px;width:50px;vertical-align:middle}input.facet_checkbox{margin-right:.4em}h3.return_link{color:#f08d77;font-size:.9em;font-weight:700;margin-top:.5em}.filtered_results_container{display:block;float:none}@media (min-width: 769px), print{.filtered_results_container{display:inline-block}}.selections_container{margin-left:.5em;display:inline-block;position:relative}@media (min-width: 1024px), print{.selections_container{margin-left:1.2em}}.selections_container:hover>*{display:block}.selections_container.disabled:hover .selection_options{display:none}.selection_options{display:none;position:relative;background:#f8f8f8;border:1px solid #e1e1e1;padding:1em;border-radius:8px;font-weight:500;top:17px;right:-3px;z-index:2;text-align:left}.selection_options:after,.selection_options:before{bottom:100%;left:50%;border:solid transparent;content:\" \";height:0;width:0;position:absolute;pointer-events:none}.selection_options:after{border-color:rgba(248,248,248,0);border-bottom-color:#f8f8f8;border-width:10px;margin-left:-10px}.selection_options:before{border-color:rgba(225,225,225,0);border-bottom-color:#e1e1e1;border-width:11px;margin-left:-11px}.modal.download_request #email_validation_error{font-size:14px;color:#f2162a;font-weight:700}.no-flexbox .raw_image_container img{height:100%}@media (min-width: 600px){.faceted_search_hidden_filters #secondary_column{display:none}.faceted_search_hidden_filters #primary_column{width:100% !important}@supports (display: grid) and (grid-template-columns: max-content){.faceted_search_hidden_filters #primary_column{display:grid;grid-template-columns:1fr -webkit-max-content;grid-template-columns:1fr max-content;grid-column-gap:2.8em}.faceted_search_hidden_filters #primary_column .pagination_status{grid-column:1 / 2}.faceted_search_hidden_filters #primary_column .pagination_options{grid-column:1 / 2}.faceted_search_hidden_filters #primary_column .mobile_filter_btn{grid-column:2 / 3}.faceted_search_hidden_filters #primary_column .mobile_filter_btn .button{margin-top:-0.5em}.faceted_search_hidden_filters #primary_column .mobile_filter_btn hr{display:none}.faceted_search_hidden_filters #primary_column .filtering_results,.faceted_search_hidden_filters #primary_column .faceted_search_results,.faceted_search_hidden_filters #primary_column .raw_image_gallery,.faceted_search_hidden_filters #primary_column .errors,.faceted_search_hidden_filters #primary_column .search_footer{grid-column:1 / -1}}.faceted_search_hidden_filters .mobile_filter_btn{display:block !important;text-align:right !important}.raw_images_form #secondary_column .mobile_filter_controls{display:block;position:absolute;top:-0.35em;right:0}.raw_images_form #secondary_column .mobile_filter_controls .clear_filter{display:none}.raw_images_form #secondary_column .mobile_filter_controls .button{position:relative}.raw_images_form #secondary_column .mobile_filter_controls .button::after{content:\"\";display:block;background-color:white;background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpolygon points='499.2,55.2 456.8,12.8 256,213.6 55.2,12.8 12.8,55.2 213.6,256 12.8,456.8 55.2,499.2 256,298.4 456.8,499.2 499.2,456.8 298.4,256 ' /%3E%3C/svg%3E\");background-size:1.4em 1.4em;background-repeat:no-repeat;background-position:right;position:absolute;top:0;left:0;width:100%;height:100%}}.pagination_options{padding:0 0 1em 0}.no_results .pagination_options{display:none}.pagination_options .options{display:inline-block;float:right;width:100%;text-align:center}@media (min-width: 1024px), print{.pagination_options .options{width:auto}}.pagination_options .options_field[name=\"sort\"]{margin-right:1.6em}.pagination_status{float:left;margin-bottom:1.2em;text-align:left;width:calc(100% - 176px)}@media (min-width: 1024px), print{.pagination_status{width:100%}.search_results .pagination_status{width:auto}}.pagination_nav{display:block;float:right;text-align:center;margin-top:-4px;margin-bottom:.7em}@media (min-width: 1024px), print{.pagination_nav{float:left;clear:both;margin-bottom:0}.search_results .pagination_nav{clear:none;float:right;margin-bottom:.7em}}.pagination_nav span.total_pages{padding:0 0 0 8px;display:inline-block}.pagination_nav .page_selector{display:inline-block;vertical-align:super;margin:0 4px 0 6px;font-size:1em}.pagination_nav .page_selector input[type=number]{-moz-appearance:textfield}.pagination_nav .page_selector input[type=number]::-webkit-inner-spin-button,.pagination_nav .page_selector input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.pagination_nav .page_selector input{width:2.8em;margin-right:2px;text-align:center;border:2px solid #C1C1C1}.pagination_nav .prev,.pagination_nav .next{display:inline-block;cursor:pointer;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -100px;background-size:300px;opacity:0.6}.pagination_nav .prev:hover,.pagination_nav .prev.active,.pagination_nav .next:hover,.pagination_nav .next.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -100px;background-size:300px}.pagination_nav .prev:hover,.pagination_nav .next:hover{opacity:1}.pagination_nav .prev.disabled,.pagination_nav .next.disabled{opacity:.1;cursor:default}.pagination_nav .prev.disabled a,.pagination_nav .next.disabled a{cursor:default}.pagination_nav .prev a,.pagination_nav .next a{width:100%;height:100%;display:block}.pagination_nav .next{transform:rotate(180deg)}.pagination_nav input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#222}.page_option_wrapper{display:inline-block;margin-bottom:.6em}@media (min-width: 480px){.page_option_wrapper .options_field{margin-left:.5em}}.page_option_wrapper label{font-size:16px}@media (max-width: 480px){.page_option_wrapper label:after{content:\":\"}}.page_option_wrapper select{vertical-align:top}@media (max-width: 480px){.page_option_wrapper select{border:none;-webkit-appearance:none;-o-appearance:none;-moz-appearance:none;color:#257cdf;padding-left:0.3em;background-color:transparent}}.page_option_wrapper.sort_by{text-align:left;float:left}@media (min-width: 480px){.page_option_wrapper.sort_by{width:auto}}.page_option_wrapper.sort_by select{max-width:200px}@media (min-width: 480px){.page_option_wrapper.sort_by select{width:auto;min-width:130px}}.page_option_wrapper.per_page{text-align:right;margin-left:2%;float:right}@media (min-width: 480px){.page_option_wrapper.per_page{width:auto;margin-left:1em}}@media (min-width: 480px){.page_option_wrapper.per_page select{min-width:48px}}.nonessential{display:none}@media (min-width: 769px), print{.nonessential{display:inline}}footer.search_footer .pagination_status{display:none}footer.search_footer .pagination_nav{float:left}footer.search_footer .scroll_to_top{float:right;text-align:right;font-weight:700}/*! jQuery UI - v1.11.2 - 2015-02-04\n* http://jqueryui.com\n* Includes: core.css, draggable.css, sortable.css, datepicker.css\n* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:\"\";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default !important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-draggable-handle{touch-action:none}.ui-sortable-handle{touch-action:none}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}/*!\n * jQuery UI CSS Framework 1.11.2\n * http://jqueryui.com\n *\n * Copyright 2014 jQuery Foundation and other contributors\n * Released under the MIT license.\n * http://jquery.org/license\n *\n * http://api.jqueryui.com/category/theming/\n *\n * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Segoe%20UI%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=6px&bgColorHeader=333333&bgTextureHeader=gloss_wave&bgImgOpacityHeader=25&borderColorHeader=333333&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=000000&bgTextureContent=inset_soft&bgImgOpacityContent=25&borderColorContent=666666&fcContent=ffffff&iconColorContent=cccccc&bgColorDefault=555555&bgTextureDefault=glass&bgImgOpacityDefault=20&borderColorDefault=666666&fcDefault=eeeeee&iconColorDefault=cccccc&bgColorHover=0078a3&bgTextureHover=glass&bgImgOpacityHover=40&borderColorHover=59b4d4&fcHover=ffffff&iconColorHover=ffffff&bgColorActive=f58400&bgTextureActive=inset_soft&bgImgOpacityActive=30&borderColorActive=ffaf0f&fcActive=ffffff&iconColorActive=222222&bgColorHighlight=eeeeee&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=80&borderColorHighlight=cccccc&fcHighlight=2e7db2&iconColorHighlight=4b8e0b&bgColorError=ffc73d&bgTextureError=glass&bgImgOpacityError=40&borderColorError=ffb73d&fcError=111111&iconColorError=a83300&bgColorOverlay=5c5c5c&bgTextureOverlay=flat&bgImgOpacityOverlay=50&opacityOverlay=80&bgColorShadow=cccccc&bgTextureShadow=flat&bgImgOpacityShadow=30&opacityShadow=60&thicknessShadow=7px&offsetTopShadow=-7px&offsetLeftShadow=-7px&cornerRadiusShadow=8px\n */.ui-widget{font-family:Segoe UI,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Segoe UI,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #666666;background:#000 url(\"https://mars.nasa.gov/assets/images/ui-bg_inset-soft_25_000000_1x100.png\") 50% bottom repeat-x;color:#ffffff}.ui-widget-content a{color:#ffffff}.ui-widget-header{border:1px solid #333333;background:#333 url(\"https://mars.nasa.gov/assets/images/ui-bg_gloss-wave_25_333333_500x100.png\") 50% 50% repeat-x;color:#ffffff;font-weight:bold}.ui-widget-header a{color:#ffffff}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #666666;background:#555 url(\"https://mars.nasa.gov/assets/images/ui-bg_glass_20_555555_1x400.png\") 50% 50% repeat-x;font-weight:bold;color:#eeeeee}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#eeeeee;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #59b4d4;background:#0078a3 url(\"https://mars.nasa.gov/assets/images/ui-bg_glass_40_0078a3_1x400.png\") 50% 50% repeat-x;font-weight:bold;color:#ffffff}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#ffffff;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #ffaf0f;background:#f58400 url(\"https://mars.nasa.gov/assets/images/ui-bg_inset-soft_30_f58400_1x100.png\") 50% 50% repeat-x;font-weight:bold;color:#ffffff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#ffffff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #cccccc;background:#eee url(\"https://mars.nasa.gov/assets/images/ui-bg_highlight-soft_80_eeeeee_1x100.png\") 50% top repeat-x;color:#2e7db2}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#2e7db2}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #ffb73d;background:#ffc73d url(\"https://mars.nasa.gov/assets/images/ui-bg_glass_40_ffc73d_1x400.png\") 50% 50% repeat-x;color:#111111}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#111111}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#111111}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:6px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:6px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:6px}.ui-widget-overlay{background:#5c5c5c url(\"https://mars.nasa.gov/assets/images/ui-bg_flat_50_5c5c5c_40x100.png\") 50% 50% repeat-x;opacity:.8;filter:Alpha(Opacity=80)}.ui-widget-shadow{margin:-7px 0 0 -7px;padding:7px;background:#ccc url(\"https://mars.nasa.gov/assets/images/ui-bg_flat_30_cccccc_40x100.png\") 50% 50% repeat-x;opacity:.6;filter:Alpha(Opacity=60);border-radius:8px}body .ui-datepicker{background:#175C84;border:none;border-radius:2px;padding-left:10px;padding-right:10px;padding-bottom:5px;z-index:99999 !important;font-size:1.05em !important;font-family:inherit}body .ui-datepicker table{border-collapse:separate;background:#175C84}body .ui-datepicker td{padding:1px;width:35px;height:25px}body .ui-datepicker .ui-datepicker-header{background:none;border:none;margin-bottom:0.3em;margin-top:0.6em}body .ui-datepicker .ui-datepicker-title{margin:0 1.8em;margin-top:-3px}body .ui-datepicker select.ui-datepicker-month,body .ui-datepicker .ui-datepicker select.ui-datepicker-year{width:40%}body .ui-datepicker select.ui-datepicker-month{margin-right:5%}body .ui-datepicker .ui-datepicker-prev{cursor:pointer;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -150px;background-size:300px;transform:rotate(180deg)}body .ui-datepicker .ui-datepicker-prev:hover,body .ui-datepicker .ui-datepicker-prev.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -175px;background-size:300px}body .ui-datepicker .ui-datepicker-prev .ui-state-hover{opacity:2}body .ui-datepicker .ui-datepicker-next{cursor:pointer;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -150px;background-size:300px}body .ui-datepicker .ui-datepicker-next:hover,body .ui-datepicker .ui-datepicker-next.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px -175px;background-size:300px}body .ui-datepicker .ui-datepicker-next .ui-state-hover{opacity:2}body .ui-datepicker .ui-datepicker-calendar{border-radius:4px;padding:1px}body .ui-datepicker .ui-datepicker-calendar thead{color:white}body .ui-datepicker .ui-state-default,body .ui-datepicker .ui-widget-content .ui-state-default,body .ui-datepicker .ui-widget-header .ui-state-default{font-weight:bold;border:none;background:transparent;color:#FFF;border-radius:0;text-align:center}body .ui-datepicker .ui-state-disabled,body .ui-datepicker .ui-widget-content .ui-state-disabled,body .ui-datepicker .ui-widget-header .ui-state-disabled{opacity:.45;filter:Alpha(Opacity=45)}body .ui-datepicker .ui-priority-secondary,body .ui-datepicker .ui-widget-content .ui-priority-secondary,body .ui-datepicker .ui-widget-header .ui-priority-secondary{opacity:1;-webkit-filter:none;filter:none}body .ui-datepicker .ui-state-active,body .ui-datepicker .ui-state-active.ui-state-hover{border:none;background:#F1F9FF;color:#175C83}body .ui-datepicker :not(.ui-datepicker-header) .ui-state-hover{border:none;background:#F1F9FF;color:#175C83}body .ui-datepicker .ui-datepicker-header .ui-state-hover{background-color:transparent;border:0}body .ui-datepicker td.ui-datepicker-today a.ui-state-hover,body .ui-datepicker td.ui-datepicker-today a.ui-state-highlight{background-color:#A1BCD0;color:#175C83}body .ui-datepicker td.ui-datepicker-today a:hover,body .ui-datepicker td.ui-datepicker-today a.ui-state-active{border:none;background:#F1F9FF;color:#175C83}body .ui-datepicker .ui-datepicker-buttonpane{display:flex;justify-content:space-between;border:none;background-color:transparent}body .ui-datepicker .ui-datepicker-buttonpane button{font-weight:600 !important;font-size:14px;padding:0.4em 0.8em 0.5em 0.8em;text-transform:uppercase;margin-bottom:0.8em}body .ui-datepicker .ui-datepicker-buttonpane button:hover{background:#F1F9FF;color:#175C83}body .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-close{order:3}.grid_view #ui-datepicker-div{left:calc(50% - 136px) !important}@media (max-width: 599px){.datepicker_mask{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.8);z-index:100}#ui-datepicker-div{position:absolute;left:0 !important;right:0 !important;top:10vh !important;margin:auto !important}}.faceted_search .gallery_header{border-bottom:2px solid #E5E5E5;padding-bottom:1.4em}.faceted_search .gallery_header .article_title{margin-bottom:1rem}.faceted_search .gallery_header .section_search{max-width:none}.faceted_search .gallery_header .search_binder{display:inline-block;vertical-align:top;margin-right:1.3%;width:100%;max-width:300px}@media (min-width: 769px), print{.faceted_search .gallery_header .search_binder{width:40%}}.faceted_search hr{border-top:2px solid #E5E5E5}.faceted_search.grid_view{background:white}.faceted_search.grid_view .content_title{letter-spacing:-.03em;display:none}.faceted_search.grid_view .image_and_description_container{min-height:0}.faceted_search.grid_view .article_teaser_body{display:none}.faceted_search.grid_view .list_date{display:none}.faceted_search.grid_view .list_image{width:100%;float:none;margin:0}.faceted_search.grid_view .bottom_gradient{color:#222;display:block;position:relative;margin-top:0.3rem;margin-top:.5rem;padding-bottom:0.4rem;text-align:left;min-height:52px}@media (min-width: 769px), print{.faceted_search.grid_view .bottom_gradient{margin-top:.5rem;min-height:85px}}.faceted_search.grid_view .bottom_gradient div{text-align:left}.faceted_search.grid_view .bottom_gradient h3{font-weight:600;font-size:0.95em}.faceted_search.grid_view li.slide{margin-bottom:.84034%;width:49.57983%;float:left}.faceted_search.grid_view li.slide:nth-child(2n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.faceted_search.grid_view li.slide:nth-child(2n+2){margin-left:50.42017%;margin-right:-100%;clear:none}@media (min-width: 600px), print{.faceted_search.grid_view li.slide{margin-bottom:.84034%;width:32.77311%;float:left}.faceted_search.grid_view li.slide:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.faceted_search.grid_view li.slide:nth-child(3n+2){margin-left:33.61345%;margin-right:-100%;clear:none}.faceted_search.grid_view li.slide:nth-child(3n+3){margin-left:67.22689%;margin-right:-100%;clear:none}}@media (min-width: 769px), print{.faceted_search.grid_view li.slide{width:24.36975%;float:left}.faceted_search.grid_view li.slide:nth-child(4n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.faceted_search.grid_view li.slide:nth-child(4n+2){margin-left:25.21008%;margin-right:-100%;clear:none}.faceted_search.grid_view li.slide:nth-child(4n+3){margin-left:50.42017%;margin-right:-100%;clear:none}.faceted_search.grid_view li.slide:nth-child(4n+4){margin-left:75.63025%;margin-right:-100%;clear:none}}@media (min-width: 1200px){.faceted_search.grid_view li.slide{width:19.32773%;float:left}.faceted_search.grid_view li.slide:nth-child(5n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.faceted_search.grid_view li.slide:nth-child(5n+2){margin-left:20.16807%;margin-right:-100%;clear:none}.faceted_search.grid_view li.slide:nth-child(5n+3){margin-left:40.33613%;margin-right:-100%;clear:none}.faceted_search.grid_view li.slide:nth-child(5n+4){margin-left:60.5042%;margin-right:-100%;clear:none}.faceted_search.grid_view li.slide:nth-child(5n+5){margin-left:80.67227%;margin-right:-100%;clear:none}}.faceted_search.grid_view li.slide a{display:block;text-decoration:none}.faceted_search.mosaics .gallery_header .article_title{font-size:1.2em;font-weight:500;margin-top:0.5rem;margin-bottom:0}@media (min-width: 769px), print{.faceted_search.mosaics.grid_view li.slide{margin-bottom:.84034%;width:32.77311%;float:left}.faceted_search.mosaics.grid_view li.slide:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.faceted_search.mosaics.grid_view li.slide:nth-child(3n+2){margin-left:33.61345%;margin-right:-100%;clear:none}.faceted_search.mosaics.grid_view li.slide:nth-child(3n+3){margin-left:67.22689%;margin-right:-100%;clear:none}}@media (min-width: 1200px){.faceted_search.mosaics.grid_view li.slide{margin-bottom:.84034%;width:32.77311%;float:left}.faceted_search.mosaics.grid_view li.slide:nth-child(3n+1){margin-left:0;margin-right:-100%;clear:both;margin-left:0}.faceted_search.mosaics.grid_view li.slide:nth-child(3n+2){margin-left:33.61345%;margin-right:-100%;clear:none}.faceted_search.mosaics.grid_view li.slide:nth-child(3n+3){margin-left:67.22689%;margin-right:-100%;clear:none}}.faceted_search.mosaics .view_selectors{display:none}.faceted_search.list_view .list_image{float:right;margin-left:4%;margin-bottom:.5em;width:32%}@media (min-width: 600px), print{.faceted_search.list_view .list_image{margin-left:0;margin-bottom:0;width:23.07692%;float:left;margin-right:2.5641%}}@media (min-width: 769px), print{.faceted_search.list_view .list_image{width:23.72881%;float:left;margin-right:1.69492%}}@media (min-width: 1024px), print{.faceted_search.list_view .list_image{width:23.72881%;float:left;margin-right:1.69492%}}.faceted_search.list_view .list_text{width:auto}@media (min-width: 600px), print{.faceted_search.list_view .list_text{width:74.35897%;float:right;margin-right:0}}@media (min-width: 769px), print{.faceted_search.list_view .list_text{width:74.57627%;float:right;margin-right:0}}@media (min-width: 1024px), print{.faceted_search.list_view .list_text{width:66.10169%;float:left;margin-right:1.69492%}}.faceted_search.list_view .content_title a{text-decoration:none;cursor:pointer;color:#222}.faceted_search.list_view .content_title a:hover{text-decoration:underline}.faceted_search.list_view .content_title{display:block;font-size:1.17em;margin-bottom:.1em;margin-bottom:.2em;font-weight:700;color:#222;letter-spacing:-.035em}@media (min-width: 600px), print{.faceted_search.list_view .content_title{font-size:1.35em;margin-bottom:.18em}}@media (min-width: 769px), print{.faceted_search.list_view .content_title{font-size:1.53em;margin-bottom:.26em}}@media (min-width: 1024px), print{.faceted_search.list_view .content_title{font-size:1.62em;margin-bottom:.29em}}@media (min-width: 1200px){.faceted_search.list_view .content_title{font-size:1.71em;margin-bottom:.32em}}.faceted_search.list_view .bottom_gradient{display:none}@media (min-width: 1024px), print{.faceted_search.list_view .article_teaser_body{font-size:1.1em}}.faceted_search.list_view li.slide:first-child{border-top:1px solid #CCC}.faceted_search.list_view li.slide{border-bottom:1px solid #CCC;padding:1.2em 0}.faceted_search.list_view li.slide a{text-decoration:none;cursor:pointer}.faceted_search .mobile_filter_btn{text-align:center;display:block}.faceted_search .mobile_filter_btn .button{margin-bottom:2.8em}@media (min-width: 600px), print{.faceted_search .mobile_filter_btn{display:none}}.faceted_search .filter_remove{padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -101px -201px;background-size:300px;display:inline-block;top:-1px;vertical-align:middle}.faceted_search .filter_remove:hover,.faceted_search .filter_remove.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -101px -201px;background-size:300px}.faceted_search .filtering_results{display:none;margin-bottom:1em}@media (min-width: 600px), print{.faceted_search .filtering_results{display:block}}.faceted_search .filtering_results .applied_filter{display:inline-block;margin:0 .5em .3em}.faceted_search .clear_filter{margin-left:1em;cursor:pointer}.faceted_search .mobile_clear_filters{padding-right:20px;vertical-align:middle}@media (min-width: 600px), print{.faceted_search .mobile_clear_filters{display:none}}.faceted_search .faceted_search_results .no_items{margin:2.8em 0;border:2px solid #E5E5E5;padding:1.4em;font-style:italic}.faceted_search input[type=\"checkbox\"]{margin-bottom:0.4em;margin-right:.4em}.faceted_search input[type=\"checkbox\"] label{font-size:0.9em;font-weight:400}.faceted_search input[type=\"checkbox\"] label input{vertical-align:middle}.faceted_search input[type=\"checkbox\"] label input+span{pointer-events:none}.faceted_search .facet_section.truncated ul li.truncatable{display:none !important}.faceted_search .facet_section.truncated .truncation_toggle:after{content:\"+ more\"}.faceted_search .facet_section.expanded .truncation_toggle:after{content:\"- less\"}.faceted_search .facet_section input.search_field{margin-top:0.3em}.faceted_search .facet_section .search_field{border:1px solid rgba(0,0,0,0.3);background-color:white;border-radius:4px;padding:8px 12px;margin-bottom:0.6em;font-size:16px}.faceted_search .facet_section .search_field.wide{width:100%}.faceted_search #secondary_column ul{margin-left:0;padding-left:1px}.faceted_search #secondary_column .date_option_wrapper{display:inline-block;margin-right:1%}.faceted_search #secondary_column .date_option_wrapper+.date_option_wrapper{margin-right:0}@media (min-width: 600px), print{.faceted_search #secondary_column .date_option_wrapper{margin-left:0;width:auto;margin-right:0}}.faceted_search #secondary_column .date_option_wrapper label.preposition{font-weight:bold;display:block}.faceted_search #secondary_column .date_option_wrapper label.preposition_small{display:none}.faceted_search #secondary_column .calendar_input_binder{position:relative;display:inline-block;width:100%;margin-bottom:.7em;cursor:pointer}.faceted_search #secondary_column .fs_datepicker,.faceted_search #secondary_column .mosaics_to,.faceted_search #secondary_column .mosaics_from{height:40px;font-size:16px;border:1px solid rgba(0,0,0,0.3);border-radius:4px;width:100%;margin:0 0.4em 0 0;padding:8px 32px 8px 8px;width:150px}.faceted_search #secondary_column .fs_datepicker:-webkit-autofill,.faceted_search #secondary_column .mosaics_to:-webkit-autofill,.faceted_search #secondary_column .mosaics_from:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px white inset;-webkit-text-fill-color:#222}.faceted_search #secondary_column .date_filters{margin:1em 0 -1em}.faceted_search #secondary_column .date_filters input[type=\"submit\"]{text-indent:-9999px;width:100%;padding:13.5px 16px}@media (min-width: 600px), print{.faceted_search #secondary_column .date_filters input[type=\"submit\"]{text-indent:0;padding:12px 13px}}.faceted_search #secondary_column .date_filters .right_arrow{position:absolute;left:0;right:0;margin:auto;top:30%;height:0px;width:0px;display:inline-block;border-radius:3px;border-top:6px solid transparent;border-left:9px solid white;border-bottom:6px solid transparent}@media (min-width: 600px), print{.faceted_search #secondary_column .date_filters .right_arrow{display:none}}.faceted_search #secondary_column .date_filters .datepicker_section{position:relative}.faceted_search #secondary_column .date_filters .datepicker_section label.preposition{display:block}.faceted_search #secondary_column .datepicker_section{padding:0 0.8em}.faceted_search #secondary_column .date_option_wrapper{display:inline-block;margin-right:1%}.faceted_search #secondary_column .date_option_wrapper+.date_option_wrapper{margin-right:0}@media (min-width: 600px), print{.faceted_search #secondary_column .date_option_wrapper{margin-left:0;width:auto;margin-right:0}}.faceted_search #secondary_column .date_option_wrapper label.preposition{font-weight:bold;display:block}.faceted_search #secondary_column .date_option_wrapper label.preposition_small{position:absolute;font-size:0.6em;left:9px;top:5px;color:#777}@media (min-width: 600px), print{.faceted_search #secondary_column .date_option_wrapper label.preposition_small{display:none}}.faceted_search #secondary_column .date_submit{position:absolute;right:0;top:0;width:9%;display:inline-block}@media (min-width: 600px), print{.faceted_search #secondary_column .date_submit{position:relative;width:auto}}.faceted_search #secondary_column button.ui-datepicker-trigger{vertical-align:middle;position:absolute;display:inline-block;right:6px;top:12px;width:38px;height:100%;padding:6px 8px 8px 8px;background:transparent;border:transparent}.faceted_search #secondary_column button.ui-datepicker-trigger:hover{opacity:.8}.faceted_search #secondary_column button.ui-datepicker-trigger img{width:22px;height:22px}.touchevents .faceted_search #secondary_column button.ui-datepicker-trigger{width:100%}.touchevents .faceted_search #secondary_column button.ui-datepicker-trigger img{float:right}.faceted_search #secondary_column .facet_section ul{margin-top:1.05em;margin-bottom:1.05em}.faceted_search #secondary_column .facet_section li{display:block;margin-bottom:0.35em}@supports (display: grid) and (grid-template-columns: max-content){.faceted_search #secondary_column .facet_section li label{display:grid;grid-template-columns:-webkit-max-content 1fr;grid-template-columns:max-content 1fr;align-items:center}.faceted_search #secondary_column .facet_section li input[type=\"checkbox\"]{margin-bottom:0;margin-right:0.7em}}.faceted_search #secondary_column .mobile_filter_controls,.faceted_search #secondary_column .expand_section{display:none}@media (max-width: 599px){.faceted_search #secondary_column{display:none;position:fixed;right:0;top:0;z-index:41;width:100%;height:100%;background-color:rgba(0,0,0,0.5)}.faceted_search #secondary_column.open{display:block}.faceted_search #secondary_column .facets_sidebar{border:none;background-color:white;height:100%;float:right;width:87.5%;padding:0;overflow-y:scroll;-webkit-overflow-scrolling:touch}.faceted_search #secondary_column h4,.faceted_search #secondary_column fieldset{padding:0.8em;margin:0}.faceted_search #secondary_column .form_section.open fieldset{padding-bottom:0}.faceted_search #secondary_column .form_section.open fieldset.facet_section{padding-bottom:.8em}.faceted_search #secondary_column header{padding:1em;margin:0}.faceted_search #secondary_column hr{display:none}.faceted_search #secondary_column .mobile_filter_controls{display:block;position:absolute;top:10px;right:10px}.faceted_search #secondary_column .mobile_filter_controls a{padding:1em}.faceted_search #secondary_column h4{background-color:#f3f3f3}.faceted_search #secondary_column .form_section{position:relative;margin-bottom:2px}.faceted_search #secondary_column .form_section fieldset{display:none}.faceted_search #secondary_column .form_section .expand_section{display:block;position:absolute;top:5px;right:0px;cursor:pointer;padding:12px}.faceted_search #secondary_column .form_section .expand_section .arrow_down{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #57585a;transition:transform 0.2s}.faceted_search #secondary_column .form_section.open fieldset,.faceted_search #secondary_column .form_section.open .featured_links{display:block}.faceted_search #secondary_column .form_section.open .expand_section .arrow_down{transform:rotate(180deg)}.faceted_search #secondary_column .form_section.open .distance{margin-bottom:1.6em}}.grid_layout .mosaics_container{margin-top:-1.5em}.study_list_item{margin:1em 0 0}.study_list_item a{text-decoration:none;color:black}.study_list_item h3{margin:1em 0}.study_list_item .study_description>div{margin:3px 0}.study_label{margin-right:1em;font-weight:700}.study_page .study_description{margin:1em 0}.study_page .study_description>div{margin:3px 0}.study_page .study_summary{margin:1em 0}.wysiwyg_content .center_focus_carousel_module{background-color:#e9eef4;width:100%;max-width:none;margin:3rem 0 3rem;padding:2.2rem 0px 2.5rem}@media (min-width: 600px), print{.wysiwyg_content .center_focus_carousel_module{padding:4rem 0 5rem}}.wysiwyg_content .center_focus_carousel_module .grid_layout{width:100%}@media (min-width: 600px), print{.wysiwyg_content .center_focus_carousel_module .grid_layout{width:calc(100% - 100px)}}.wysiwyg_content .center_focus_carousel_module .person{margin:0 3px}.wysiwyg_content .center_focus_carousel_module .person.slick-center{z-index:2}.wysiwyg_content .center_focus_carousel_module .person .image_container{opacity:.3;cursor:pointer}.wysiwyg_content .center_focus_carousel_module .person.slick-center .image_container{opacity:1;transform:scale(1.3);transition:transform .5s;cursor:default}.wysiwyg_content .center_focus_carousel_module .center_focus_carousel{margin-bottom:15px}.wysiwyg_content .center_focus_carousel_module .carousel_header{padding:0 8%}.wysiwyg_content .center_focus_carousel_module h2.module_title{margin:0}.wysiwyg_content .center_focus_carousel_module .slick-track{padding-top:15%;padding-bottom:15%}@media (min-width: 600px), print{.wysiwyg_content .center_focus_carousel_module .slick-track{padding-top:6%;padding-bottom:6%}}.wysiwyg_content .center_focus_carousel_module .caption_container{margin:auto;text-align:center;width:86%;max-width:568px}.wysiwyg_content .center_focus_carousel_module .caption_container .cf_slide_name{font-weight:700;font-size:1.4rem;margin-bottom:0.2rem}.wysiwyg_content .center_focus_carousel_module .caption_container .cf_slide_title{font-weight:500;font-size:1.15rem;color:#222222}.wysiwyg_content .center_focus_carousel_module .caption_container .cf_slide_descritpion{text-align:left}.wysiwyg_content .center_focus_carousel_module .caption_container .button{margin-bottom:0}.wysiwyg_content .center_focus_carousel_module .slick-prev,.wysiwyg_content .center_focus_carousel_module .slick-next{top:calc(50% - 32px)}.wysiwyg_content .center_focus_carousel_module .slick-prev:before,.wysiwyg_content .center_focus_carousel_module .slick-next:before{content:none}.wysiwyg_content .center_focus_carousel_module .slick-next{position:absolute;height:75px;width:44px;z-index:1;right:-50px}.wysiwyg_content .center_focus_carousel_module .slick-next:after{content:'';position:absolute;margin:auto;width:25px;height:25px;transform:rotate(45deg) skew(10deg, 10deg);top:0px;left:2%;right:20%;bottom:2px;border-top:3px solid #a1a3a3;border-right:3px solid #a1a3a3}.wysiwyg_content .center_focus_carousel_module .slick-next:hover:after{border-color:#bcb9b9}.wysiwyg_content .center_focus_carousel_module .slick-prev{position:absolute;height:75px;width:44px;z-index:1;left:-50px}.wysiwyg_content .center_focus_carousel_module .slick-prev:after{content:'';position:absolute;margin:auto;width:25px;height:25px;transform:rotate(45deg) skew(10deg, 10deg);top:0px;left:20%;right:2%;bottom:2px;border-bottom:3px solid #a1a3a3;border-left:3px solid #a1a3a3}.wysiwyg_content .center_focus_carousel_module .slick-prev:hover:after{border-color:#bcb9b9}.wysiwyg_content .center_focus_carousel_module footer{margin-top:2rem;font-weight:800}.content_page:not(.stellar_item_feature) .center_focus_carousel_module{padding:2.2rem 0px 2.5rem}@media (min-width: 600px), print{.content_page:not(.stellar_item_feature) .center_focus_carousel_module{padding:2.9rem 0 2.6rem}}.wysiwyg_content .center_focus_carousel_module.sfad_carousel .sfad_footer{font-weight:800;text-align:center;width:86%;margin:2rem auto 0}.rrr{border:0px solid transparent}.automat_module{width:100%;padding:3em 0 3.5em}.feature_pages .wysiwyg_content .automat_module{margin-left:auto;margin-right:auto;width:95%;max-width:1200px}@media (min-width: 480px){.feature_pages .wysiwyg_content .automat_module{width:90%}}@media (min-width: 1024px){.feature_pages .wysiwyg_content .automat_module{width:99%}}.homepage_page .automat_module{padding-right:3em;padding-left:3em}.automat_module.dark_bg{color:#fff}.automat_module header{margin-bottom:0.4rem}@media (min-width: 1024px){.automat_module header{margin-bottom:2rem}}.automat_module h2.module_title{margin:0;font-size:1.8rem;text-align:center}.automat_module .module_subtitle{line-height:1.4;width:100%;display:block;text-align:center;margin-left:auto;margin-right:auto;margin-top:1rem}@media (min-width: 480px){.automat_module .module_subtitle{width:90%}}@media (min-width: 769px), print{.automat_module .module_subtitle{width:80%}}@media (min-width: 1024px), print{.automat_module .module_subtitle{width:60%}}@media (min-width: 1200px){.automat_module .module_subtitle{width:50%}}.automat_module .category{text-transform:uppercase;color:#979ea7;font-family:CooperHewitt,Helvetica,Arial,sans-serif;font-weight:700;font-size:.75rem}.feature_pages .automat_module .category{font-size:.85rem}@media (min-width: 1024px){.automat_module .category{color:#bbd3ec}}.automat_module .title{margin-top:.2rem}.automat_module .image_container{background-size:cover}.automat_module a.compartment_link{word-wrap:normal}.automat_module .additional_info{clear:both;display:none}.automat_module .more_link{font-weight:700;text-transform:capitalize;margin-top:0.3rem;font-size:0.9rem}.feature_pages .automat_module .more_link{margin-top:1rem;font-size:.9rem}@media (min-width: 1024px){.feature_pages .automat_module .more_link{font-size:1.1rem}}.automat_module .more_link:after{content:\" ›\"}.automat_module .rollover_body{font-size:0.8rem;font-weight:500;margin-bottom:0.2rem}@media (min-width: 1024px){.automat_module .rollover_body{font-size:0.8rem}}@media (min-width: 1024px){.feature_pages .automat_module .rollover_body{font-size:1rem}}.automat_module .rollover_body p:first-child{margin-top:0}.automat_module .large_button_text_container{padding:1em 0}@media (min-width: 600px), print{.automat_module .large_button_text_container{padding:2em}}.automat_module .definition_description{font-size:.85em;display:inline-block;vertical-align:middle;width:56%;text-align:left}@media (min-width: 600px), print{.automat_module .definition_description{width:auto;text-align:center}}.automat_module .gradient_container_bottom{display:none;z-index:0}.automat_module .automat_footer{margin-top:1.7rem;text-align:center}.automat_module video,.automat_module .background_image{position:absolute;top:0;left:0;max-width:120%;z-index:-1}.automat_module video{display:none}@media (min-width: 600px), print{.automat_module video{display:block;width:120%}.touchevents .automat_module video{display:none}}@media (min-width: 1024px), print{.automat_module video{width:105%}}@media (min-width: 1200px){.automat_module video{width:102%}}@media (min-width: 1700px){.automat_module video{width:101%}}.automat_module .background_image{min-width:100%;min-height:100%;height:100%;background-size:cover}@media (max-width: 1023px){.automat_module .desktop_automat_items{display:none}}@media (min-width: 1024px){.automat_module .mobile_automat_items{display:none}}@media (min-width: 1024px){.automat_module .automat_items{text-align:center}.automat_module .automat_items a:hover{text-decoration:none}.automat_module .compartment{overflow:hidden;display:inline-block;position:relative;vertical-align:middle;background-color:rgba(255,255,255,0.13);width:270px;height:270px;margin:0.3%;cursor:pointer;transition:all 200ms;color:#d4ecfb}}@media (min-width: 1024px) and (min-width: 769px), print and (min-width: 1024px){.automat_module .compartment{border-width:8px}}@media (min-width: 1024px) and (min-width: 1200px){.automat_module .compartment{margin:0.3%;width:224px;height:224px}}@media (min-width: 1024px){.feature_pages .automat_module .compartment,.subsite_content_page .automat_module .compartment,.homepage_page .automat_module .compartment{margin:0 0.6%;width:311px;height:311px}}@media (min-width: 1024px) and (min-width: 1200px){.feature_pages .automat_module .compartment,.subsite_content_page .automat_module .compartment,.homepage_page .automat_module .compartment{margin:1.2%;width:367px;height:367px}}@media (min-width: 1024px){.automat_module .compartment .title{color:white;display:inline-block;font-size:1em;font-weight:600;vertical-align:middle}.feature_pages .automat_module .compartment .title{font-size:1em}}@media (min-width: 1024px) and (min-width: 1024px), print and (min-width: 1024px){.feature_pages .automat_module .compartment .title{font-size:1.2em}}@media (min-width: 1024px) and (min-width: 1200px){.feature_pages .automat_module .compartment .title{font-size:1.4em}}@media (min-width: 1024px){.no-touchevents .automat_module .compartment:hover .additional_info{display:block}.automat_module .rollover_body{max-height:34px;overflow:hidden;color:white}.automat_module .rollover_body::-webkit-scrollbar{width:8px}.automat_module .rollover_body::-webkit-scrollbar-thumb{background-color:rgba(107,107,107,0.6)}.automat_module .rollover_body::-webkit-scrollbar-track{background-color:rgba(157,157,157,0.4)}.feature_pages .automat_module .rollover_body{max-height:100px}.automat_module .rollover_body p{color:white}.automat_module .image_container{width:100%;height:100%;position:relative;z-index:0}.automat_module .automat_text_container{position:absolute;bottom:30px;left:0;width:100%}.automat_module .automat_text_container .category{font-family:CooperHewitt,Helvetica,Arial,sans-serif}}.automat_module.circle .compartment{font-size:.9rem;border-radius:50%;border:4px solid #969696}.automat_module.circle .compartment:hover .automat_screen{top:0;background-color:rgba(0,0,0,0.6);position:absolute;width:100%;height:100%;transition:all .3s}.automat_module.circle .compartment:hover .automat_cover_title{opacity:0;bottom:100px}.automat_module.circle .compartment:hover .automat_text_container{opacity:1;transition:opacity .5s ease-in-out 0s}.automat_module.circle .compartment:hover .rollover_body{width:94%;margin-left:auto;margin-right:auto}.automat_module.circle .compartment:hover .title{width:88%}.automat_module.circle .compartment .automat_cover_title{position:absolute;opacity:1;bottom:50px;left:0;width:100%}.automat_module.circle .compartment .automat_text_container{position:absolute;opacity:0;bottom:50px;left:0;width:100%}.automat_module.circle .compartment .automat_text_container>*{margin-left:auto;margin-right:auto}.automat_module.circle .compartment .category{margin-left:auto;margin-right:auto;width:80%}.automat_module.circle .compartment .title{width:74%}.automat_module.circle .compartment .additional_info{width:88%;margin:auto}@media (min-width: 1024px){.automat_module.circle .compartment .gradient_container_bottom{display:block}}@media (min-width: 1024px){.feature_pages .automat_module .item_count_4 .compartment,.feature_pages .automat_module .item_count_7 .compartment,.feature_pages .automat_module .item_count_8 .compartment{margin:0.7%}}@media (min-width: 1024px), print{.feature_pages .automat_module .item_count_4 .compartment,.feature_pages .automat_module .item_count_7 .compartment,.feature_pages .automat_module .item_count_8 .compartment{margin:0.7%;width:284px;height:284px}}@media (min-width: 1200px){.feature_pages .automat_module .item_count_4 .compartment,.feature_pages .automat_module .item_count_7 .compartment,.feature_pages .automat_module .item_count_8 .compartment{margin:0.5%}}.feature_pages .automat_module .item_count_4 .compartment .rollover_body,.feature_pages .automat_module .item_count_7 .compartment .rollover_body,.feature_pages .automat_module .item_count_8 .compartment .rollover_body{max-height:50px}.automat_module.square .compartment{color:black}.automat_module.square .compartment .automat_text_container{text-align:left;padding:0.9rem 1rem 0.5rem;bottom:0;background-color:rgba(65,65,65,0.69)}@media (max-width: 1023px){.automat_module .compartment_mobile{overflow:hidden;width:100%;padding:1.4rem 0;border-bottom:1px solid #c3c3c3}.automat_module .compartment_mobile:last-child{border-bottom:none}.automat_module .automat_text_container{position:relative}.automat_module .rollover_body{line-height:1.54}.automat_module .rollover_body p{line-height:inherit}.automat_module .image_container{height:100px;width:100px;float:right;margin-left:1.1rem;margin-bottom:1rem}.automat_module.circle .image_container{border-radius:50%;border:2px solid #969696}.automat_module .title{font-size:1.2rem}.automat_module .arrow_container{display:block;position:absolute;width:28px;height:28px;right:0;top:0;text-align:center}.automat_module .current .arrow_container svg{transform:rotate(-180deg)}}.automat_module.automat_definition_teaser,.homepage_home .automat_module.automat_definition_teaser{padding:4em 0 4em}.automat_module.automat_definition_teaser .module_title,.homepage_home .automat_module.automat_definition_teaser .module_title{font-size:1.69em;margin-bottom:.1875em;text-align:center;font-weight:700}@media (min-width: 600px), print{.automat_module.automat_definition_teaser .module_title,.homepage_home .automat_module.automat_definition_teaser .module_title{font-size:1.95em;margin-bottom:.3375em}}@media (min-width: 769px), print{.automat_module.automat_definition_teaser .module_title,.homepage_home .automat_module.automat_definition_teaser .module_title{font-size:2.21em;margin-bottom:.4875em}}@media (min-width: 1024px), print{.automat_module.automat_definition_teaser .module_title,.homepage_home .automat_module.automat_definition_teaser .module_title{font-size:2.34em;margin-bottom:.54375em}}@media (min-width: 1200px){.automat_module.automat_definition_teaser .module_title,.homepage_home .automat_module.automat_definition_teaser .module_title{font-size:2.47em;margin-bottom:.6em}}.automat_module.automat_definition_teaser .compartment,.homepage_home .automat_module.automat_definition_teaser .compartment{background-color:rgba(255,255,255,0.2);border:9px solid rgba(230,230,230,0.7)}.automat_module.automat_definition_teaser .compartment .automat_text_container,.homepage_home .automat_module.automat_definition_teaser .compartment .automat_text_container{display:none}.automat_module.automat_definition_teaser .compartment:hover,.homepage_home .automat_module.automat_definition_teaser .compartment:hover{background-color:rgba(255,255,255,0.2);border:9px solid #e6e6e6}.automat_module.automat_definition_teaser .compartment:hover .additional_info,.homepage_home .automat_module.automat_definition_teaser .compartment:hover .additional_info{display:none}.automat_module.automat_definition_teaser .compartment:hover .automat_cover_title,.homepage_home .automat_module.automat_definition_teaser .compartment:hover .automat_cover_title{opacity:1;bottom:initial}.automat_module.automat_definition_teaser .compartment .additional_info,.homepage_home .automat_module.automat_definition_teaser .compartment .additional_info{display:none}.automat_module.automat_definition_teaser .compartment .automat_screen,.homepage_home .automat_module.automat_definition_teaser .compartment .automat_screen{display:none}.automat_module.automat_definition_teaser .compartment .title,.homepage_home .automat_module.automat_definition_teaser .compartment .title{font-size:1.3em;font-weight:900;width:88%;line-height:1.3}.automat_module.automat_definition_teaser .compartment .automat_cover_title,.homepage_home .automat_module.automat_definition_teaser .compartment .automat_cover_title{width:100%;position:absolute;text-align:center;top:50%;bottom:initial;transform:translateY(-50%)}.automat_module.automat_definition_teaser .compartment .gradient_container_bottom,.homepage_home .automat_module.automat_definition_teaser .compartment .gradient_container_bottom{display:none}.automat_module.automat_definition_teaser .compartment .image_container,.homepage_home .automat_module.automat_definition_teaser .compartment .image_container{background-image:none}.automat_module.automat_definition_teaser .automat_footer,.homepage_home .automat_module.automat_definition_teaser .automat_footer{margin-top:2.0rem}@media (min-width: 1024px){.automat_module.automat_definition_teaser .compartment,.homepage_home .automat_module.automat_definition_teaser .compartment{width:170px;height:170px}}@media (min-width: 1024px) and (min-width: 1200px){.automat_module.automat_definition_teaser .compartment,.homepage_home .automat_module.automat_definition_teaser .compartment{margin:0.8%;width:220px;height:220px}}@media (max-width: 1023px){.automat_module.automat_definition_teaser,.homepage_home .automat_module.automat_definition_teaser{padding-left:0;padding-right:0}.automat_module.automat_definition_teaser header,.homepage_home .automat_module.automat_definition_teaser header{padding-left:3em;padding-right:3em}.automat_module.automat_definition_teaser .automat_items,.homepage_home .automat_module.automat_definition_teaser .automat_items{width:90%;text-align:center;margin-top:1.5rem;margin-left:auto;margin-right:auto}.automat_module.automat_definition_teaser .automat_items a:hover,.homepage_home .automat_module.automat_definition_teaser .automat_items a:hover{text-decoration:none}.automat_module.automat_definition_teaser .additional_info_mobile,.automat_module.automat_definition_teaser .image_container,.homepage_home .automat_module.automat_definition_teaser .additional_info_mobile,.homepage_home .automat_module.automat_definition_teaser .image_container{display:none}.automat_module.automat_definition_teaser .compartment_mobile,.homepage_home .automat_module.automat_definition_teaser .compartment_mobile{padding:1rem 0;border-bottom:1px solid #9c9c9c}.automat_module.automat_definition_teaser .compartment_mobile:last-child,.homepage_home .automat_module.automat_definition_teaser .compartment_mobile:last-child{border-bottom:1px solid #9c9c9c}.automat_module.automat_definition_teaser .compartment_mobile .automat_text_container,.homepage_home .automat_module.automat_definition_teaser .compartment_mobile .automat_text_container{color:#c1e7ff}.automat_module.automat_definition_teaser .module_title,.homepage_home .automat_module.automat_definition_teaser .module_title{font-size:1.8rem}.automat_module.automat_definition_teaser .module_subtitle,.homepage_home .automat_module.automat_definition_teaser .module_subtitle{font-size:1rem}}@media (max-width: 1023px) and (min-width: 600px), print and (max-width: 1023px){.automat_module.automat_definition_teaser .automat_items,.homepage_home .automat_module.automat_definition_teaser .automat_items{width:70%}.automat_module.automat_definition_teaser .module_title,.homepage_home .automat_module.automat_definition_teaser .module_title{font-size:2.8rem}.automat_module.automat_definition_teaser .module_subtitle,.homepage_home .automat_module.automat_definition_teaser .module_subtitle{font-size:1.1rem}.automat_module.automat_definition_teaser .compartment_mobile,.homepage_home .automat_module.automat_definition_teaser .compartment_mobile{overflow:hidden;width:170px;height:170px;display:inline-block;border-radius:50%;padding:0;margin:1%;border:9px solid #e6e6e6;vertical-align:top;position:relative}.automat_module.automat_definition_teaser .compartment_mobile:last-child,.homepage_home .automat_module.automat_definition_teaser .compartment_mobile:last-child{border-bottom:9px solid #e6e6e6}.automat_module.automat_definition_teaser .compartment_mobile>a,.homepage_home .automat_module.automat_definition_teaser .compartment_mobile>a{display:inline-block;width:100%;height:100%;text-decoration:none}.automat_module.automat_definition_teaser .compartment_mobile .automat_text_container,.homepage_home .automat_module.automat_definition_teaser .compartment_mobile .automat_text_container{position:absolute;width:100%;top:50%;transform:translateY(-50%)}.automat_module.automat_definition_teaser .image_container,.homepage_home .automat_module.automat_definition_teaser .image_container{height:100%;width:100%;border:0}.automat_module.automat_definition_teaser .title,.homepage_home .automat_module.automat_definition_teaser .title{width:88%;font-size:1.15em;font-weight:900;margin-left:auto;margin-right:auto;color:white}}@media (max-width: 1023px) and (min-width: 769px), print and (max-width: 1023px){.automat_module.automat_definition_teaser .automat_items,.homepage_home .automat_module.automat_definition_teaser .automat_items{width:50%}}@media (max-width: 1023px) and (min-width: 1024px), print and (max-width: 1023px){.automat_module.automat_definition_teaser .automat_items,.homepage_home .automat_module.automat_definition_teaser .automat_items{width:50%}}.responsive_image{display:block;position:relative;padding-bottom:100%;background:black;overflow:hidden}.responsive_image__element{position:absolute;top:0;left:0;width:100%;height:100%}img.responsive_image__element{height:auto}@supports ((-o-object-fit: cover) or (object-fit: cover)){img.responsive_image__element{height:100%;-o-object-fit:cover;object-fit:cover}[data-avoid-crop] img.responsive_image__element{-o-object-fit:contain;object-fit:contain}}.responsive_image__element[style*=\"relative\"]{position:absolute !important}.responsive_image[data-aspect-ratio=\"2/1\"]{padding-bottom:50%}.responsive_image[data-aspect-ratio=\"3/2\"]{padding-bottom:66.66666667%}.responsive_image[data-aspect-ratio=\"4/3\"]{padding-bottom:75%}.responsive_image[data-aspect-ratio=\"1/1\"]{padding-bottom:100%}.responsive_image[data-aspect-ratio=\"1/2\"]{padding-bottom:200%}.react_photo_gallery{width:100%;max-width:none;position:relative}.react_photo_gallery .photo_index{text-align:center}.react_photo_gallery .nav{width:100%}.react_photo_gallery .next,.react_photo_gallery .prev{cursor:pointer;top:50%;margin-top:-2.34375em;background-color:transparent;border-width:0}.react_photo_gallery .next:disabled,.react_photo_gallery .prev:disabled{opacity:0;cursor:default}.react_photo_gallery .prev{position:absolute;height:4.6875em;width:2.75em;left:0.625em}.react_photo_gallery .next{position:absolute;height:4.6875em;width:2.75em;right:0.625em}.react_photo_gallery .next::after{content:'';position:absolute;margin:auto;width:1.5625em;height:1.5625em;transform:rotate(45deg) skew(10deg, 10deg);top:0px;left:2%;right:20%;bottom:2px;border-top:3px solid white;border-right:3px solid white}.react_photo_gallery .prev::after{content:'';position:absolute;margin:auto;width:1.5625em;height:1.5625em;transform:rotate(45deg) skew(10deg, 10deg);top:0px;left:20%;right:2%;bottom:2px;border-bottom:3px solid white;border-left:3px solid white}@media (max-width: 500px){.react_photo_gallery .next,.react_photo_gallery .prev{font-size:0.5em}}.react_photo_gallery .photo_index{position:absolute;color:white;margin-top:-2.25em;width:100%}body#facts #page_header{display:none}body#facts section.content_page.module{padding-top:0}.mars_facts{text-align:center;padding-top:0}.mars_facts header{color:#000;margin-bottom:1.5em}.mars_facts header .module_title{font-weight:600;color:#252525;font-size:2.5rem}.mars_facts header .description{font-weight:500}.mars_facts .desktop_nav{display:none;margin-bottom:3rem;justify-content:center;align-items:center}@media (min-width: 600px), print{.mars_facts .desktop_nav{display:flex}}.mars_facts .desktop_nav .nav_item{width:145px;background-color:#f9f2f0;padding:.7em 0;color:#867071;margin:0 4px 8px;font-weight:500;cursor:pointer}.mars_facts .desktop_nav .nav_item.current,.mars_facts .desktop_nav .nav_item:hover{background-color:#eeddd9;color:#613b34;font-weight:600}.mars_facts .mobile_nav{margin-bottom:40px;background:#3B788B url(\"https://mars.nasa.gov/assets/[email protected]\") no-repeat 95% 10px;background-position:right .8em top 10px;background-size:9px;padding:7px 10px;border-radius:5px;cursor:pointer}@media (min-width: 600px), print{.mars_facts .mobile_nav{display:none}}.mars_facts .mobile_nav select{background:transparent;border:none;width:100%;color:white;font-weight:600;cursor:pointer}.mars_facts .fact_title{font-size:2rem;text-align:center;margin-bottom:1rem;font-weight:600}.mars_facts .quick_detailed{text-align:center;margin-bottom:3rem;font-weight:600}.mars_facts .quick_detailed a{margin-right:1rem;color:#a4a4a4;cursor:pointer}.mars_facts .quick_detailed a:hover{text-decoration:none;color:#252527}.mars_facts .quick_detailed a.current{color:#252527;font-weight:600;padding-bottom:2px;border-bottom:3px solid #8E7671}.mars_facts .quick_facts .image_container{max-width:770px;margin:0 auto}.mars_facts .quick_facts .title_description_container{padding-top:1.5rem}.mars_facts .quick_facts .title_description_container h2{font-size:1.8rem;font-weight:600}.mars_facts .quick_facts .title_description_container .description p{font-weight:400;color:#222;line-height:1.3em}.mars_facts .quick_facts .title_description_container .highlight_fact{font-size:1.3em;font-weight:700;margin:2em 0 1.2em}.mars_facts .quick_facts .close_btn{position:absolute;top:.5em;right:.5em;padding:.8em;z-index:99999}.mars_facts .quick_facts .close_btn .icon{width:24px;height:24px;display:block;padding:0;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0px;background-size:300px}.mars_facts .quick_facts .close_btn .icon:hover,.mars_facts .quick_facts .close_btn .icon.active{background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0px;background-size:300px}.mars_facts .columns{display:flex;justify-content:center;align-items:center;flex-direction:column;font-weight:400;font-size:1.3em}.mars_facts .columns .col.mars{color:#6D3007;margin-bottom:2em}.mars_facts .columns .col.earth{color:#052848}.mars_facts .columns .col .column_title{font-size:.9rem;font-weight:700;margin-bottom:.5rem}.mars_facts .columns .col .fact{font-weight:600}@media (min-width: 600px), print{.mars_facts .columns{flex-direction:row}.mars_facts .columns .col.mars{margin-right:2rem;margin-bottom:0em}.mars_facts .columns .col.earth{margin-left:2rem}}.mars_facts .detailed_facts .unit_close{position:fixed;top:0;left:0;height:100vh;width:100vw}.mars_facts .detailed_facts .statement{display:flex;flex-direction:column;margin-bottom:3rem;border:1px solid #F1EAEB}@media (min-width: 600px), print{.mars_facts .detailed_facts .statement{flex-direction:row}}.mars_facts .detailed_facts .statement .description{font-weight:400}.mars_facts .detailed_facts .statement .premise{position:relative;padding:3rem 5rem}@media (min-width: 600px), print{.mars_facts .detailed_facts .statement .premise{width:40%}}.mars_facts .detailed_facts .statement .premise .image_container{width:150px;margin:auto}.mars_facts .detailed_facts .statement .premise h3{margin:.5rem 0 1rem 0}.mars_facts .detailed_facts .statement .premise .tooltip{width:0;height:0;position:absolute;left:50%;transform:translate(-50%, 48px);border-left:20px solid transparent;border-right:20px solid transparent;border-top:20px solid #fff}@media (min-width: 600px), print{.mars_facts .detailed_facts .statement .premise .tooltip{top:50%;left:100%;transform:translate(0, -50%);border-top:30px solid transparent;border-bottom:30px solid transparent;border-left:30px solid #fff;border-right:none}}.mars_facts .detailed_facts .statement .conclusion{padding:3rem 5rem;background-color:#fff5f3}@media (min-width: 600px), print{.mars_facts .detailed_facts .statement .conclusion{width:60%;display:flex;flex-direction:column;justify-content:space-between}}.mars_facts .detailed_facts .statement .conclusion .tools{position:relative;top:-2rem;right:-2rem}.mars_facts .detailed_facts .statement .conclusion .tools .icon_text_button{position:absolute;display:flex;right:-30px;padding-top:10px;transform:translateY(-10px);color:#A69694;font-weight:700;cursor:pointer}.mars_facts .detailed_facts .statement .conclusion .tools .icon_text_button .icon{line-height:normal;margin-left:.2em}.mars_facts .detailed_facts .statement .conclusion .tools .icon_text_button .icon .svg_icon_container{width:18px;height:18px}.mars_facts .detailed_facts .statement .conclusion .tools .units_container{display:none;position:absolute;text-align:left;border:1px solid rgba(51,51,51,0.1);bottom:10px;right:-3.5em;background:white;padding:1em;max-width:250px}@media (min-width: 769px), print{.mars_facts .detailed_facts .statement .conclusion .tools .units_container{right:-4em}}.mars_facts .detailed_facts .statement .conclusion .tools .units_container .unit_selector{font-weight:700;font-size:.9em;color:#939393;margin-bottom:.9em;cursor:pointer}.mars_facts .detailed_facts .statement .conclusion .tools .units_container .unit_selector.current{color:#000}.mars_facts .detailed_facts .statement .conclusion .tools .units_container .unit_selector:last-child{margin-bottom:.7em}.mars_facts .detailed_facts .statement .conclusion .tools .units_container .ancilla{border-top:1px solid #c5c5c5;padding-top:.5em;font-size:.9em;font-weight:500;color:#939393}.mars_facts .detailed_facts .statement .conclusion .tools .units_container.open{display:block}.mars_facts .detailed_facts .statement .conclusion .tools .units_tooltip{display:none;position:absolute;right:-31px;transform:translateY(-11px);border-top:10px solid #fff;border-left:10px solid transparent;border-right:10px solid transparent}.mars_facts .detailed_facts .statement .conclusion .tools .units_tooltip.open{display:block}.mars_facts .detailed_facts .statement .conclusion .tools .units_tooltip_border{display:none;position:absolute;right:-32px;transform:translateY(-11px);border-top:11px solid rgba(51,51,51,0.1);border-left:11px solid transparent;border-right:11px solid transparent}.mars_facts .detailed_facts .statement .conclusion .tools .units_tooltip_border.open{display:block}.mars_facts .detailed_facts .statement .conclusion .highlight_fact{font-weight:700;margin-bottom:1rem;font-size:1.4rem}.mars_facts .detailed_facts .statement .conclusion .description{margin-bottom:1.5rem}.mars_facts .detailed_facts .statement .conclusion .columns{margin-bottom:1rem}@media (min-width: 600px), print{.mars_facts .detailed_facts .statement .conclusion .columns{margin-bottom:2rem}}@media (min-width: 600px), print{.mars_facts .detailed_facts .statement .conclusion .dyk{text-align:left}}.mars_facts .detailed_facts .statement .conclusion .dyk .dyk_title{font-weight:600;font-size:1.2rem;margin-bottom:1rem}.mars_facts .detailed_facts .statement .conclusion .dyk .dyk_content{font-weight:400}.mars_facts .detailed_facts .statement .conclusion table.fact_table{border-spacing:2px;margin-bottom:2.5rem}.mars_facts .detailed_facts .statement .conclusion table.fact_table tbody{font-weight:600}.mars_facts .detailed_facts .statement .conclusion table.fact_table tbody tr td{background:#F2E7E5}.mars_facts .detailed_facts .statement .conclusion table.fact_table tbody tr:first-of-type td{font-weight:700}.mars_facts .detailed_facts .statement .conclusion table.fact_table tbody tr:nth-of-type(odd) td{background:transparent}.secondary_megasection_nav{position:-webkit-sticky;position:sticky;top:0;z-index:11}body.megasection_nav_present section.banner_feature nav.secondary_nav.secondary_nav_desktop{display:none}.msl .megasection_nav .megasection_title{color:white}@media (min-width: 1200px){.megasection_nav{background-color:#D1DEE7;font-weight:400;text-align:center;position:relative;width:100%;z-index:20}.megasection_nav .megasection_title{display:inline-block;z-index:60;position:relative;text-transform:uppercase;font-size:27px;vertical-align:bottom;opacity:1}.megasection_nav .megasection_title a{color:white}.megasection_nav .megasection_title_container{margin-left:16px;position:absolute;left:0px;top:8px}.megasection_nav .main_nav_item{text-transform:uppercase;display:inline-block;padding:0.5em 1em 0.9em;color:#575e6b;text-decoration:none;cursor:pointer}.megasection_nav .nav{margin:0;flex:1;width:100%}.megasection_nav .nav li{white-space:nowrap}.megasection_nav .nav>li{margin-right:1em;padding-top:10px;display:inline-block}.megasection_nav .nav>li:last-child{margin-right:0}.megasection_nav .nav>li.current .main_nav_item,.megasection_nav .nav>li:hover .main_nav_item{background-color:white;color:#575e6b}.megasection_nav .nav .main_nav_item{color:#285978}.megasection_nav li:hover .megasection_subnav{display:block}.megasection_nav .megasection_subnav{display:none;position:absolute;background-color:#D1DEE7;border:1px solid #D1DEE7;border-width:0 1px 1px;min-width:100%;left:0;width:auto;margin:0;cursor:pointer}.megasection_nav .megasection_subnav li{display:block;text-align:left;border-top:#e0e3e6 1px solid;background-color:#D1DEE7;margin-bottom:0}.megasection_nav .megasection_subnav li a{display:block;color:#575e6b;padding:0.7rem 1.1rem}.megasection_nav .megasection_subnav li:hover{background-color:white}.megasection_nav .megasection_subnav li:hover a{text-decoration:none}.megasection_nav_present.msl .megasection_nav{background-color:#e05140}.megasection_nav_present.msl li:hover .main_nav_item,.megasection_nav_present.msl li.current .main_nav_item{color:#942D25}.megasection_nav_present.msl .main_nav_item{color:#fff}.megasection_nav_present.msl .megasection_subnav{background-color:#ffe4e1;border:1px solid #ffe4e1}.megasection_nav_present.msl .megasection_subnav li{background-color:#ffe4e1;border-top:1px solid white}.megasection_nav_present.msl .megasection_subnav li a{text-decoration:none;color:#942D25}.megasection_nav_present.msl .megasection_subnav li:hover{background-color:white}.secondary_megasection_nav .megasection_title_container{display:none}.secondary_megasection_nav .megasection_nav.sticky .megasection_title_container,.secondary_megasection_nav .megasection_nav .megasection_title_container.megasection_title_container_always_vis{display:block}.secondary_megasection_nav .nav>li{margin:0;font-family:\"Montserrat\",Helvetica,Arial,sans-serif;position:relative;border-color:#D1DEE7;font-size:.93rem;font-weight:600}.secondary_megasection_nav .megasection_subnav{font-family:\"Montserrat\",Helvetica,Arial,sans-serif}.secondary_megasection_nav .megasection_subnav li:first-child{border-top:none}#site_nav_container .magic_shell_subnav .megasection_nav{display:none}#site_nav_container .magic_shell_subnav .megasection_nav .nav{margin:0;height:100%;margin:0 65px 0 0}#site_nav_container .magic_shell_subnav .megasection_nav .nav li{height:100%;border:none;background-color:#1d1d1d}#site_nav_container .magic_shell_subnav .megasection_nav .nav li a.main_nav_item{height:100%;color:#bdbdbd;background-color:transparent;padding:1em 1em}#site_nav_container .magic_shell_subnav .megasection_nav .nav li a.main_nav_item:hover{color:white}#site_nav_container .magic_shell_subnav .megasection_nav .nav li.current a{color:white}#site_nav_container .magic_shell_subnav .megasection_nav .megasection_subnav{border:none}#site_nav_container .magic_shell_subnav .megasection_nav .megasection_subnav a{color:white}#site_nav_container .magic_shell_subnav .megasection_nav .megasection_subnav li{border-top:1px solid #2c2c2c}#site_nav_container .magic_shell_subnav .megasection_nav .megasection_subnav li:first-child{border-top:none}#site_nav_container .magic_shell_subnav .megasection_nav .megasection_subnav li:hover{background-color:#565656}.nav_expanded #site_nav_container .magic_shell_subnav .megasection_nav{background-color:#1d1d1d;display:flex;position:absolute;top:0;bottom:0;left:0;right:0;text-align:center}.secondary_nav_is_fixed #site_nav_container .magic_shell_subnav{position:fixed;top:0}.secondary_nav_is_fixed #site_nav_container .magic_shell_subnav .megasection_nav{background-color:#1d1d1d}.secondary_nav_is_fixed #site_nav_container .magic_shell_subnav .pullout_subnav{display:none}.secondary_nav_is_fixed #site_nav_container .magic_shell_subnav .megasection_nav{display:flex}.secondary_nav_is_fixed #site_nav_container .magic_shell_subnav .nav_toggle{display:none}}.msl.megasection_nav_present .site_header_area{position:absolute}@media (min-width: 1200px){.secondary_megasection_nav--on_magic_shell_page{display:none}.megasection_nav .arrow_box{display:none}}@media (min-width: 1200px){.megasection_page_name{display:none}}@media (max-width: 1199px){.megasection_nav.sticky{position:fixed;top:0;width:100%;z-index:40}.magic_shell_page.ms_full_height .megasection_nav{display:none}.megasection_nav_present.magic_shell_page.ms_full_height #page{height:calc(100% - 130px) !important;position:static}.megasection_nav_present.magic_shell_page.ms_full_height .megasection_nav{display:block;position:absolute;z-index:21;top:60px;width:100%}.magic_shell_page:not(.nav_overlay_true) .site_header_area{background:black}.megasection_title{text-transform:uppercase;color:#323a40;font-family:\"Montserrat\",Helvetica,Arial,sans-serif}.current .main_nav_item,.megasection_subnav .current{color:#323a40}.megasection_nav_present.msl .megasection_nav{font-weight:600;background-color:#ffe4e1;color:#942D25;padding:14px 1.5em 11px}.megasection_nav_present.msl .megasection_nav .megasection_title{color:#942D25}.megasection_nav_present.msl .megasection_nav ul{list-style-type:none;margin-left:0}.megasection_nav_present.msl .megasection_nav ul.nav>li{border-bottom:1px solid #dcb6b1}.megasection_nav_present.msl .megasection_nav ul.nav>li .current .main_nav_item,.megasection_nav_present.msl .megasection_nav ul.nav>li .megasection_subnav .current{color:#942D25}.megasection_nav_present.msl .megasection_nav ul.nav>li:last-child{border-bottom:none}.megasection_nav ul.nav>li{border-bottom:1px solid #b6c8d5}.megasection_nav ul.nav>li:last-child{border-bottom:none}.magic_shell_page .megasection_title{color:white}.magic_shell_page .current .main_nav_item,.magic_shell_page .megasection_subnav .current{color:white !important}.magic_shell_page .megasection_nav{background-color:#1d1d1d;color:#bcbcbc}.magic_shell_page .megasection_nav ul.nav>li{border-bottom:1px solid #3b3b3b}.megasection_title.site_title_display,.megasection_title_container{display:flex;justify-content:space-between;cursor:pointer}.megasection_title.site_title_display::after,.megasection_title_container::after{content:\"X\";font-weight:bold}.megasection_title_container:not(.megasection_title_container--nav-hidden)::after{content:\"\";display:block;cursor:pointer;width:25px;height:25px;background:url(\"https://mars.nasa.gov/assets/[email protected]\") -25px 0;background-size:300px;transform:scale(0.5)}.secondary_megasection_nav:not(.secondary_megasection_nav--on_magic_shell_page) .megasection_title_container:not(.megasection_title_container--nav-hidden)::after{-webkit-filter:invert(100%);filter:invert(100%)}.megasection_title.site_title_display::after,.megasection_title_container--nav-hidden::after{content:\". . .\";margin-top:-3px}.megasection_title_container:not(.megasection_title_container--nav-hidden) .megasection_page_name{display:none}.megasection_nav,.megasection_title.site_title_display{padding:11px 1.5em 5px}.megasection_title.site_title_display{background-color:#1d1d1d;color:white;display:none}.megasection_title.site_title_display a{color:inherit}.site_header_area .magic_shell_subnav{display:none}.magic_shell_page #sticky_nav_spacer{height:0}.megasection_nav:not(.megasection_nav--nav-hidden){-webkit-overflow-scrolling:touch;overflow-y:auto;height:100%;min-height:100%}.megasection_nav ul.nav--hidden{display:none}.megasection_nav ul.nav>li{display:block;padding:1em 0 0}.megasection_nav ul.nav>li .gradient_line,.megasection_nav ul.nav>li .related.module .gradient_line_module_top,.related.module .megasection_nav ul.nav>li .gradient_line_module_top{margin:1em 0 0 0}.megasection_nav ul.nav>li .arrow_box{padding:20px 20px;width:52px;float:right;cursor:pointer;margin:-0.4em -.8em 0 0;display:block;text-align:center;border-width:0;background:transparent}.megasection_nav ul.nav>li .arrow_box.reverse{transform:rotate(180deg);-ms-filter:\"progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=1.2246063538223773e-16, M21=-1.2246063538223773e-16, M22=-1, SizingMethod='auto expand')\"}.megasection_nav ul.nav>li .arrow_box .arrow_down{width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid;float:right;text-indent:-9999px;overflow:hidden}.megasection_nav .nav_title{margin-bottom:.3em;display:block;line-height:1.15;font-weight:600;text-align:left;width:80%}.megasection_nav .nav_title a,.megasection_nav .nav_title .unclickable_item{font-size:1.2em;color:inherit;display:block;width:100%;height:100%;padding:.4em .4em .4em 0;cursor:pointer}.megasection_nav .nav_title a:hover,.megasection_nav .nav_title .unclickable_item:hover{text-decoration:none}.megasection_nav ul.megasection_subnav .stellarnav_title{color:#c6c5d3;font-size:14px;margin-bottom:.2rem;margin-top:.8rem}.megasection_nav ul.megasection_subnav li{text-align:left}.megasection_nav ul.megasection_subnav a{color:inherit;font-size:1em;line-height:1.4;text-decoration:none;display:block;padding:.4em 0;cursor:pointer}}@media (max-width: 1199px) and (min-width: 20em){.megasection_nav .top_nav_items{-moz-column-gap:1em;column-gap:1em;-moz-columns:2;columns:2;max-width:30em}.megasection_nav .top_nav_items li{-moz-column-break-inside:avoid;break-inside:avoid-column}}@media (max-width: 1199px){.megasection_nav ul.nav>li.admin_site_nav_item .arrow_box .arrow_up,.megasection_nav ul.nav>li.admin_site_nav_item .arrow_box .arrow_down{border-top-color:#F45F5F}.no-touchevents .megasection_nav ul.nav>li.admin_site_nav_item .arrow_box:hover .arrow_up,.no-touchevents .megasection_nav ul.nav>li.admin_site_nav_item .arrow_box:hover .arrow_down{border-top-color:white}.megasection_nav ul.nav>li.admin_site_nav_item .nav_title a,.megasection_nav ul.nav>li.admin_site_nav_item ul.megasection_subnav a{color:inherit}.no-touchevents .megasection_nav ul.nav>li.admin_site_nav_item .nav_title a:hover,.no-touchevents .megasection_nav ul.nav>li.admin_site_nav_item ul.megasection_subnav a:hover{color:inherit}.megasection_nav .megasection_subnav_container--hidden{display:none}}.blog_main_image .primary_media_feature .feature_container,.feature_earth_right_now.primary_media_feature .feature_container{height:300px}@media (min-width: 769px), print{.blog_main_image .primary_media_feature .feature_container,.feature_earth_right_now.primary_media_feature .feature_container{height:488px}}.blog_entry{padding:2.4em 0;border-bottom:1px solid #BEBEBE}.blog_entry:first-child{padding-top:0}.blog_entry footer{text-align:left}.blog_entry footer .button{margin-top:2em}@media (min-width: 600px), print{#secondary_column aside.blog_search{border:none;padding:0}}#secondary_column .blog_subscribe .sidebar_title,#secondary_column .blog_subscribe .related_content_module .module_title,#secondary_column .related_content_module .blog_subscribe .module_title,.right_col .related_content_module #secondary_column .blog_subscribe .module_title{margin-bottom:.3em}#secondary_column .blog_subscribe p{margin-top:0}#secondary_column .blog_subscribe .button{margin-top:0;margin-bottom:1em}#secondary_column .rss{vertical-align:middle;text-decoration:none}#secondary_column .rss img{width:44px;margin-right:1em}#secondary_column .rss .title{display:inline-block;color:#707070;font-weight:600}#primary_column .blog_search{display:block;margin-bottom:3em}@media (min-width: 600px), print{#primary_column .blog_search{display:none}}.blog_search .blog_search_form{display:block;width:100%;max-width:330px}.blog_search .search_submit{opacity:1;right:-1px;top:-2px}.blog_search .date_filter label{margin-right:.1em}.blog_search .date_filter label,.blog_search .date_filter .selects{display:inline-block;margin-bottom:.2em;white-space:nowrap}.blog_search .date_filter select{margin-left:.3em}section.blog .blog_header{margin-bottom:2em}section.blog .blog_header h2 a{color:#222}section.blog .blog_header .author p:before{content:\"By \"}section.blog .release_date{font-size:1em;color:#222;text-transform:none}section.blog .article_title a{color:#222}section.blog .blog_subtitle{margin-top:.3em}section.blog .blog_truncated{max-height:311px;overflow:hidden;position:relative}section.blog .pagination{padding:0;text-align:right;margin-top:.6em}@media (min-width: 600px), print{section.blog .pagination{margin-top:1.2em}}section.blog .pagination a.prev{float:left}section.blog .pagination a.next{float:right}section.blog .comments_directive{font-size:.8em;margin-bottom:1.4em}section.blog .sharing_buttons_stats img{width:auto}.sharing_buttons_stats *{box-sizing:content-box}.blog_header .sharing_buttons_stats{margin-top:2em}.sharing_buttons_stats .addthis_button_reddit img{position:relative;bottom:6px}.sharing_buttons_stats .addthis_button_facebook_like{position:relative;bottom:4px}@media (min-width: 769px), print{.sharing_buttons_stats .addthis_button_facebook_like{bottom:2px}}.sharing_buttons_stats .addthis_button_tweet{margin-right:4px}.sharing_buttons_stats .addthis_default_style .hide_on_small.addthis_button_reddit{display:none}@media (min-width: 480px){.sharing_buttons_stats .addthis_default_style .hide_on_small.addthis_button_reddit{display:inline-block}}.sharing_buttons_stats .addthis_counter{vertical-align:top;margin-top:0px}.sharing_buttons_stats .addthis_default_style .at300b,.sharing_buttons_stats .addthis_default_style .at300bo,.sharing_buttons_stats .addthis_default_style .at300m{display:inline-block}.sharing_buttons_stats .addthis_default_style .at300b .google_plusone_iframe_widget,.sharing_buttons_stats .addthis_default_style .at300bo .google_plusone_iframe_widget,.sharing_buttons_stats .addthis_default_style .at300m .google_plusone_iframe_widget{width:auto !important}.sharing_buttons_stats .addthis_default_style .at300b .tweet_iframe_widget,.sharing_buttons_stats .addthis_default_style .at300bo .tweet_iframe_widget,.sharing_buttons_stats .addthis_default_style .at300m .tweet_iframe_widget{height:auto !important}aside.expander>header{display:flex;justify-content:space-between;margin:0}aside.expander>header .sidebar_title,aside.expander>header #secondary_column .related_content_module .module_title,#secondary_column .related_content_module aside.expander>header .module_title,aside.expander>header .right_col .related_content_module .module_title,.right_col .related_content_module aside.expander>header .module_title{margin:0}aside.expander .expand{height:22px}aside.expander .expand .expand_icon{display:inline-block;color:black;font-size:33px;font-weight:600;margin-top:-10px;cursor:pointer}aside.expander .expand .expand_icon:after{content:\"+\"}aside.expander .expandable{display:none}aside.expander.expanded>header{margin-bottom:1rem}aside.expander.expanded .expandable{display:block}aside.expander.expanded .expand .expand_icon:after{content:\"-\"}aside.expander .title{font-weight:600;font-size:1.2em}aside.expander .subtitle{color:#777;font-size:1em}#about-the-lander .feature_pages .wysiwyg_content .wide{text-align:center}#about-the-lander .feature_pages .wysiwyg_content .wide figcaption{margin:0 auto}#about-the-lander .feature_pages .wysiwyg_content .wide iframe#experience_insight,#about-the-lander .feature_pages .wysiwyg_content .wide figcaption{width:90%}@media (min-width: 769px), print{#about-the-lander .feature_pages .wysiwyg_content .wide iframe#experience_insight,#about-the-lander .feature_pages .wysiwyg_content .wide figcaption{width:85%}}@media (min-width: 1200px){#about-the-lander .feature_pages .wysiwyg_content .wide iframe#experience_insight,#about-the-lander .feature_pages .wysiwyg_content .wide figcaption{width:80%}}@media (min-width: 1700px){#about-the-lander .feature_pages .wysiwyg_content .wide iframe#experience_insight,#about-the-lander .feature_pages .wysiwyg_content .wide figcaption{width:75%}}@media (min-width: 1200px){iframe#experience_insight{min-height:600px}}@media (min-width: 1700px){iframe#experience_insight{min-height:700px}}.-ms-.no-flexbox .grid_view.grid_gallery .list_image img{height:auto}\n/*\n\n*/\n </style>\n <style data-href=\"/assets/mbcms/vendor/jquery.fancybox3-d5d81bdfc05a59e4ea72bca1d8b7fcc399bd3b61f7c06af95a8a48795df69d7a.css\" media=\"screen\">\n /*! fancyBox 3.0.0 Beta 1 fancyapps.com | fancyapps.com/fancybox/#license */\n\n#fancybox-loading, #fancybox-lock, .fancybox-wrap, .fancybox-skin, .fancybox-inner, .fancybox-error, .fancybox-image {\n padding: 0;\n margin: 0;\n border: 0;\n outline: none;\n vertical-align: top;\n background-color: transparent;\n background-repeat: no-repeat;\n background-image: none;\n text-shadow: none;\n}\n\n.fancybox-wrap iframe, .fancybox-wrap object, .fancybox-wrap embed {\n padding: 0;\n margin: 0;\n border: 0;\n outline: none;\n vertical-align: top;\n background-color: transparent;\n background-repeat: no-repeat;\n background-image: none;\n text-shadow: none;\n}\n\na.fancybox-close, a.fancybox-expand {\n padding: 0;\n margin: 0;\n border: 0;\n outline: none;\n vertical-align: top;\n background-color: transparent;\n background-repeat: no-repeat;\n background-image: none;\n text-shadow: none;\n}\na.fancybox-nav {\n padding: 0;\n margin: 0;\n border: 0;\n outline: none;\n vertical-align: top;\n background-color: transparent;\n background-repeat: no-repeat;\n background-image: none;\n text-shadow: none;\n}\na.fancybox-nav span {\n padding: 0;\n margin: 0;\n border: 0;\n outline: none;\n vertical-align: top;\n background-color: transparent;\n background-repeat: no-repeat;\n background-image: none;\n text-shadow: none;\n}\n\n.fancybox-tmp {\n padding: 0;\n margin: 0;\n border: 0;\n outline: none;\n vertical-align: top;\n background-color: transparent;\n background-repeat: no-repeat;\n background-image: none;\n text-shadow: none;\n}\n\n#fancybox-lock {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 8020;\n overflow-y: scroll;\n overflow-y: auto;\n overflow-x: auto;\n -webkit-transition: -webkit-transform 0.5s;\n -webkit-transform: translateX(0px);\n}\n\n.fancybox-lock-test {\n overflow-y: hidden !important;\n}\n\n.fancybox-lock {\n overflow: hidden !important;\n width: auto;\n}\n.fancybox-lock body {\n overflow: hidden !important;\n}\n\n.fancybox-wrap {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 8020;\n -webkit-transform: translate3d(0, 0, 0);\n}\n\n.fancybox-opened {\n z-index: 8030;\n}\n\n.fancybox-skin {\n border-style: solid;\n border-color: #fff;\n background: #fff;\n color: #444;\n}\n\n.fancybox-inner {\n position: relative;\n overflow: hidden;\n -webkit-overflow-scrolling: touch;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n}\n\n.fancybox-spacer {\n position: absolute;\n top: 100%;\n left: 0;\n width: 1px;\n}\n\n.fancybox-image, .fancybox-iframe {\n display: block;\n width: 100%;\n height: 100%;\n}\n\n.fancybox-image {\n max-width: 100%;\n max-height: 100%;\n zoom: 1;\n}\n\na.fancybox-close {\n position: absolute;\n top: -23px;\n right: -23px;\n width: 46px;\n height: 46px;\n cursor: pointer;\n background-position: 0 0;\n z-index: 8040;\n}\na.fancybox-nav {\n position: absolute;\n top: 0;\n width: 50%;\n height: 100%;\n cursor: pointer;\n text-decoration: none;\n -webkit-tap-highlight-color: transparent;\n z-index: 8040;\n overflow: hidden;\n}\n\n.fancybox-type-iframe a.fancybox-nav, .fancybox-type-inline a.fancybox-nav, .fancybox-type-html a.fancybox-nav {\n width: 70px;\n}\n\na.fancybox-prev {\n left: -70px;\n}\na.fancybox-next {\n right: -70px;\n}\na.fancybox-nav span {\n position: absolute;\n top: 50%;\n width: 46px;\n height: 46px;\n margin-top: -23px;\n cursor: pointer;\n z-index: 8040;\n}\na.fancybox-prev span {\n left: 0;\n background-position: 0 -50px;\n}\na.fancybox-next span {\n right: 0;\n background-position: 0 -100px;\n}\n\n.fancybox-mobile a.fancybox-nav {\n max-width: 80px;\n}\n\n.fancybox-desktop a.fancybox-nav {\n opacity: 0.5;\n filter: alpha(opacity=50);\n}\n.fancybox-desktop a.fancybox-nav:hover {\n opacity: 1;\n filter: alpha(opacity=100);\n}\n\na.fancybox-expand {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 46px;\n height: 46px;\n z-index: 8050;\n opacity: 0;\n filter: alpha(opacity=0);\n background-position: 0 -150px;\n zoom: 1;\n -webkit-transition: opacity .5s ease;\n -moz-transition: opacity .5s ease;\n -o-transition: opacity .5s ease;\n transition: opacity .5s ease;\n}\n\n.fancybox-wrap:hover a.fancybox-expand {\n opacity: 0.5;\n filter: alpha(opacity=50);\n}\n.fancybox-wrap a.fancybox-expand:hover {\n opacity: 1;\n filter: alpha(opacity=100);\n}\n\n#fancybox-loading {\n position: fixed;\n top: 50%;\n left: 50%;\n margin-top: -30px;\n margin-left: -30px;\n width: 60px;\n height: 60px;\n background-color: #111;\n background-image: url(data:image/gif;base64,R0lGODlhGAAYAPcAAAAAAAUFBQkJCQ8PDxAQEBQUFBkZGSEhISYmJikpKS8vLzExMTQ0NDo6Oj8/P0BAQEVFRU1NTVRUVFlZWWVlZW9vb4eHh4mJiYyMjJOTk5WVlZqamp6enqKioq+vr7y8vMPDw8nJyc7OztPT09TU1Nzc3OLi4ubm5ggICA0NDRERERgYGB0dHSAgICQkJCsrKy0tLTMzM0NDQ1JSUl1dXXl5eX5+foWFhYiIiJSUlJycnKGhoaenp62trbCwsLS0tLu7u729vcLCwuXl5e7u7vX19fr6+gQEBAsLCwwMDBISEhcXFyIiIioqKjg4OD09PUdHR1tbW5mZmZ2dnaOjo6urq66urrGxsba2trq6ur+/v9DQ0PT09Pn5+RMTEyMjIzAwMERERExMTGZmZoaGhpaWls/Pz9XV1dvb2+Hh4Tw8PBYWFkZGRktLS1paWm5ubp+fn6CgoKysrL6+vs3NzZubm8DAwAoKClxcXD4+Pg4ODjk5OZCQkAYGBicnJywsLDIyMnh4eAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/i1NYWRlIGJ5IEtyYXNpbWlyYSBOZWpjaGV2YSAod3d3LmxvYWRpbmZvLm5ldCkAIfkEAQoAAAAsAAAAABgAGAAABvdAgHBIBCwWxWRSEBAOPp+BclrYVJwikRRgODSngMKHpAAMslLBIvEFS06ZwFnLZRCoBaGgY4II0AQMCEMBbQEYHhECAA0lGgITEwEHC1IBBAkHhBQgIxoMAhGDQwJ3AggMCwZFCRYiIRBTA0cHi0kBDxeaSgIHd0UCwUy2YEKFQgcZG8scDsUECgnSCb0aHRzYD88J0QkIaQMC4W1TTcdJA15Tvb9LlAvtRQS0xEIGC4JS4USXZqiqRA4kINBEjSYCdyhtKZCJXxtUd7jJWbALwLkk8zQFkIbMTjGLCRYs2sjGzBpytw6sEhJtSBeUHxEk+PhR3McgACH5BAEKAAAALAAAAAAYABgAAAf/gACCg4QBMC+EiYqCASiCKD49KYwBi4QFGBSCKUFBkwA1PCuWggU9QoicngAxQyKjpAARIzcBqikBO0Y0lioqjzkiMiidKBFFPo4AAZWMNjrDAAwhOCgzMyg7RDKCKi8tgwE0PkE3MCgQLoQvM7YuMTErzYIuNkA/Db3wLcqKDTYsLKFo8anQMkaxwh1E4eKFQxi/SKk45NAFihQuKL6I2IvioUnMDiZE2KvFvEQBWnBMhIIFvJWEVMRgwC/RCnguJuEidBEARgYxChBqAXFTDHC+ALSIAbLAt0LNArhg8OsFDFsM1FHqRVOQQ0EtGAiNFcCqo7KIfMK4SrYFLLTNDVaYHLkuLd1FKPpZCgQAIfkEAQoAAAAsAAAAABgAGAAAB/+AAIKDhABNLoWJiUdHgkg7O0iOjYqDSjZRgklWVkmCFVJLlYJKU1aIm1WeCiRZoqMAUFo1AEhWVZIaJxKVjI44WU62uBAmkYIGBoRMTUqCC1g1SFBQSBolDQBJUVtUksgLCy5JR08shE3VT1ddJzWUjixOC56KM0RcOwuVSUzfiU2oRIA3iBJBRQYHIWnCkKGzUUoUNJHYBMlChhIfVlLSUOI/WIsgsvhICAmLeomSyKO3MZy/QgYUiCOX5CMST0lcOFHwShATBQ+TLGACQIkzFgrqcSRaEJ5OTwyLOkEkyJciJU6IHokKgIkTjb0mfmPYCInEg4WOMFEGYGuTQQYMmKCF5eItSFgWQQYCACH5BAEKAAAALAAAAAAYABgAAAf/gACCg4QAX1+FiYqDSDkYSIJIR4uDR18GgikcUpAAYxhKlABHTWCQSJuQTUI9XqIAXgyImlJHR2QjYou2gwhgKaicD2Y5nQaug19NoQApYF9HDw9HOCEMAEgSQrWDBmBgCCkASpPJYUgMVENnFZ2RXwy/i2JoaWUviylf7oUIZWHlCPF6hQ1JCiUpxCFp8qLhC2aLJpiZaEbLi4VNGC4TJZGiEDACCRpMmDBRCgP8CCExIE4REngMWiZS8m1fIS9gGIQbx89gMwTxMPV6gSwFA0xKQn2RB6sJokoBfYXKOA4c1EVKZI2iaggMxF0MO2WchORFk4CKjiAQSqpJN2gECwkhcFsprsqUiQIBACH5BAEKAAAALAAAAAAYABgAAAf/gACCg4QASEiFiYqETS6DR0eLj18rg01NkQA0NkqSAEdNYIigTYJNHhudnkoMX6alRzZAYYuQgkcuYEpHL6VqQBaIAAUFhF9NqilgLABKnTY/L4ZiPziZACtgDC4pACnCgiwNSGAaIyAU14ZfYGDdimEhIjiliilf4IVfFmrqt/+ekKQY+M3QpYOqFs0AAQQIiB9NkBxs8iKhohkNG0Yj5E+RQIL5BN3rKOhFBzEkkbDTpZAIlw5g1GXb1m0XxxRHwvzocqLGtS8VRS5rVowdIiQ0RPAAZ+tTrk6XjigB40rQikqKCrT61EsQu2KeQLl7FQlJL5KTsJIatOIL2kUuCFy89SToEN1AACH5BAEKAAAALAAAAAAYABgAAAf/gACCg4QAAgKFiYqETS5Hi4pHXyuDTTCDK1+PkABNYCkARzBNjwKjm5BKDF+CTaQAXwxKi0ebRy5gSkeuAEpgLoNrs4NfTcMpYKxKs18woAJscDaoK2AMLqApqIbaYDhzPW7bAl9gn4sOWFk1wIopX4iKLDVO24O1nIJHhymHhq6uYAxbFKGHQTlxmggAOGqgojYGDSbUl2/QIX7xCCnRtKiJBjb2BJEz55BQhBJpNFwiVO0aKF2MJAhwQmXImTeEmh1L1ktXHCIQDEmgowEVPkG4QPGKUKRHvDVrFq1ZFYqXgDhG3OTbBQbRrpVghtChBEkSWQCnBNWgcrbirSYWBzNWFClXUSAAIfkEAQoAAAAsAAAAABgAGAAAB/+AAIKDhABISIWJioQvLouLR18Ggy8vR4IGX5ePRy9giJ0vgkgKlo+CBQxfgpWXXwxKkJsALmCxlQBKYC6bR7MAXy+xAClgq0qxXwopgkoKq4MGYAwuzEq/SMwpLgxgBYVIX2BgzIq6xoiKKV/piZHlir+Q2fSGlZUKw4thdf1xGezuVdKnqEGdDRvqACQkT9GhQ0faDVonkdAXHA0aGhK3bF+IERZEEZJGTZtEFxGQgNEwwg6FWcGGpXh2ZMIEJBpKNDAUwQOGWb4G1UqRQoQIJGFMdChX4JuiVKuKikhxJMMJCacAdCJHzCgzBSQ+OIUkSVCKEVMFVdgwKetEO3YIykV0W2hc1kAAIfkEAQoAAAAsAAAAABgAGAAAB/+AAIKDhAB3d4WJioQvLkeLikdfK4MvL48AK1+YkC9gKQBHloJ3CpeQgkoMX4KjAF8MSotHmEcuYLKjKQyOgrSEXy+yAClgrEqyX5+pCqyDKwq8oEqcobIptwpLhXfKuItKYMbVhEosiJFfw4TkqIp3lpYK64pKpqYvh/GW9IlKL/jyuUvUrpCSL+gSsajRoGA3MApAKWrwA4iNF4WWKADjIsWRGRgHfYFwRAGZDz3wcPoyT5AMIjvuzJhxh0wIBoYg6LDB6ZehK0Xa3Pnw4Y6METnQIVsUxciOIymIIiIzoo27FXSGgCEm5AOoF0J6bIO0gkcNQVG9ChqDoR9BdHcLrlxB53NgJQXuAgEAIfkEAQoAAAAsAAAAABgAGAAAB/+AAIKDhABISIWJioQvLouLR0wrgy8vR4IrLpePRy9giJ0vgkiVm49KDEyCpQBMDEqQpkxgSqEASmCOgkemrS+wAANgqkqwswOCSi+qgytgDC7IA4iDR9IuDGCThEiztIsDL6nUiQNM5IXdwIS8j4mbm6SVleuKyvMvSKHz9Yn3ldHeudvVrtCRCB1EKYqE7B2YDlyIzFiEaxi6IzVOdLmSB0kbXYJY5DmCBJu2QUh4bImCyEkJDR4jYMQCJtkyQiu2IelgAgKSKnKQOPmAg1rBRDNOaDAEFFENLRAGrvlAQtSAKlUQuZAzpV+hNVIqCLpapWEUG14NUtvZwWivgasEQC4KBAAh+QQBCgAAACwAAAAAGAAYAAAH/4AAgoOEAAIChYmKgwEuL4uLAV8rgy8vAYIrX5iQAC8LegABloICC5edAEoMX4KWmF8MXpGcAC4LSqOPegsujLUAXy9KgrytXsRfCqGqL62DKwoMLqF6wAHVtwuUhAJfC7iLvAtfiIpKBuaJksSFeu/vwJ2cC3Yi9yITnUoKlpYCCrTgy7fPX79q8PSogySPEYQyvhRJYpZIQZk0aMQsUgKuHKEAFc4MobJHAIRnpYjpccFgG6MNdiQgYhACR4AHDwIYACVIiTNCXrgJKCMi5wYOAnhFFNVQkJgzNgUcDRWrHSQvPew8korUUL+mg7xgGFNqqiAvm1IJ4CSAT5mFqQYSfVm6KBAAIfkEAQoAAAAsAAAAABgAGAAAB/+AAIKDhABISIWJioQJCYuLfV8rg419gitflo99CWCInI6Gfwmaj0oMX4J/f5ZfYEqLK5OCrkmgAElgfpp9pX08W1FJuGCpSrC1gkoJqYJ9NSddV099SYiDfbBJfgxgBYVgHVxEM4u5qNeFfWIdoYmRsIVJ89bpmwCaf1dAc/3lpqMSjEKir5+/RwCWNWo0jF49hM56vXuCo1kiJCyGKUpgQUSIMIuUgClmrw8FEFs0MEDSgAUhJA25gZmFD4MHMYj+/KiRDRYLMBoLMCNU4JshC3MaAGiUUBe2UoXCzOHZZ1QrBvFMbfAQqpIoUgiV2IjijKmgApkgShTkxx3ERYcDIAYCACH5BAEKAAAALAAAAAAYABgAAAj/AAEIHEgQwJ07BRMm7INQoB8/CiMCWMGjxsAmTQauaNFH4kQ6QwAB6IOx4x0YTTp6xGOECsImMDq2AEQg4po1ApP4KBIBAEYASQD5UdlH5UgpcyQgdECESh8CNWcmEUigSYuBfd6cGULFyZ0ZEAfeqXnHDyBAKwrCKJOmRJuIBM62mLoQQpmwCe/MTZjkoF+PWEf6pNJDjpwebyUSQInRT1kqhnsg9rgYI0aEfv8C7miUoJNALCLqranQT40sWBxEDMqgRUOBfdz0mIMD0NPXI2smMYsWqw04EDADugoVgFSBa6wSJIDTIaCpMPskYYC3KFyhAmEKbMGAtESSMBpqFjeIsvPCFmlHlhS40TzgJngBi8atMCAAOw==);\n background-position: center center;\n opacity: 0.85;\n filter: alpha(opacity=85);\n cursor: pointer;\n z-index: 8060;\n -webkit-border-radius: 8px;\n -moz-border-radius: 8px;\n border-radius: 8px;\n}\n\n.fancybox-tmp {\n position: absolute !important;\n top: -99999px;\n left: -99999px;\n max-width: 99999px;\n max-height: 99999px;\n overflow: visible !important;\n}\n\n.fancybox-title {\n font: normal 14px \"Helvetica Neue\",Helvetica,Arial,sans-serif;\n line-height: 1.5;\n position: relative;\n text-shadow: none;\n z-index: 8050;\n display: block;\n visibility: hidden;\n}\n\n.fancybox-title-float-wrap {\n position: relative;\n margin-top: 10px;\n text-align: center;\n zoom: 1;\n left: -9999px;\n}\n.fancybox-title-float-wrap > div {\n display: inline-block;\n padding: 7px 20px;\n font-weight: bold;\n color: #FFF;\n text-shadow: 0 1px 2px #222;\n background: transparent;\n background: rgba(0, 0, 0, 0.8);\n -webkit-border-radius: 15px;\n -moz-border-radius: 15px;\n border-radius: 15px;\n}\n\n.fancybox-title-outside-wrap {\n position: relative;\n margin-top: 10px;\n color: #fff;\n text-shadow: 0 1px rgba(0, 0, 0, 0.5);\n}\n\n.fancybox-title-inside-wrap {\n padding-top: 10px;\n}\n\n.fancybox-title-over-wrap {\n position: absolute;\n bottom: 0;\n left: 0;\n color: #fff;\n padding: 15px;\n background: #000;\n background: rgba(0, 0, 0, 0.8);\n max-height: 50%;\n overflow: auto;\n}\n\n.fancybox-overlay {\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n z-index: 8010;\n}\n\n.fancybox-overlay-fixed {\n position: fixed;\n width: 100%;\n height: 100%;\n}\n\n/* Default theme */\n.fancybox-default-skin {\n border-color: #f9f9f9;\n background: #f9f9f9;\n}\n\n.fancybox-default-skin-open {\n box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);\n}\n\n.fancybox-default-overlay {\n background: #333;\n opacity: 0.8;\n filter: alpha(opacity=80);\n}\n\n.fancybox-default a.fancybox-close, .fancybox-default a.fancybox-expand, .fancybox-default a.fancybox-nav span {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAADICAYAAACXpNOoAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpGNzRGRjc2NzEwNERFMjExQTc0M0U0NzZGQkE0MTM5RSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1RkZERjA4NTZBNEMxMUUyOTFGMkY4MEVGREQ0MkRDNCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo1RkZERjA4NDZBNEMxMUUyOTFGMkY4MEVGREQ0MkRDNCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU2OUM1RDBBNEI2QUUyMTE5NTdDREVCQjFFNDc0RjQzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkY3NEZGNzY3MTA0REUyMTFBNzQzRTQ3NkZCQTQxMzlFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+qKJVUQAADXpJREFUeNrsXQtMVNkZvsOMPHwAoq2KuiLWiixV8G01qxHwkbVZFTWa6G7bWI22ig/wnWxr4itqdN0mRjemGjXZBGtMs4hPQov4fovUagUVUOsTUN4M0/+7njO9DDN35l5mhpnuOcmfYS7nnvPd//7nf6MGi8Ui+eMIkPx0CODeHiblF4PBoHmBlp4RV/a0t8f/B8e1MusjwwxG+jSytUzsZ86QRiIzUQMjMyOLpYWvyqQTMAcaRBRC1I6oLfs5SLEuwNYSVRNVEVWyn2vpgfmDWDwN3MA42YYomKgDUThRBCg1NXVIUlJSQv/+/ft2odGWBm6qrq6ufPPmTemTJ0/uXLp0KXflypX/oMtlRO+Jaojq2ZuxaD5cnJyANjHOdiWKJRoXHBw8NzMz89zDhw+LLS6OZ8+e3b958+aRjh07/oKt1Y6tbXAFIyeDErCDE85BQwzC2Gaf7NixI2X27Nnju3Xr1gmTioqKpHPnzkl5eXnSo0ePpLKyMvnm8PBwqU+fPtKoUaOkxMREqXfv3vJ1+n3J1atXvxs/fvxf6Gs5E6EGe5y3x1RnwLk847V3JOpB9LPc3Nylo0ePjseEK1euSLt375auX79uXcN2HeUbHTx4sLRkyRJp2LBh8ncSocyoqKjf04/v2DloJvd6gBsZpyHHPYliLl68mDZixIiY2tpaadOmTVJGRsZHvRoQIJPaaGxslAljxowZ0tq1a6WgoCCptLT0XI8ePX5Ll98yzptbAtzANEQ4Ax2bk5OTPmbMmE8hBgsXLpRu3bolgzUajU4NinIfs9ksP0B8fLy0Z88eWZxKSkoye/bsOY8d3Fol17UaICPTHuB2r61bt04DaNIS0oIFC2TQAMxBAzDnOn8YkPIafyj+O6yBtbAmcfxz0jq/YXsa9foq/EBC5XWl19mbDuIY/GLjxo3SnTt3rKA4YFlpNzRINTU18qdSdOrr62Vw+FTegzWwFtbEiI2NXdC1a9dwZ1rGGfBgJiaRhw4dmkGvMQwH8dixY004CIK8v3//XqqqqpJ/rqyslCoqKmSw5eXl8nWAxkN9+PBBFhPlG8KaWLtDhw69SCutZ3vrAs4PJVRd17i4OFmHQXvwV60EDbId4DqA2zuguM7v56LG1yZ5H8H2NuoFDsMQQYdwCFnDzvfv35dVnlJz4NAoQU+fPl3WNLYHdNKkSdLOnTutIAG+rq7ufyBoTayNPSIiIj49derUeGfATSrXobvDR44c2RcXTp8+bd2EH0ZwVQl68+bN1oO3bt06+cEmTpwo7dq1ywp62bJlVs0SGBgoz8Ga+I49YmJiYKR+SVP+qhc4Xld7UlndceHGjRtWTvLXjM34GDRokBUcdDTAwIpu27ZNvo65Z86csc5v06aNdR3ZhNMnN2KdO3ce6syPUgMOHR5MagpmXiosLGwmAiaTySoq4DAAAjRGSkqKTJy7y5cvl7KyspoAtw0o4DZgtGvXrpcz4AHOXNfQ0NBA5ls02whWD+C5vAM8NITtWLVqlcxtLmYhISHWA64cfA96qFC9WsXloeQcwJ8/f77ZHPJrmhxqqEZPBcsWHrmQPq7jXp6tCYcIKFUeDiJk2nZMmTJF2rBhg5XDONQQMVtTzvegB6tw5p87As4jlxryIeByStHR0c02UnIOKo9rDzxQenq6dPz4cevvp02bJoNX6nlbRnCXlwzYE4ZBF3Cw8gP5E6Vca3Dg3E1VAie/2goaB5ECDGn9+vVWmcd1aCaroaC5SncXn9gD4/Xr11edATepAIdvXEZu7MO5c+cOAjB4cjAekFdshM05+LS0NPkThxDag8v06tWrZWMD0EePHm0GnBskjAkTJsifjx8/vugMuCO3FieuM1E/oiEFBQWrYD3nzJkjA4Am4TqY+x5aBrQRiHMcYgNuHz58WHr79u29Tp06JYPxLB7V5Naamai8IXqRn58vK1hELvy1802h2uwFELjOVaUaaG7EFi9ezFXiJXvBhBatUsOc+mckKhnFxcXlCLdg2nkkw811+/btJQqcZdWI4D4sLEwGTjYAxkQGiuvk/TUBzdfBmsOHD8fbezpu3LiNbG+LXuANLIXwglRX4ZEjR3LwizVr1kgDBgywRjEcBEADLNfrHBS4jodSGioOGmtgLayJcffu3T0Ug75zFDS7JXRD5IIgoCWhG0Dv3bvX7aGbhR0OcP0/RP8eO3bszsuXL/8LGx08eFCaOXOm9XDxA2ovB6LUHpiL77j3wIEDMmgKlrMJ9CK2V70rySEt6QnEnt1ZemIZmfGBPD0Bw3Pz5k2X0hMJCQlSamqqLNMsPZEVFRW1iEX4bktP2CaEIDZdeEJo1qxZEyIjIyO49+hKQggWGINCuhJ6aCSEDjDx0JQQanEK7uTJk9kEtMTVFNzz588fkjX+vkuXLh5PwbmU9Fy6dOnQ5OTkhH79+v2cQP1UmfR89+5dKVnDu8Thv69YsUJz0lOvqDhLM7e1oSBFvGhmGqLKhmoV+XKnB9FdwJsk9hlI3Yl9vaWUllQkLAxAI/cpRNXNldctKssCuAAugAvgArgALoAL4O4fmt1aHe1PPOzjUVMIu17FoiBr1kqLw2fyEnN4LwCaGMKYL4/Ez1OiYulj94RZWzTgIA+ilh9x9X4WnyIrMCY2Njbt2rVrBQ0NDea6urr67OzsaxSbIgGENEd7rVg8Bpxx+idEn0VGRqYVFhY+t434CTzy4JOJuvkEcBZ3Ik09KjQ0dMm9e/ee2EtV1H9Mrs8litYK3O1ahXXFQY77BAUFDTx79uwfSEw+UQmCDZKTCpvH1SEDDc3R22g0DsjKylowdOjQvo7mX7hwIZ8dzCrtobqbRIUxAfVJtDz9+vjx4xfVMlolJSWvoqKiUB8f3GqHk4HG5nFEc/bv339WDfTLly/LEhIS/oQ0HtM6Jq8DZ/KJ/F9/otnbt2//mxro8vLyysTExK00dyLT64F63n5LgRtY2g1yPGPNmjXfN9JwBLq6urp26tSp3zAV2Iul6wzeBs67iKDKps6fP38/GZYGR6BhdObNm/cdzZ3C7mnWBeQN4LzMAq79KiUl5Vtw0xFos9ncmJ6efoTmTmdvJ8ReMsobwANZdWIi5LWioqJKTa63bNmC2vgsohgmWgZ7oudp4CamCcbFx8f/8dWrV2VqoPft24fumjlM47RXgvY2cBiYIdHR0cuLi4tfqYHOyMjIg05nuh06PkDtsHsaOByiL/Ly8u6qgSZTfzsgIGABMzCoXBidaSlPA+9D9BX5Rw41CJnyR4GBgegfTGbOltEV9dqqTpYvx5xyO8iVK1f+6WjCyJEjo0+cODGDRCWaqcwOzAFz3/gxHc4m6hAOk7+oQ781QH5t8v3WyfJrt1ZXIFFWVqYMJLq3ViChO3QjjfR1q4Zufh0s2ySC4FANNhqNv8vOzr6tBj4nJwdtRV/4RCaLgUeSc3hQUNAicg0eqGkamvclc9xa18mC2mZJnke1tbW3k5KS/lxQUPBUJWVtkXT8aaRHvEMGHl1AD8iq3kpOTv62qKjohe283NzcWyzdXN1qmSxvp5k1t33oqEi0cTWxrwWLN4B7pJTiDeCaxNZjNSBf6SgSdU4BXAAXwAVwAVwAF8B9eejtEOJ/t9+BJYQk5p7yv3tw+pdTXvcOGegwFhigK6Ij87kRDJSwwAB/0+PZLn4doRvCrIEIuxB+IQxDOIawDOEZwjQWrrXRGgp6o3g1Gd09tukGdAGhG4h+/5n0sTvI5EvAkWmdi+4ee7kSdAOhK4jmjHJWuPJ28cqgFvKhGwhdQegOYomeMLfXf1pQvCpn3T12B7qC0B2ELiH62ttXilc4nIORsETiUi03iMSnTxav0OXjrHiFlLNN8SqgtYtXPXjxCl0/auCR7EfSnyX/2/lK8WoyyiNqxSuUV1BmQbmFlV3a+krxagoKUzBGKinlBhS4UOjyleJVCOPidJQEURpUK16htIgSo68Ur/DqUXydhWKsmryjmOtLxSuDsniFMrgaeHQVoZzuk8UrNCCogUcDAxoZaO4Q5h77RvEK3UHoElIDjy4jXytewblKRpcQuoUcAUeXEc37yieKV34ZcyrasHuhOwhdQugWcjSfdRmVSb7Uhu0Xh1OrOmS1/NZVh/5qgPzS5Pulk+W3bm2TLjh0/fhDIKHsO/zan0I3vw2W5TZsdPeogUZ3ELqEJB9rw/5STYOgKwjdQTQP/8JRhOQjbdhyR4+jZgR0A6ErCN1B9PURkkes8abVnSzkwd+x7p4mA11A6AZCVxB9fQAHyhOg/TrNrKdfxWOJfW802rR6KUV0CIlyoQAugAvgArgALoAL4AK4AC6AC+ACuAAugLfy0NOi+rn0Mddtb2xVywjQvasc3JdPczM1AdGRgltlL0OL687WVrtXKw53ikq+m+Z4RlRsXv1qxdc4WxGyl/VS3oN/JKFVgLdkc5uHFlpFM7fo2mQVbaPUHj+4g+t6gCtVnlKTxBGoYCcPHGcjZluF5RTABXD3HU6H/obt4XNmOZW+i9aDqksdcqNjYwV/cMc6QlQ8bbpb4mv86N1anxeVfAfike/he5uKqPhPXgRwAVwAF8AFcAFcABfABXABXADXOv4rwABAehOixiUV0gAAAABJRU5ErkJggg==);\n}\n\n@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-moz-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx) {\n .fancybox-default a.fancybox-close, .fancybox-default a.fancybox-expand, .fancybox-default a.fancybox-nav span {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFwAAAGQCAYAAAAjsgcjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpGNzRGRjc2NzEwNERFMjExQTc0M0U0NzZGQkE0MTM5RSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpCMTg4NzhCQTZBNEYxMUUyQTQ2NEQ0Nzc1M0U1REU1MSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpCMTg4NzhCOTZBNEYxMUUyQTQ2NEQ0Nzc1M0U1REU1MSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjE0QzZBQjVDNEU2QUUyMTE5NTdDREVCQjFFNDc0RjQzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkY3NEZGNzY3MTA0REUyMTFBNzQzRTQ3NkZCQTQxMzlFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+T32etwAAHWhJREFUeNrsnQtU1VX2x388FcQHaIZEiFb4QDQtSszG7IGplM+sCSvNno72GDNb/3+t5WQ1tpoms6an49DY1OhKXVNqZGmlpI6pmamI/ccAGZ+QKIggCv/9vZyD5/743efv8rvcy95rHS/I7/7uuZ977j5777PPPiH19fUai3USwsAZOANnYeAMnIWBM3AWBs7AGTgLAw9q4CEhIU7/HugfmKv35+v3zsBbG/CQCy+gPho1u5d10OTf0K96Bm4PWW2hooUpLVR5VKFLuHXUziuP55Xf69QPwhn8oAWuG8kq3HDRIkSLFI9h8+bNS7n55puv6tatW+/27dt3j46OToyMjOwYGhoajRvV1dVVnTt37sTZs2eLampq/lNZWbnr559/zrvlllv20p/P6T4Ew5FvNXDbk5w1Hzxfjs4wAbIttRhqsdQuptadWgq1tLFjx2auX7/+1V9++WUdATxR76XQh1BaUVGx/OjRo7OWLVvWQ7xmhOhDiBxoZtWhq/du1Jp1hCuqQx3NbUSLEi36gw8+uLlv376DBgwYMDIiIiLal5Mi9a/i5MmTOadPn85LTEz8VBn19T179qw/cOBA4I9wRW1IwO3EiE6gdjm1/tSuW7p06cuHDx/eV2+RkOrZUlZWdr/oU7gyPwTuCNeN6nChkyV0tI7Dhw/v/tJLL2UPHjx4lLN7k2rRvv/+e23fvn1aYWGhdvDgQe3EiRMajVbb39u1a6fFxsZql156qZacnKz17t1bS09P13r06OG0z6Tr/7Jjx45Xhw0bViJHu2LlBM6kKWCHKvoasKOFzu6AUf7hhx+OJ7k7KiqqvdH99u/fr61YsUJbu3atRqO/sQ+yH/r+yNdXv5E0yWqZmZnauHHjtF69ejnqd1l5eflzcXFxf9VPrAEBXAc7UkxUGNHthTrp/N13380cMmTIjUb32LBhg/buu+9qP/zwQyNgskY8tiJwL7JeGj+AgQMHag899JBGo9nwXtXV1e/Qh/+4N9D9BlyBLc27KDGqOwI0tYv27t37P3369EnTP3/37t3aCy+8oP3444+21woLC7N7Tf3rOxrhRr/j5/Pnz9seaULWnn32Wa1fv35N3gPp9tVt2rSZIExJt6H7BbjOrpYqBKO6E0AnkZB6mEVf7RT1SWT2aX/+8581UjG2jqugXT06euPOHgEez7/77ru1p556SiPAdvcgU/KrlStX3jlp0qST7kL3B3A5QcrJMUrqampdqcXn5+c/Q5PZFeqTMAE++eSTtskQoKE6jHS1+rs7wPWWg163Q9UAPCbX1157zTbR6qGTWTpajHSXE6k/gKsTpBzZccKh6UZqYlb//v37qE+Ajn700Ue1U6dONY5q+RpSZ7sa0e6OPEemGaB36NBBe/vtt206Xgd9FUEfr+h0nwIPNRN3MrC1obO7YGSTGnlADxsT4/3332+DHR4ebjeKAVsFbsbl1t9X/R0Nr40+oC/okyr0tyyaSBeYtdF9PcKlKjFy1S+hr+uYJ554Yrz6BEyKU6ZMwQRlG9ny3r6C7K6DIi0YCEZ6ZGSklpOTY5tUVamqqnqI7Py/OlMtVqoUVW+3U3T2JfQVTd24ceMs6myUvLioqEi76667NHKxbaNLrz6aE7YjrxDghQqxqZd//vOfdjoddjrNP4NSU1MP+hJ4qAlVEqYA7yDMv65z5869VYWNEY0J0gi2Xmc390KD+ppyopbq5fe//72tr8r1nS+77LJZvlYtoSaeFy6sEjnCu7z44ovDb7/99qvVC1955RWNRoqdGlHfsBWw9d9W/QeNvqGP6KsqZDo+dubMmWxf9sHbER4mJspoMVHCMuk8ceLEa/VOzccff2xnjajeo5Ww9dD13zD0EX1Fn1Uhi+URf45wvWUigceS2khPSUnppuq3efPm2XSlkb52x4MlawGBJtujOzqaRqNWUVFhe3QRNm7S0Ef0FV6v+lz6IDJOnz59u6+gh3o5uqX7Lj3K2GuvvfYy9cJvv/1W27VrV6MqceTMGAkAIypIloJNr+IRcwAmOCOB11peXm4DXVtba3t0dr2jvqCvsKbQd90oH+pv4G0U4B179OgRT7o7Vb3w/fffd2hnu4INwHqBCYfRrocI2AjX6kc0RitGuyvoRvb/e++9p7fNHz5w4MBFVgNX3fg2inXSYcaMGQOjoqIi5IUFBQXajh07mkyUrkQP+/rrr9feeustjLBGiCp0CVsKAlOLFy/W2rdv36hmXEHX9w99hjeMsIPy95jExMRJvhjloV5cr+pvODwxgwYNulS96F//+leTr6wr6Eaw33nnHe3WW2+1hW310I1gL1myRLvhhhtsjowKHdc70umO4jd4D3ZvPDR0qD9GuNTfcoTbgKenpyeoF65Zs8atoJM64RnBpm+N7XdA1EM3gt2xY0fb74iPqNBxvauJV9/f3NxcPfDh/hrh0p3HCI++6aabEsnRiVBXbI4ePdokAugMOkarlKFDh9rBliKhwxVXTTo9bCmA/vrrr6tBKbcnUNz7yJEjtiU+5ZqLSD319ccIl6s5tnbjjTcmqhdBdxt9VZ2JCgPxaj1sPfS2bdvadG3//v0NYUNgpSDerkx8btvn8uetW7fqHaHr/alSbMDT0tK6qhfBY/NEnehhPP7449o333zj8FoslSGsSvOG9sEHHziEfc899zQ6MegDPiR3nSL5MyZ/nVoZ4A/gcpQDemRycrLdO0aeh6cepByxENjRDz/8sFPov/nNb7SPPvrIFnRyBRsSHR3tcZ9wvapSBPAUq4Gr65a21rVrV7vEHbnSbmQFOBOkPEi9L6HrHRBXUUwEoRAC3rNnj9199ctprqwVKSUlJfrLevoDuF1OII2ySPUieHzexEqgVmJiYjyCroeNBQVvYDv6AH799Vf9/3Xxh+OjZrWG0gQXpl6kmmueihH06dOnN1mVMTIrcd3evXtNw1YHiYHH284frr0+zdinAujSSsGbhwWDSdJVMOqRRx6x2elSNSCe4srDdCXS7lek1l/x8EahN3Zer4vNiOpBAnLfvn1tpqAr9QT7/c0337R9YHJFxyj24k7U0dF7ob9VWg1cv+OgjnTnWfWCTp06NckL8QY2JDU11eYxGlkjRgIPFd8GR7EXT8FLT1U1gqwEbrTzoI48MjufGXl9+o67A95RbMTIznZ2P5iMzsIAzgDr73vxxRfrI5D/tRq4ur0Dw+Yc2aoVdnZTz54ej2x9LMUZbFgj9957r5aXl+fUOVKhI7TrziKGvk94LzrZ5w/g58TkYWu7du2ys52Q1aTPhHInLCuvcwV76tSp2vbt27UZM2ZoGzdudHhPhAHcjaUY9VXOH7oQxA6rgcvRDb2NiNPZdevWHVUvuuqqq5p8RV1BV2HMmjXLobuOkf3TTz/ZrocVAsvEkcmIDxFrlO7GUoxS46655hq7a+hbuNEfwGsFbLRqesNHaWJqJJaSkqKR99mY9+HObgoVxmOPPWZbADBy1wEb6kE2QEUqst45wv/DaVK/Ac5scn0f0ff4+Hi7xH762/G4uLi9/gCO0Q2FeEY8Vm/ZsqVUvXDUqFEeqRXEUqSzgxUauOcSuhobkVAQG5H3xZonoMvYC0a+HrY7sRR9f7HwYWeA19Z+q3mxS8KsWVgnRjhAV8m2devWY+pFY8aMcZrFauS4wMOUUCR0QNQHoqQHaRQG+Pzzz21qRg/bWaTQqI9oeA864N/5wrHzJNVN5hJilQcxhUuo4TvXIykpqXd+fv44enNhalx7586djUmb7iwiQzcDtqM+6d11XA87W6ovvbiCLSHj+TLnEPe88sorbdFI1eHZtGlTL3KuDquj3IpUN2ml1IjRDc+rsri4uHTp0qVF6oX4mhvl87nS5XA25MhVP3Sj2IiMvaipGN7A1vcTfddNlosI9jFfjHBvHB8JHN7EKdk2b978X70tjBUZTG76r6sr6LBSEE+BHY1HeK+OJj15PQBj+Q2P2NnmDmx9f9BX9Bl91wH/TvNyp5sZlSI/IJl8j/S2eK1hJ3EyGtnkE9PS0mLlxdC9yJoVwXvL0pPd9SrVES7VErJo1X1ApLv/TR/kMDF31bnr8foyliJNQ1gp8DLLqZ1AI4fFzhNDx3/72982bmzSqxV/lP5QX1tVJ+gj+qrfdFVeXv6+dmEvp2b1CJcfkpoXjoDDpWKkJxH0EZMnT75MjZHgjSCxxihd2cFrNCts/ajGRAkPGY6SqrrIs32L1NUsYQrXeRLT8WV4VrXHq0QEDe59Gdq8efO2ke1cqzocWD3HZCg9SvUN+6LIgCdqxAg2Jt5XX33VDjb9/dcvv/xygS9Ht5l4uGqPnxYqBc5P6f79+w9S5+1iDthZgHw9vCE5iaqmWHND1+tsCRt9QZ+QB6nfLn7kyJG5EydOPKi52FhlhUqRNrnhlhOoFTySmThq0qRJl6tPgguONAh4h1K96BM+fali9CpE/WAxsmHVIMClt0roG/o+WUZPim/xOa2F7PFxtKkqUbSEvLy8cdddd51dgHzLli026HBw1ER9o9zx5tw2CBUH2IMHD7Z77unTp78kFXOH+PbWai1kU5WErhadkRtiYSomCOjx5PaPT09Pt4vkt9SNseS1bqAPYqwC26n+tnqfphofPyt0OSbQ41CB1A7hMSsr69Pt27cf1et02LuIk0h32mhSk4Dkz66aeq1+UpavkZ2d3WTHmoCdN3v27PsUNeJxdYnmHuGqanG49ZtaN5qY4r/++utxGRkZl+hvAOcIW1OwW8Kd4gbq/xn13VFxA3iQzz33nGFxA9LZ66hv9+Tn51fo9HaL2/otoctcFXVnhK24gdDraBetWLFi9Lhx4/oYdRwTKiwZq8t3kDXy927dus0WjlyN5kEZj5ZSviNSmUgby3eIEd/lhRdeGDpz5swhHTp0MAyO+KJADRYPRowY4bRADamYkwUFBS/RiP+b0Nkeq5IWX6BGhHU79+nT51JSI9dPmDChv7N7I5kSKcPIYsXPhw4dsqXSyQVnBKoQ2EpISLDZ0YCLZTFXJZho0v77okWL/vLiiy8eUGAHToEa5Vp9CSapYmIU3R4nHmOff/75DLLVryZQ8Va49qSrfyTL6EMyBT9WVEitFoglmHTQ9UXG5I4JWXGio9DxeOxA1sFAbDscNWpU/6ioqEhfQibVUUVqamVRUdEWuv9qEY5QVUjgFhkzgB6qAx8lwMvaKmqLSU1N7Tp9+vQraaLrkZaWlkwOiFc1DGtqak6S+vnh4MGD299+++1VZAaWKKBrFNB1ZuLcLa4UqkGhSFnpza5QpHahxJ78P3wjIseMGZM4cuTIK0jnX0J6uktcXFws6e1ocskjRKz6bHV1deWpU6dKy8rKSoqLi/eT+bltwYIFewXgM4rqOKuoj/OaqEkbdLVnlZqzoboRH6GoG1mtU+4ditQu1KDVF3TUJySd1S5kEsgRXKOojVrdiK4T/a43G7cJlmK/EQrocM2+wrIK/LwCUoKtVQC3yGK/XM6aC7ZzwfZmBe5vYeCtHTiLxeFZFgbOwFkYOANnYeAMnIGzMHAGzsLAGTgLA2fgDJyFgTNwFgbOwFkYOANn4CwMnIGzMHAGzsLAGTgDZwkC4BYWFJObuOS+f+yQk1sRZZ0uVKKT27wbxQoWwQY8RIDGjmfU4EItrs7i/7ANBTvbUH8QNRaLtYYCadgfVG8VcIdFXHzdmvv1BWxsPcTm+gmpqanzly1b9sPhw4cr6kjOnTt3/sCBA2VvvPHGt7GxsXPomhFaQ02XNlayCArgAjb2e/amln3fffd9XFFRUV3vQH755ZeyQYMGvSKgXyxUEAP3ADZUxhWAPXHixI/OnDlTW+9CMNrbt2//ND0nXXxYDNxN2NhIi7MD7hwxYsTfTp06VV3vppB6QbX3iVpDIR0G7gbsNmJyHJ+RkfFOaWlpVb0HUlhYiHqL08W3g4G7uF+ksELG0AS5AJNjvYdCEyksl6eo9bcKeGhAOg8hIRHC9EtLSkoasnr16inx8fEx3hhpVvc9NABhY/89itz069Kly+Avvvhiavfu3Tt6c6/i4uJy7ULVCQbuADaqCfWNiYm5Jjc39/7evXt7ffz5qlWrcDThceF9WiOBosOFrQyv8frQ0NCn161b9596E0I6/1Tnzp3/l+53LZuFTZ+LbyJKNmVQe2LFihV7zMCurq6uve222xZjwqXWjR2fprCho6+mNnPRokXbzMCGi//AAw+soHtNFuZgW3bt7W1tRPsGUnvk5Zdf/tYMbMRUnn76aRxYPw2Troi9hDBw+2AUwDwwZ86cXAAzA/yPf/wjDj96mNqV4oMMsXo+a5HAdcGoex988MGVUAVmYJMq+p7uNUOoJqioUH2/WiVwJT4C/Xr3hAkTPsIkZwb28uXLcdTVE9QGi8k31KhfrQ64Eh9BLdM7hg8fvsiTYJSRfPXVV/8HMxLmpDArwxz1qzUCR3wERxqMHThw4BvHjx+vMgN769atB6Ojo5+l+w3XGgoOhzvrV6sCrjWUzkN98azLL7/8T+R2nzQDe+/evcfI9X+e7pcpFhnCXfWr1QDXGuoTIiadSd7fvIKCglIzsAsLC08kJibOp/uN0hqOR4hwp1+tAriAja/7jTExMc9u3779vyZd9op+/fq9LrxIrFlGutuv1gBcjY/M+eabbw6YgV1eXn5m6NCh72IRWWs4H66NJ/0KduBqfOTJlStXmoqPVFVVnR05cmQO3Qun7V0mTMsQBn4BdmN8ZPHixabiIzU1NecmT568TMRHeolF5RBP+xWswGV8BO71w/PnzzcVHzl//nzdzJkzP6V7TaWWKjzUEG8GQjACV+Mj02bPnv252fjI3Llzv6J7PSjWJWM8gR3swKXLnkLtnmnTpi03Gx9ZuHDhJrHqPkjkEYaYUXXBBjxcmGnjxo4dm0OTnKn4yJIlS3AO+2NixcYuPsLAG94Yvu5DkpOT/0Aue6UZ2GvWrNlHZiTSG4aIBeUwX0zmwQYcS1l35uTk/NsM7Ly8vMLIyMhn6F7DjIJRDPzCG4Pu/h1SE7yFvXPnzsPkjc6l+9ykNZx8Fe5LczXYEoFsZ/kkJCR08ObJBQUF5ZmZmZ9WVlbup19/pvYrligDLa8mIDOvAlmsBI5jXqoOHTp0ypsn9+rVq9PatWtvJ5WSIlaD4kRiEAN3IMhuKl2/fn2BtzcYMGBAfG5u7hSaNJHTjWMiOxL0sIAizmYhOz7s+LBrz8ErDl55G55FNhSHZ61dgJjBCxC8xMaLyLyIzGkSQZUIdJwTgTjVjZM5OZmz5aYrz+Z0ZQsT8j/55BNOyOctJy18UxV2n/GmqgDcNoiAGW8b9O/GWK55Vd/MW79RoikrK4u3ftdzcYOWVRFIibsMR9xl27ZtJSZXjFDz6g6ueeUaOlz1TLju+fn5x7wFjspuVte8CrhEIJFtheJgu0tLS7egkltRUdFJb+6VlJTUSaiTKM68cg69Fjku1H4qLi7eNHr06JwjR45UelNkiFPd3BdARx3ZnXv27Nkwfvz4f5SVlXlUu6qkpIRrXnkwyqHQUaj3KKBv3rz56+zs7KUVFRU17t7js88+2y0+NK555WG+C5dCtQp4PRf75XLWzhoXbLe4YDsfSdB0QZuBW2lABA1wFgbOwBk4CwNn4CwMnIGzMHAGzsBZGDgDZ2HgDJyFgTNwBs7CwBk4CwNn4CwMnIEzcBYGzsBZGDgDZ2HgDJyBN9cL2eeHI2EeWz1kwrzcmIrdCDJhHsnzSJi3bEQEY0I+/sFuBOwARjExbAvB4RnYEBUqIGM79kGtYVtIqfi/+mABbvWmKoxqbGQagY1N2OCEjU7Y8ISNT9gAhY1Q2BClNVTXxAapdpoXZaq52G+DGsEWvRHYsoete4629WHLH7b+0bXZWsNWwOjmgh7MwAEtHZtRMardKSKDTa4C+hWaBxWTGXjDG0NNkomkRja4W14DNQtRLYKedye1npqbFZMZeMMbwyidXlhY+KsnNU1KS0urMjIy3qHnjheTbBtfQg9m4Dgy4CmaID0uhYfJlCbSBVpDjSpsdo0MVOD+qCbhse0VHx8fs3r16ilJSUk4RiaNWhcyMyMC0fGxEjjs6SocfufNk7t3797xiy++mNqlSxeUM0XNQT6pyoXAgzy+atWqPd7eoHfv3hfl5ubeHxMTcw392pdabMBBt9gsvBal61DCzkw1NpTQQyk9zUHFZJ40Lzg+KMo45rbbbltstmIyikVqDRWTMzQ+qcrhG5NlqiejHKkPKiZvo3vN1HQVkxm4g5OqfFExGQWA6V6PaA0FgdtrfFJV855UhQ8MHxzd6wFNqZjMwJtaR40nVaGYutmKySjqTve619NgV2sBLqFjsoNd/cTy5ct3m4GOSRjHF9C97hbzBJ9UZSB2FZNxQIYZ6Ah24aAOraGAbw934i6tDTiksWIyjoDBUTBmoOMoGhxJQ/cbK1aV+KQqg2Utu4rJOPTIDHQcuoTDl+h+WVrDYUx8UpX+TWoNJ1XhGK9RONYLx3uZgV5QUFCKY8a0hpOqEIvnk6r0b1IsMGPNcwwOsENY1gx0HKSHwu50vxs1PqnK+E2KiS4Zi8g4qhFHNpqBjiMjcXSkxidVOQQuT6rCIaR34VBSHE5qBjoOR6V7PWkUd2n1wHUVk5EmMRnH7+IYXjPQcQywUdyFgTetmIyDpafioGkcOG0G+vz58/mkKjcqJseI9dAHcaQ6n1TV/CdVhYgcxEFY9V+4cOEms3GXadOmLad73UMtRYYAGLjxSVU45OixJUuW/GAGOk3CtWPHjs2he40TZmg4AzdeMYqjNoTMvKfWrFmzz2QIoDI5OfkPuJ9QWwzcyfFgwyIjI5/Jy8srNAM9Jyfn3yKrqxsDd35SFVKcbyIvcu7OnTsPm4i5IGXjd0KX80lVDj4geVLVz5WVlfszMzM/LSgo8CrXJSEhoYMwPdsGY14KSyACF4k/mDyvIJWSsnbt2tt79erVyZt7HTp0CFtbcBBHNQM3hh0m3PI+NGmm5+bmThkwYEC8t/dbv359gdjWwidVsVnIjg+79uzac/CKw7OqIMuLw7PWLkDM4AUIXmLjRWROk+A0iYBIBDrOiUCc6sbJnK05XXk2pytbmJD/ySefcEI+bznhTVW8qcrMtkEEknjbYPPXvOKNsRYBb9z6nZWVtRgllszA5q3fXNygRda8umPhwoUbzMDetm1biYiPDHcUH2HgSs0rdyq6OZL8/PxjcP1FfORis7D9AdzKNAksKEQnJSV5lUNSVFR0EhXeSktLt9Cvu5F9JbKwOBHIVXqJp084cuRI5ejRo3OKi4s30a8/IZeEYNdy5pVzsdW8Kikp8SgPsKys7Mz48eP/sWfPng30605qx6gFJGyrgSO76dhnn3222+0nVFTUZGdnL928efPXAvZRarbltoBNLrTYLORSqBY7Plzs1w+ufasuZ80F25su9zUvB4uBqys9fCSBhcBbrAERNMBZGDgDZ+AsDJyBszBwBs7CwBk4A2dh4AychYEzcBYGzsAZOAsDZ+AsDJyBszBwBs7AWRg4A2dh4AychYEzcAbOwsAZOAsDZ+AsDJyBM3AWBs7AWRg4A2dh4AycgbMwcAbu+QuEhIwWP/bz8KkvO/ujq37T687x8PV2i/uubk4efESvxRJuwWv0EyNnvpvfiGd8+eJevC6PcB7hzSu7W9h9eITzCPfOennGmc53ZdW4WyXO0eu4q9t5hPMIt8aKsOCbxSM8GIWBM3DW4ZbqTrouyx0rxV07nOaIVS1Jl/MID8IR7ijqN8eZHU4js63Jb1Q/F9bRyzzCedJkYeAMnIWBM3AWBs7AGThLgHqaXuWHuPIU3b2PE090jj88UB7hQTjC5ciZrxthjtYaV7Wk/vAI50mThYGzDndqLTzDI5wl+Ea4o3wUZcT7JD/cXxlWPMIZOANnscJIaIF7fGQMZLVJHe7V6/IeHx7hLAycgbMwcAbOwFkYOANnYeAMnIWBM3AGzsLAGTgLA2fgLAycgTNwFgbOwFkYOANnYeAMnIEzcAbOwFkYOANnYeAMnIWBWyz/L8AAHWgCuybDs4EAAAAASUVORK5CYII=);\n background-size: 46px auto;\n }\n}\n/* Dark theme */\n.fancybox-dark a.fancybox-close, .fancybox-dark a.fancybox-expand, .fancybox-dark a.fancybox-nav span {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAADICAYAAACXpNOoAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpGNzRGRjc2NzEwNERFMjExQTc0M0U0NzZGQkE0MTM5RSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1OTJGQjgwRDZBNEQxMUUyOEJDREM1NUU4QUUxNjBFMCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo1OTJGQjgwQzZBNEQxMUUyOEJDREM1NUU4QUUxNjBFMCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU2OUM1RDBBNEI2QUUyMTE5NTdDREVCQjFFNDc0RjQzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkY3NEZGNzY3MTA0REUyMTFBNzQzRTQ3NkZCQTQxMzlFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+YnXBBgAAC/pJREFUeNrsXGtsFccVHhvbGGxT1BC1qFBT7DpVZRErpdQ8hBRbIJpEgSqqnaaoP6pKDjSOBEi1eTQgqMBYPAK1UahQfjkNjyJERIpAUP9AFFLHpSCkNLXNq45QBakKfvA2Pd9o53Y8zOzO7t17by1mpKPZuzs7883ZM7Nnznx3sx4/fsxGYspmIzQ54A64ZcpJtoLi4mKeZ2VlDcvVJCYBNb927VpmgAOoCloFD5A4p8szpvHs7GyAKKTDlyl/kfIKkm+RfMUrcovOX6b8bwS0nfKPKe9PdhrOSqaCkpKSUgLVQIc/obzAZCay5kkG6PBDyjeTdF+6dCl9wAlwPmXrCOgykjydufjZuCf3Sd6lU2t7enruphw4gS4hcH8gqRCAdaDFsVy/BjwEJvRjAt+dMuCE+QUC9EeSr8mgI2pcln+RvETg/xo7cM+e/0zyrDcgrUEHgR8aGkJ+g2SWreatgBPoMQTqDMnzOtBJmooM/gJJJYG/E9ebEwPxeR3gmGUa2opF495g/Iw0nYvKTRqHxh49esQePnzIcnJyWF5eHr8f5x88eMCv4d7Ro0f7aRz5A8q/G2QyORZvxkaSXD9N3b17l927dy9hIgAKQQdwTTYTnB8zZgzvhPoG9vJcyhpJfhFZ46TsIqroOjVSIDStalyADhqYsp2PGjWKFRYWmjQOGaDjiaT1vqg2/pL8RlTBoREZ9KJFi9i6deueKDd//nzW1NSU6DTMRjwhjcYhBWg78uCkCqp1DpQQABAJoJctW8bmzp3LwcNMoNkFCxawlStXspkzZ7KNGzcO67RpVvLOVSdj49P8vD4MRHGuoqKCd2RwcJDNmjWLrVmzhnV0dLAVK1awO3fucLtub29P1INOqRpXvMZpkW28tLT0Bj3eCSb7xkADKNEwNA3QMAOUhUCz+fn5bMuWLezo0aOJQVpUVJQAabDzm93d3c9GtfFxqg3K5oIpDyYhBt2GDRvY6dOnOeD79+/zgYvj7du3s5MnTyZmEnREVoKuDbntlCzdBHABHuYhT3XQ3owZM4adg4mles15W31dy69sgBLzNNK8efO4TQvzwBOB3VdWVrJVq1YlNArgeCKiHl0bcttRgPf4XYSNy1NeQ0MD7whA79q1i3V2dvJj2Pzs2bP5gA2h9Z5kgF/QLXBFgjbFuaqqKm4OmD0wEI8dO8anv7Nnz7KxY8fyWeT8+fOJemQTM7RxIZk3Zy2B2WuaVcQAFNcAFFPe8ePHEzaNa9A0QB86dCgBzmJWeZ3enPtS9srv7+/nmg/zyoejBRPyAT1Ix1+P/Mr3btxrWLVwgWnADNSBBmDqjGMCrQoW036grbxDqqiJsp9RnquzczwBOEwYgNAWOpGbm5twYWFOwtXFNZz3A00Ct3Zz0gsJ+MVU0faAxvjUB+0jl80GncB55KpNG+RdarMrthWQt6xiKZYLsa2ARvRieUSHJxTNH8TCNqZVPkzwtbABodBOljdYf0CPtxkLW2/eHTYXS/OxaZ5m3r3NqCss6DiCnt8mzf6KDt+gfKxl0BMO/O+9oGdXWoOecpo6daoIM7+ihJnHe0X+QyKHmY+IMDPkypUrmQE+ZcqUoAWB1iUWx1evXs0McLd55YA74A64A+6AO+AjISW9lz958mSr1Y/Jb+nt7c0McNXBsikfh38UB/Bsku/TIVza6XRcRvk3SAq8IiAdfEFg/0H5pyRwbTsQyA3T4di8Q3JnJ1H2S2r8p7CYMItlSv+k4w8obyV/vDctwAnwM5StJ5DYzsuzXeEbgptgUOyh/B3qwJcpA06gawhgKx1O8Fs8BC0kNIuKm5S/ReD3xQq8uLg4h8D8luTNICpTUHhCo3V5xf8eST2tih4mDZxAYxG8j+QVFXQQFyvATJ5YxnmCNWktgR+MDNzTNGIor+piKCkCDvkIsRY/zQdt0LaooNMkaLMlksZpINbSzXv9Qm0p1LiQN2jAfmgNHFMegfg7yQQ/0HEB9wH/b5LvEPgbtqbyGzHlmV7xuk6EEV1dajuUvkqywUrjpO1v0k3dQRwVk7nYzuMWZiLvUJSS1q8FaXwJSW4Ybek6gj3QgYEBdvv2bZ6LrRabupTruR4ms8Zp+sumdJVumBT2kcvaBjFB5aOIJLYJLTQtSy91upimxyGtxj0vb5LOnnWA1YEJgXaxYWWyX3EtTBvA5GEzmkqVrY+tNo69Tux5ylvdCxcuZKdOnWIHDhwYto8f5B4YfP0X/fzx76mV2ZgIwMA8YMMiLV26lNXW1vJreAq6wSyINUG+jVd2uhE4FXjOpFVTAlhoWpTF3ia2wOfMmcOvnTt3jjMnEg3m5FitgtQyKjZV4xPDPEbVZseNG8eam5tZWVkZP3fixAm2devWBMsC59Ax22Wccn2iH/CisCsR2Wb37NnDxo8fz4HCrvfv35+gOCGBRSF2liOkorSFJ3T0pVTFVfpCr7YlokFdXR27fPky3/5evHgxq6+vTzxuMevIAzhk6vMDfl03qv1GPfbuxfGtW7c4tQnkGpwD+Wb9+vW8I+Ie+cVk24aK7QngVPBznxuN5gD2hKDqgXe4du1advDgQX4OfMTW1tZhY8KmXrWMik3VeKfmBhOnJJHDXAR9SbCXW1pa2LZt2/i1goICrWMVVL/SiU+Nvgp5hpUewZ35Ua79vEO8bFSimNyGSrTxAy/vTIMQTx7iJyZT+QtlvUHa9nNToV1h9zrtyWPCtg1got8dRlOB90UF2mwGjU5j4hgahemItyRMCJrGWNB5hhZttcmeoWkhAU+sR/5/T4YXEoh2laihuideQCiAsJjN4NENNt09UUBL197XxRdNb853SL7UPUaLBa6VBJmLdw7xxDXWcRUEIBHLs2kwDvGp821TMNQ3kkX2/h7Za12G4iq/I9B1kQL76LHnTr4ah2MUMgRXH0fQE3/K+2GaNI7/e9YEBT0D3VpUQBUtJNkdZJPKm87qmlIX2vhREOgogf3XESdPUWD/bVOcMK6tlAkIixG4n8e0lfI+5b8m0DfTuXn1FgFe7O2yhdm8wi5cG+Utadu80gxesV1Y5YU3yrygUqFXpN9zkrBd2EnyJ89hGvLGUGb2OQkEAHziSahFQjJKcyw4B9wBd8Ad8HjmcccQygBwxxBKKXDHEGKOIeS7WHYMoRDhCccQcgwhxxBStP30MYTEPiY2YgUzCDtwtsyijDCEEBvs69NvTIudNpPWM8oQAovCdB+eAjZuTWaVUYaQ+LoNBKwJMIPAEJKv44nIe/nJMIRU4JEYQrwi6fspYpN2+fLlbMmS/5knQOOa/MkHC22L39ONwKMwhEQZmUUBWhOYQQBaU1PDv3QjCDaCURTEotCAf85P46EZQuJYfAFBfAVk9erV/PM7+I1vq+zYsYMziMR9Nt/WUq5P9AMemiEkmwo4hYIRBNm5cydra2vjUyL+2wwGkUjyp6osU+oZQjKJIV3hCUzEz0SpSJ7HBesCDKHq6mp+raurizU2NibKq9/Jskh9fsCvC+B+nED1Oo7Fx4yQYO9gBoFkg3NnzpxhmzZt4nO5KCO+wmcbg2EKQyhHKfg5gSnXgQvqgMxRAckGf3uH5sGG2717N7dpaB7nbNhwQQwhVeNgCL0mgzVVrjI15ekNnBVMj/gI0uHDh4cNYBV0VIaQCrxdBhvGVABUEMUwd6tlQShDh3y+i6VtQyrTbpxVkmEIiS9K6u6DPUPTNhSRtDOEoH3M4wCJGQO/BclMeIa2lA9NW44hpG3c9PijgJauOYaQYwg5hpBP0NMxhBxDyDGEmGMIpWef0zGEwkYV2AhNDrgD7oA74A64A+6AO+AOuAPugDvgTw/w0ItlWsW/TFm54fJmQzhC3NtguO8iQm9hV+lhQ8INjzUJ54Pq9rs3LI44TeViTGVSYyrKo2+UfparJmRgtzVKT6QpI8CTaVzptJtVQmsLbGef2UaePY7EofUowOUpT55JyglUfkCHyxUz2/zUmYoD7oCncHAa/Q118AW9OWXfJexAjTQdipeO8hY8Ekc9zlRS/epOxtd46t3a/3tTuWgwj4spvne4ibrtQgfcAXfAHXAH3AF3wB1wB9wBd8DDpv8KMABmoXlBk8maWwAAAABJRU5ErkJggg==);\n}\n\n.fancybox-dark-skin {\n background: #2A2A2A;\n border-color: #2A2A2A;\n color: #fff;\n border-radius: 4px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.3) inset !important;\n}\n\n.fancybox-dark-overlay {\n background: #000;\n opacity: 0.8;\n filter: alpha(opacity=80);\n}\n\n@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {\n .fancybox-dark a.fancybox-close, .fancybox-dark a.fancybox-expand, .fancybox-dark a.fancybox-nav span {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFwAAAGQCAYAAAAjsgcjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpGNzRGRjc2NzEwNERFMjExQTc0M0U0NzZGQkE0MTM5RSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMzAwM0E4MDZBNEQxMUUyQUMyMDg1MkQ4RkQxRDJCNCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoyMzAwM0E3RjZBNEQxMUUyQUMyMDg1MkQ4RkQxRDJCNCIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU4OUM1RDBBNEI2QUUyMTE5NTdDREVCQjFFNDc0RjQzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkY3NEZGNzY3MTA0REUyMTFBNzQzRTQ3NkZCQTQxMzlFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+WJRMjgAAI75JREFUeNrsXQuwFsWV7ksIIk9hIRDChitceaiJbtwUEmJZywYlsoaquKGI0VoQNJaICioXtYjysPReFYgiKcUHGzaa0jyKQJSQWqxUCErlsZZReV0exiKKugS8gMQkuueb2/2n7zDTfbqn5/8vbp+qrp5//nl0f/PN6XO6e/rUffjhhyJK9aRThCACHgGPEgGPgEeJgEfAo0TAI+AR8CgR8BNZOhe9wKc+9akkr6ura7df/83Z5vzmSrp/yPT7tddeO7EA54Id4gGEEICtrluLjrvOZYFtA5UBOl6dMZRG0b6RlA+nNJBSb0o95TGtlA5RepPSDgJwG+Vb6fjnKd+XBXDW9gnHcBdQLfvOoXQp/b6I8pEMpveUaTClf079t41AfYbOfYK2f5vH8hMScBOIjP8A2DdpexrlpwdULSNlmkPpVQL5cbrOQ/KtqJlK6VQNsJFnpFPor9sp30vpHkqn5xzX7vo+/8tr4x575T1PSZ97wpmFJrBTOTamUraT0h2U+mYBaACPlXKu0Vfec6csQ90JCbgDsxso/ZISXu9+riCnmcxgdt61+8ky/HIYyQmpUvLA1vZ9jXI0XmNtx9oeAEfFmLa1HGX5HWH+tROe4SkVci9lT1Hq5fD6sxnMOd5wHZTpKQL9Xkp1JyTDte0ulP0X5Tdy1Q53n+95hjLciLIS6F1OKIanwF5D+aUcq8WmTtL3y9vnop4yynQpylwm6J1KAhsbj1E2gcu0WujwnHMmoOxlqZegDNe276L8G4xGywqQicW24wrc+xu0eXeHt8Nlof+d8kYbY20Vt6kVmzrhgG15I+aWYb10Cgg0ZChtPxJKVRS1UoqqHkorCfShHZXhkP+UvXlOTDOpAhdn0AQmV6WkytQbdQqpz0My/D8ofbFohTkWCEeXu+pxwzlfRDdAR2M4OoOabazm9iaGYrhvT2ZGOZqI5ad0JLPwekr9bawuYqEUaVtc7p3TDvSXdewQDO9BBbuOYyG4MLyoSgnMcKTriOU9OwLgV1Pqmwcah2V5YL///vvi6NGj4s9//rO1EBhMwHHqeH1wwQZ6VnkyfqOO3yz85hUZ9UDrTbKd0mlc+9bGNAX0e++9154ZnTqJ7t27i4997GOZDwbH63XB8SeffLLo3LmzSI/wmPL0dup3C6Xhu3bt+rBWDMcg72k2dhcFG/LBBx+II0eOiL/97W+Zb0GaODge+//61786lcHC8gZZ55qplK9ZHKFc15sD9he+8AWxdOlS8fGPf7wd6Mhx7l/+8pcEVCWnn366+M53viN69OhRYaUNdBNBctqFyTUDXHVOcQpvahTzwF64cKE466yzxH333dcO9MOHDyfHA3wdbDyc4cOHi/vvv78d6Gl1Y3v4ln6cCTUBnPQ3piaMtHWZctmdBvuOO+4Qx44dE62trWLkyJHHgZ4Ge8mSJQmT8TAGDRrUDnQcjwfkyvKceo2guv9jLRh+rs0Mc2F3pVEYMyZhNvYBQMVQgA5Qu3TpklwLjSJyBTZ0O1SMslaGDBki7rnnnsp107qfU0ZDmcfUAvCzQ7m7uo6dPHlyAqYOkAJ9xIgRCdO7du2aWCtnnnlmO7CVwDLBNR944IHKvizrpoB8tuqA09MfxdHfHH2pm25z584Vr7zySgKqfpwOelNTU6Lbm5ubjwMbagfgzp49W7z66quVe5x00klO7YpFj4+qBcOHcAclbAIwwGoIwJszZ47YsWNHLugNDQ1i8eLFuWDjfAU2BPa4a59MkbqXBfgnGSYUG3w4NVmgp8EC6NDvaFB1VaTAvvnmm8XWrVsr+7t165bo/SIgZ9SvXy0A7xlSKQKsNOg33nij2L59u5WhUEk4f968ee3AxvU4YPv0H3UIwItOwgRoMOV00KHTt23bVjEJ8wC//fbbk+OKgs2sQ89aAF6KAHQwWlUWauO73/1u5SFkCezsyy+/PHko6vWHrjeZgrWSIoC3ZvXYmX5zRPcgcT7s70WLFrXT12nBm3DaaaeJu+++O2E7zlMeqSvozDq0dgjAi0raXR81alTivAA8E+AABY0orBccn/ZIS2D64VoA/oZeYRObOUxXvX5pdz3LqYG5qDzONOhguqkbwKeMGfV7pxaAv+Zbgaxj9b6UPLABIgBHP8vu3bsz7XSArjxSHXTOIIZD2V+rOuBUqK15zM4rcLrDX23rIzSq1y/PqWlsbBQvvviiuPXWW0VLS0uuc3TGGWcknqjefZC+L6esWUxH3WvB8JdCKURdx1533XWVvpA02DfddFPi9uM/gIrfO3fuPA501W/y9NNPt1NFAeWlWgD+vEsrb3pN9Y4lgIiPVVXfh+6uA2w8HJWgPtIeKYDFufPnzxebN2+uXNdkk+eV0VDmF6oO+K5du16nbLup4TSpG/0/gKHsbJhyYPkf//jHxAkCgKpvRN0D7rru5uN/OD09e/ZM2A4nSAdb2fUcEmTVIbVvB9X9DzVxfKgg6zl63MZyMFN33xXoYK7e66d7kGmPFN0A0O3f+ta3jgPbld0W/f1sEcyKjtrjG5lNpq8O0p0/pgFc6OasAeG8jiioFTXGmSVZYBcYsVfpi8TwX9XKtQeVWjhemm2KgmrYAGrajcdDyer1Ux1eWYMLrmAzPc0WWeeauPbQ41SeDx9Kq5Ws31y7F6BDXUAXo8FE3qtXr1y1ALChuwEwjkfeu3fvXLA5ZcirD+paZE5KqM4rfE79J46VwmWWGqEBq9MjNXmijs96MLY3jWml/EnWVdQa8FYq2LdNLOeoFpsTwkkc5trubWD3/cTu1poDLgv3bUpvm9SJieFZDVSIcvncO0etoG7317p7VpeDVLjGkAy3Mdf2JgRmeCOx+0CHAFwr4CpKvzKx1ZfhPirFheGWc34l6yY6EsNROAg+Ozlkq4hLhYsw3OeBp8p0CHUqapmUxfDEUqTtK23MtTHU0HCxGM49n1HGKwnsXSF7vUIyXBX2acrv4XpwTAuBNUDAsZRs3qS2fS9h/bQILJ1CgZ3aRgP6PRcdyrFUuOagq/7OOP57tDlXlCCdQ4ANx0QVWG5/SPkVlP0D7Zqg/687NznnHred1dll8x45lkoO8Otp84qQers0hqcqgSmxkyh/wvQ6c/W8pcvU+Xo5ZcIKcJMI7PdFSdIpJNg5oF9G+X0cXeqyz/c8QxnuQ1nLBDuISkmrlRz1chNlW2jXI5R6ZamILPXgu4Kmo+PzLuUzymggq8bwHB0J6+Uc5RxxGkyu+edq7mk5yvK5aoFdig636Gp8dnceJTSo7/ioDR87PeOYd2QZzgttZ1fVDmfm2HicstMoLaB0wEdn++h0ea+FuLcsQ9WX5gymUhyZjnSQ/rqD8npKN+vzXHxUiOUhbZX3qKfDbse9Q/VKukpd0ZsOHjy4XQOnb3su9ns5/Z4o2j5CPe4c7sMngfr6KeWrhVzsN6v/Zs+ePVUFvHNolWJzaCyWyW+xmCTtv0H8fTnrMyiNEH9fzroPJcyTwLSsw3IkBgnLWWPaxiuibc7MPo7FUm0J5mlaPM/j1u1meJf76PcPKP9BEbOwo4FeF8M7nmCNZpQIeAQ8SgQ8Ah4BjxIBj4BHiYBHwKNEwCPgEfAoEfAIeJQIeAQ8SgQ8Ah4BjxIBj4BHiYBHwKNkSOGZV1iNHmJbQpS77HXoQNzcRdBsqxnlzdh64403qgt4GiRX4G0Auz6ArDmM6f/TU/P040y/8/6rKuBcsB0Zj+Wi/0m0TeIcKXNM7sRXcZjIidWN8S0OJnMelPlblBBTCCv+YlLn/wi5oGNWECUOsDagfd7G4Aw3AW0AGSD+K6VxlP6F0mfr7LXBwih9hRYli+RLGnOBCpa7e44utZHy/6Z0NAusrMmmLg+lQzCcATQa7PGiLXTixfS7e0iVIh/YWTLdQPuxHupa2r2K8p/T7w+yWG8DvijoQUP0crYpIVge5n/vonw9pSk62JwYmS7HaPu7y3utl/e+QZbFmzw+KqXMMOvpwmHxwJsp7aHtpZTqs0DiAst9EDng16MMKAulubJsxjoUBToY4MxApFNoc5sMctrPBjIXUG70b8Pyfv0QnFSWbQo38GkR0MtmOKKBPEv5k5Q+nccgrlrglINzzYxyfBplpE2ouCFFQlLWkuGXwUrQY5dx4x67MtsW/dsWL1nbf6G0bC7jxuCsKcPldlfKHqW0mrZ72XQhB6QQQJviJafKhzLjy7fHZF1yiVVTHS63P0HZRizd4RDK3NpoFlEpnMDUOWWdJuvyCRPTa2kWnkrZZsrHcFid9xDKaDS59844Zoys06mhmB5KpSA2GRb9HcYxEzkMDNlo2hYftjSSw2TdRoUAPYRKwRfDGygfxDUTTV0CZTSavp6xlg+SdXT+Ojoo4PX19f2l2TfYBjZXlXDCprsc46JaLKAPlnXtXxOzkMDuIvsmGjhgcxosjivP0e8mE9DHudHyBlnnk2phpaygG492KKyV+RyGu+pyhu3Ncm60HHV+sKoqhdgNp2a6C9guFfexUFwsFdt+Rn2mp52j0gAnsIekn7BPwTmNJ+cBcNjt8tAd3PgHhUcgUx+GP6R7kCY3n6MjOVaF7wOwXd8V9NR+YPBQqYATu6fI/gZrEA3X3jauHvdhOMc05ICekV9ImHzdqX3hjlrQhTEMtjWv16+IpcIYgnMe8cnbx11iL2tfzipxiOkzau/evUdDM/xaHexQfeVcJ8jVQinq7DjUDZhcG5ThxO4ecqSmn8PrFnzYKu+/ImvQurDawPb/BUzE8sOhGD5NjdRwGksXNnFUissQm6U304kIDnXD9I1pQRhO7MZDaUGPmS+7fYarivY7+4Qr82G3xvK9tDmMWP5BUYaPN3VPlmGtcPtROMeWZJ1knVtP2QUhVMpUl0EIF8ZyzwulUkKXzQsrk0qRpuBbck6HsffPwz32rqAKuYvgdwiYh9htCCmGKFUqUCl3cqavasnZh8lGA0itHPFl+AXpSTpcS8LF5OKCjf0I5Yjwj4ijCcCxDw8Av7FfxT52uaaPiZhzHrAaX0SlTPCxtX1tcZtaAZhZ4R/1tw2he1UsZR+ryaeOqf8mFAF8nI/e49rSHLWiA6lHBh8+fLhYtWqV2LRpk1i7dq04//zzK8eD7S5uvSvIlnqO89LhpL8xWr0/a/TEVYf7eppKEKRUjwA+ZswYsXDhwkR/IyHEI8JAjhs3rnIuQkIWde89dLj6DT3+livDPxf6awRXsKGjW1tb24E9adIkceeddyYsRoL+xvGHDh0q7N4HrOM5ef+bpiuf7eJih5ooo85X4Xr18LvXXHONmDx5ctI4qgYTQUuxjXj3lUpJS6XIPG79fIfVoZVgivSzroA3FAHQR60oAaOhRnQAEVx67NixCeMVqxG09MCBA0nUb/1bG+w3AZi3bQLY5QEJbe1zF8BP5aiEkK+kavDAbCUIv9vc3CwaGhoqjIfdDZ3d0tIi5s6dmzBeVRZRY/UYyUVZbmN8zvWH+gA+qCw9lycw+3RLZMCAAWLZsmWib9++yX5UDGAD1Oeff14sXry4YndDEEtZqZNqSwr4T/oA3resgmVtQw/rYI8YMULce++9CYAAFZVRUb7XrFkjHn744QrbIXgIeV6mT/ixgtLXB/CTi4DpqnZ0po4ePVosWrQoaTiVTQ0wEdF75cqVYt26dQnQeABKl2eFWg/RQHo+lG4+gPes5isJcJUosHWPEW/AXXfdJX7961+3i3uP/hP9dweRHj6e5vuiA0q12pOyxAR4azULojd28+fPT37DxlY6GSrj1ltvFRdddFE7z1B1YnUwOVwVwG1doCbRbectW7aIWbNmJUBCZYDVUDGwzWfMmCGuuOKK5JpoNNV+XSX5SF5ZPRvVox2G4Xn9GGAwGkUl27dvT8A9ePBg8jCUHofNPXHiRHHLLbckuhugI2E/dL7vNInAcsAH8LerULDjWA7zTsn+/fvFVVddJXbv3p08DAUwHKDPf/7zidmoH6/6yWshKYze9AF8D4cpIR8GrgUVAlu78pqRKw/1AkcH4CrQYbMPHTo0sccHDhxYKQcehq7TQ5eP+Zbs8gG8pUiBOUNYeddHYwmvUZl70M/oS/nhD3+YuPpQPzgPtvspp5yS2OboH8+y6V1US1ESaee1+AD+IrdxDMl4dT6sFDBdd2hWrFghli5dWvEqlZWCY5qamo6z6UOVhbvIjSYv+QD+u9C6m8ty9RtAgtHKPITArb/tttsS1aOcHhzfu3fvdufXKh6bvN5vnAGXIxYtHP2VV2gX1psAAtN1sxH6fObMmUmj2qdPn0RnL1iwoJ3F42raFalLat/OvNEem2sPwcIuDelli9RN8vZl/Zd1Xl6kwnRFsE9ZKaqDa8eOHWLq1KmZFQfzOQ+SMyfRQ31u9PU0Ic+WwQyOOknvQ1JmY9aDVufhwegeqk+j6fOmav+tN3rUFjyxcs4RNTfFhcF5MTSzzrMxXd8PMKEyik4EKqIqDedhmOrn3gyXM4jWcVtqLlu55+ZVGACDyTAdYRZihF63XFxnXYWqE7AyzbriqBTIqiINnss+kzqxsS3vmDLL5oMVB/ANciqu0Umw5VxPzQSuLeq37TplTVeW268Bq8KAy/nOS3z0oktFXYC3vW22a3EfvGPdltrmhnMZDnlcflbhpBM5VoHNTAupUrJmTHGBt9QN2DzKAZIFuPx2pTmUSrFtl6FSyvq+R0oz5/seF4ZDlstP5Nivui/oZaiUora4oW7AZDm3fGzA5XeI8zg9gi76Mv2a5wFvUhl5/5uuXbQB1eQW7jeargwH6E/SDX9WlnXC1cnc/4s04sx8A2HyhAuGPvMLrqYbvctpYFytkzIZ7mqt2BpLicHVruA5A05PFDb5tT6d+VzrJDTDXa0VZtuDr4/3lA64BH21MoN8Cs61xU2WCddiMbHahyhSHqO0utqrK8+kG25xAZ1bcV8LxabHuQSw1GOLrLtX2bwBJ5Zj4PBiunFLtSwU7htQoqXSIut8zBe3QpPyCHRMpfgyFWCfi962sc/F+eEwnHM/Btj7ZF0LTR8pPAtSPvXxlL8e2tlx1d9cq8fD43xd1rGlCNhBAJc330rZWMpf5bDaxmgOi13Yb2K8je2yTmNlHb280uCAayw4j/LNLo1USEuFY6G4NOKyLuept7co2KFUir6NOXXjKF/OtVJMDAzBcJvnafjmcrmsywGuU1RNlaJvw3qZRemrtH2Qw3aXfS66m7Mvo3wo8yWog6xLEGYHZ3hGRX5M6WzV92Jie1GgXYC3EABlRcCmH7n4FDVjeMarjGGnCZRfqnft2kzA0I0mo+H8A8ooy7rX9ol3rc1CjnODgBYjKW+k9I5Nb4duNPPugbJQmifL9qSPU9TRGK4f854cNRpK27PTA9OmRtNliI3ZaILFs0XbB6xNsmzOTlHNAHccPmultIx+DqMcr/D35QQaJ7Xgqo5wD3mvCfLey2RZvJwiX+A7hwCaG7MsNbsKI9w/o31oqLrRbwS/Q0Lwu8+o4HcF5mrjxN9Tek60Bb5rF/zOlSyhWN45JLtdgsWljsUQFRZCXyv/7k/7YS1gln06vGN3mSBHZMKoOfo6ENYR4R13iLbwjm/ngeMCZqAPrcphuClsYt5DyagIgMKkmg0h1p51Aa/Ig+BIXbU+mIoSuNGMEgGPgEeJgEfAI+BRIuAR8CgR8Ah4lAh4BDwCHiUCHgGPEgHvwFJ4xGfQoLZFmH3CxJQRoSotob6tzxv50dctrwrgaZBcgbcBXHSIzbawjm3ozzQYXpNRe9dAoUx2I9AeBpExeJweRMZChVhMFwsU4uvfgzLHskfb6RoYRMZgMgaR30kD4wKsDWiftzE4w01AG0AGiJgigTAlmCbx2Tp7bbDOUl/Rfq3uL2nMBSpYXe05uhSWRWo3TcI02O36UDoEwxlAo8FGVKeplC7WI2KFUCnygZ0l0w1yshGmYqwSbSsdfZDFehvwRUEPZqVwgafUg9IN9HMX5espTUmHH7MFlXY5RtvfXd5rvbz3DbIs3uSpSph1E9jpYEqpwmEl35tFW+TZpTIc4nEgcYHlPogc8OtRBtH2YetcWTZjHULF/ukUEmwDq6fQ5jbKm1XkWQ4wNkBdI4Bn/EbI4SZZtikusdp8QS+b4UNo81nKn8yLFu4Ty57LdA74cvvTKCNtQsUN4YQ/q5lKMRTkMlgJtD3B9GDyAHFhtkFvG++VUe4LpWVzmS0WaIdguNzuKtq+w19N271supADUgig8/ZllA9lxloCj8m65BKrpjpcbiNC4UbKr7CxwgRGSJViAtqkNihNk3X5hInptTQLEUpsM+VjOKzOewhlNJrce2ccM0bW6dRQTA+lUkZRtonyYRwzkcPAkI2mpcG0xQgdJus2KgToIVQKIuthHvcgrplo6hIoo9H09Yy1fJCsY0NNzcL6+vr+0uwbbAObq0q48eq5x7ioFgvog2Vd+9fELCSwu8i+iQYO2JwGi+PKc/S7yQT0cW60vEHW+aRaWCkr6MajHQprZT6H4a66nGF7s5wbLUedH6yqSiF2w6mZ7gK2S8V9LBQXS8W2n1Gf6WnnqDTACewh6SfsU3BO48l5ABx2uzx0Bzf+QUpDqsHwh3QP0uTmc3Qkx6rwfQC267uCntoPDB4qFXBi9xTZ3+AVy95lOC4kwzmmIQf0jPxCwuTrTu0Ld9SCLoxhsK15vX5FLBXGEJzziE/evlDrz6YW+x3FXX/WheHX6mCH6ivnOkGuFkpRZ8ehbsDk2qAMJ3b3kCM1/Rxet+DDVqbIKhzGl7WGuFywvZ6zhjiX4dPUSA2nsXRhE0eluAyxWXoznYjgUDdM35gWhOHEbjyUFvSY+bLbZ7iqaL8zV5eHWCFfsnwvbQ6zxYHgMHy8qXuyDGuF24/CObYk6yTr3HrKLgihUqa6DEK4MJZ7XiiVErpsXliZVIo0Bd+SczqMvX8e7jGrggj9hZiZyBEpFtGoEBoMcdlM8exdo1W5qpacfZhsNMAUrcrG8AvSk3S4loSLyZUHNuKtqTjHAFsFosZvFXTa9Zohyms4D1iNL6JSJvjY2r62uP4bYKpQjlnqAoxC/GM8FB914kMIpsk6oQjg43z0HteWNgECFisgzz//fLF27VqxadMmsWrVqnbxj/FQTA/GZUYvty6Weo7z0uGkvzFavT9r9MRVh/s4PO+++25FP27cuFEcO3YsUSfQ4UgISo3IsUoQ9lGPFh5oGWtXHa5+D8iLGmti+OdCf43g69YfOnQo+Q09DuYj3XnnnWLSpEmVY6CCEJJdhVgvMoU6QB3P8VEpZ7u42KEmyqjzVSBSSGNjYwIkApTif1gs0N+zZ88W11xzTeU4HHPkyJFK1O9QZfFwzM7yAbyhSKF91IouetBpxD++8sorxcGDB5P9yloBoy+55BKxcOHCygPCW6AsGNc3rChptPMafAA/lVPgkK+kfi3Y2ogCq/a/+eab4qqrrhK7d++uBKQGuGD6mDFjxAMPPJCEZFcCpquGN3T5GIQZ6gP4oLL0HFegQhCGVwmYe/3114sXXngheRgKdFgpQ4cOFQ8//LAYMGBA5XhlNlZDUhh90gfwvmUXjNOBBesDoCuvEqpk8eLF4ic/+UmyH28CLAMAi/jIjzzyiBgxYkQ7s1E1pGU3mBzsTICfXPApB1M70M8w+ZADeKRHH31UrFy5sl3waagQPACol9GjR1fO57Cc2+XAlG4+gPcUHUiUTtdBf+aZZ8Rdd91VcfuVeQgrZdGiRZVzldVSRenhA/j7IkpwMX022CraPkTtEAI9DG8TTFb6fOLEiWLGjBlJ46hYDJ2Pt2D+/PntVFKV5XBVAM9bXTm931WUo4PrqEZy+vTp4itf+Upi/uFhqAYWx86ZM0ds27Yt06a3decGWrr6qC/gwcX08WlWjyAABKi6Lr/tttvEueeem5iJSn8D1AMHDiRg6wsOwGbHObZ+lMBywAfwt/OYWy2B1QFmq3vDDGxubhYNDQ3JfoAN9dK1a1exa9cuMXfu3KTTq2IqUCMLW74aS3an7vGmT6O5x3TRUIGE8q4PNQFQ1f6BAwcmjg0cHNjWCmyACkdo1qxZ7cCGGRkabIcAHLt8GN5ShN1p/e2iStK2M/q/lyxZkqgG7Fe6HIx/6qmnxIoVK/7OIPkQshpKn7DCnoRp8QH8RW7jGLKBVOfrtnNTU1MCMFSMsjqgm5cuXSrWrFlznK2udHZRdpsegOXaL/kA/rvQupvL8nRImN69eycmIdirBiDQcIYegAiodn7jrMPliEULR3+ZIrdyK5U+RrcsFixYkOj0Pn36iP3794uZM2e2AxsWChdsHzY7sn1n3miPjeEQLOzSYFIhrmqFGxUFDZ7q0/7FL36RpMwOH1Itys4uGj7GFeCc8zeaALUNIj9bBjM4oVqgIgBmlopRnUrQ1wDbFIvNp9H0eVO1/9b7uvYQrJxzRM1NcWFwFpPzzstjOsBUjWXeRCAbSDY2+6hKw3nw0H7uzXA5g2idz+vq+jrmxVQDwGByr169kv5umIJqxCcPCNdZV6HqBKxMs644KgWyyrXBC7VWoA4gN9pgNcvmgxUH8A3pUIw+OddTc4lpzznWxVMuWDcEa91QGHA533mJj150qagL8La3zXYt7oN3rNtS29xwLsMhj8vPKpx0IscqsJlpIVUKJyCpZ92AzaMcIFmAy29XmkOpFNt2GSqlrO97pDRzvu9xYThkuR5IOkTvmq8u91EpRW1xQ92AyXJu+diAy+8Q55kA9WkoTXGUs1htY30e+BzGu7Bdk1u432i6MhygP6ni1JdhnXB1skukb99GnJlvIEyecMHQ51v7q+lG73IaGFfrpEyGu1ortsZSYnC1K3jOgNMThU1+rU9nPtc6Cc1wV2uF2fbg6+M9pQMuQV+tzCCfgnNtcZNlwrVYTKz2IYqUxyitrvbqyjPphltcQOdW3NdCselxLgEs9dgi6+5VNm/AieUYdLyYbtxSLQuF+waUaKm0yDof88Wt0KpuBDqmUnyZCrDPRW/b2Ofi/HAYzrkfA+x9sq5vO3ZohQNce+rjKX89tLPjqr+5Vo+Hx/m6rGNLEbCDAC5vvpWysZS/ymG1jdEcFruw38R4G9tlncbKOnp5pcEB11hwHuWbXRqpkJYKx0JxacRlXc5Tb29RsEOpFH0bc+rGUb6ca6WYGBiC4TbP0/DN5XJZlwNcp6iaKkXfhvUyi9JXafsgh+0u+1x0N2dfRvlQ5ktQB1mXIMwOzvCMivyY0tmq78XE9qJAuwBvIQDKioBNP3LxKWrG8IxXGcNOEyi/VO/atZmAoRtNRsP5B5RRlnWv7RPvWpuFHOcGAS1GUt5I6R2b3g7daObdA2WhNE+W7Ukfp6ijMVw/5j05ajSUtmenB6ZNjabLEBuz0QSLZ4u2D1ibZNmcnaKaAe44fNZKaRn9HEY5XuHvywk0TmrBVR3hHvJeE+S9l8myeDlFvsB3DgE0N2ZZanYVRrh/RvvQUHWj3wh+h4Tgd59Rwe8KzNXGib+n9JxoC3zXLvidK1lCsbxzSHa7BItLHYshKiyEvlb+3Z/2w1rASjTp8I7dZYIckQmj5ujrQFhHfE21Q7SFd3w7DxwXMAN9aFUOw01hE/MeSkZFABQm1WwIsfasC3hFHgRH6qrxwVGUEhrNKBHwCHiUCHgEPAIeJQIeAY8SAY+AR4mAR8Aj4FEi4BHwKBHwCHiUCHgEPAIeJQIeAY8SAY+AR4mAR8Aj4FEi4BHwKBHwCHiUCHgEPAIeJQIeAY8SAY+AR4mAR8D/n0npkT3r6uomys0zHU9tMv1p+6CX7tvoeL+X5XV/GhkeGe4kZ0rm3M18I+aFvLnHfSPDI8PLlZc72HUiwyPD/ayXeSadb7NquOuo5N2Hq9sjwyPDq2NFVOHNigyPrn2UCHjU4QV1Jx33bxwrhWuHUxuxriPp8sjwjyDD83r9Gk12ODGza8E36kyLddQUGR4bzSgR8Ah4lAh4BDxKBDwCHgGPcoJ6ml7zQ2yeIvc6Bk+0sRYeaGT4R5Dhijl3pxiWN9a4riOVJzI8NppRIuBRhxuthXmR4VE+egzPm4+iMT7I/PBazbCKDI+AR8CjfER0+MuO1sjLJ/h9I8M7ksTwjlGHR8CjRMAj4FEi4BHwKBHwCHgEPEoEPAIeJQIeAY8SAY+AR8CjRMAj4FEi4BHwKBHwCHgEPEoEPAIeJQIeAY8SAY+AR8CjRMAj4FEi4B1f/k+AAQDJjrwQhWD6twAAAABJRU5ErkJggg==);\n background-size: 46px auto;\n }\n}\n/* Light theme */\n.fancybox-light a.fancybox-close, .fancybox-light a.fancybox-expand, .fancybox-light a.fancybox-nav span {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAADICAYAAACXpNOoAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpGNzRGRjc2NzEwNERFMjExQTc0M0U0NzZGQkE0MTM5RSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo1NjIzNzFGMDZBNTUxMUUyQkVBRUY3ODU0RDc4OTlCQyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo1NjIzNzFFRjZBNTUxMUUyQkVBRUY3ODU0RDc4OTlCQyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjE5QzZBQjVDNEU2QUUyMTE5NTdDREVCQjFFNDc0RjQzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkY3NEZGNzY3MTA0REUyMTFBNzQzRTQ3NkZCQTQxMzlFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+xE3ZhQAAC3lJREFUeNrsnXtMVNkZwO+8gEFEXFBBXSuLrAZHirrZbf9oGvFZqKQrfygBxCBs0ljTl6mb3W2axqai7rb43iauViVREv7gJT6ID4gSaxYrgom6rLLVqgjDMAwww2Pm9vvgXPdye+fOzH0MoOckJ4N37uN3v/u9znfOXHUsyzKTsemZSdooOAV/3cGNwg06nW7CQYp5PqMK58U7NZCnx31yd49X9EB38z5ZTSQeoJrh8SHQQ0k3kW2cCiLsMPQh6AOkD+I2kKJHyRM2ypQwHhcGPRx6hMlkmnrgwIEfQ/vp3LlzLREREXNgWwTuPDw87Ojv739itVr/ff/+/QsbN2681gcNgF3kpljZ+sPvfkgZgaOhJ5jN5verqqo+dzgcz1g/m9Pp/M+dO3c+jo2NnUHOpQ+UcYQzAHADkXAs9MV5eXlZHR0d37AyW29vb/OxY8feJ+c0aAXOQc+GnrJ3794/uFyuHlZhGxoastXV1W3wBS8XHB+lmUh6aXFx8Wdut3uIVal5PJ7B27dvbyLX0KsJbiI6bcnPzy8cHBx0sio3EETfuXPnPiDXUgUcJTAVDXHKlCkr29vbv2U1auB5mlJSUqLEpC4HHH30LOjvnT179rAfknPL+Y5rjx8//i25piJw9NfoixOMRuNqu93+wtsFQX3YnJyclwsXLmxvbm62C7+/d++eDb7ryMrK6sR9vbWBgYG2mJiYqbzIKwvcSHT7h7t27fpUSlKbN29+sWTJEtZisbCLFy+2tbS0vIJ/8OCBFVSgMykpiU1ISGA3bNjQJXWupqam9cLAKAau9xFsMIyHr1ix4gMJV+UGKTMQKZnQ0FAmJCQkKjc31w1R0tba2mqFvz16vT7aYDAw8MmAB2HAk3i8nS8uLm6dP0HJ6CPgoJWb4+PjF3qN/zqd4cyZMyaQeif8HYO5B9zM9K1bt1rhb5a3Dfe1V1RUGPR4B14apAvv+QpIvvJxLokyRUVFxUqdBPT3rZKSEh3YQid0lDoDEo7moFHAAN5dVlamS05OjpQ6Fxz7jj8S1/tIpkZS1bCwsHBfJ0pMTIw+efIkwncgPHZO0tBspaWlerCDSJ9Aev00oXEGYwQUtFqH3gfESPIPeUm/rxOhIULihWnsDOj4yek1fj0d0lkPeJseX+cBtbL7IwAp8FeDgO7u7hdSJ3n48GFXdnY2C7AxCAy+GsGtAN454rrAFuEGojIzM1nwQJLwcOwjcm3Z4G4ycnG2tbU9lHKHmzZtGuagIYjgxW3Hjx/XnzhxQsfBE32flpGR4ZZyh5Dufk2urUjiONTqv3Llyk0pd4jBB1JUDrr79OnThkWLFk1Hgz116pQeOK0Q8Ue8y7Jlyxgpd/j8+fML/kg8qCEfnkyHr5C/YMGCSKUhX5hkHZksSZZYWvtIq7QWxqLNaqa1YwYSBQUFH8GjdmkxkKipqfmRmgMJ/tAtDoduBw8e/JPaQ7fGxsZsLYZu/MHyHIQ/fPjwH8GLONWQ9K1bt3K0GiwL4VHylm3btuV1dHTIHsqBv74HWeVPtC5P8OHNIgWh5wEY4RNeQcjsTwqrBjin8ybibdBVJoSHhy89evToL+/evVva2dl5D3IbG9oBdvDNXTab7e6jR4/+WV1dvQmGZnHkWJO/SZ4YuE4IG0ARMmhFTzGBKgEPWplZq/o4S6RKp1Jk1ccny4QtnXWj4BScglNwCk7BKTgFp+AUfAINJGSOOzVvwgHO6yVxGaN8rlTBFXfcZADtYX2MBYO5JkusNIEVKZwE4KYVndAd+AlgblaDgaxeBegp0GdUV1cXuFyur4eGhpobGxs/gW1Y6w7RVOlllOG4lXA4mbqgqqpqt8fjGTPjsH///g/J93qxawRwLVFOo1JJA/RH6enpvweVGPP0Zs2aFc34MUMcLInzJZ0I6rEPp/6EFdnu7u7HycnJFma0uKnTQuKBnGwMdE1NzedYuBSBfpqTk7Ma9plJdHxcwTloNLjE8+fP/80bdFZWFq43mU08jaR+aw0+BvrChQvFYtA2m+2/mZmZabDP28Q1mogt+Nv1zNhKryLwMdCXLl3aLwZttVqfrVy5EiegUqD/gBldozgzgI6zE2jMODkbRm5EcpJWJ1o0/z6acfM+My9fvvzr1NTUXwlPCL7buW/fvq+6urq+i4yMdISFhQ3iyqCAgolezxqNRnd9ff03FRUVT2BTDwlibm+5ii+J4yxDHEAXiUlag/nOoWvXrv2ZPLFQJaqC0n6nv7+/gw1SGxgYwPUq8bz0QRTcr5BvMBiMTPCaW41cBU/irKurO8IEYdkSxLJh0PMvhPot6p/9Nc7a2tptq1at+o3QOHGFzaFDh061tbXdR+M0m80DUsaJhmi32509PT2DQuO8efPm04aGhnZinC4lxjkmWnoLPABhy87OLoR9lkKfL+EOZ/B6DK+jK3yLpAh+ucNAApBkqO/t7e0sLCzMhH3mMd9PwPoTcPSC4KPTIuRLJlcA/xLgMyZKyPeWg+8V5uDYHA5He0FBQRpRjdCJkB3+H3xlZWWRGDwY33cTKa31Br9bDL60tLSQ5DiajIDkjDlZ4qb6oHdkZGR8BWqzh1tUQC7iaWpqatPU9yuQAl/y8eXl5Z+AcT6F9KAdgshfmdHVRGatVMVXAPJ3/BlGcnAzrzzRi5+YO6lRVxFyKs1BOLVB0EFeQYhbp+LRSlOUSpzWDt/sMvNkWLNCVYWCU3AKTsEpOAWn4BScglNwCv6GD93oKD/YElciCd5T82vl0HitEJJqXGkOS81caQ5/Jo+lOZfSlUOaqAqRNk6lRDU0NPxucHDwbn9//7/Kysq2MKPzP7jWxaBTYkxKKqgSx6NAphUVFaXz54uwjl5RUYGV3AXMaJUXn7hOznW0NE7d/Pnz4/hguIpo/fr1OysrK7fyJc/IWUmkkcQRZOry5cuXOByOpyI/93XjNEwgkldjKsVfcJy4mpmfn/+znp6eZ2LwOAHmL3xQwHl6jt5kdm5ubpoXeA9OPcI+ib7glcxzvnrfSgCd+6XtvKysrPV2u13snXEenPT1BS9nhRDnj3H1TjQxqkBW/+D0OK4aSklLS8u12Wxir4Lw4HS7FLycFUIj0KtXr56zZs2ad+HpmqDrAlQnncvlCgF1mRoTExO/Y8eO/NDQ0DDhbhcvXvz7unXrcKXGSxKsFK0Qiq2trf1seHh4IAjrbDwA/xdm9Cf0ilYIoXHFO53OziCuELLBNfEFSOHjFYBkBy5GhZcf4XSfs76+vhj0eigYafeNGzf+IdRv0bvz1zjXrl37NhhootvtNsoxTlC3UDTOefPmJW7fvn2LCV9lJtjt6tWrR1JTU4vh73alxqmmO1yamZmZD/BWMaMEB3CQuMMof9xh0ALQli1bfgF5y0sxaFxByoM2qRGAVAn5eXl56SBp0cCDa3WlJD0eSRYuwZ4Jkl4H0M99RMuoCZFkEYCIpKSkxRDiv/UC/YU/yVWwwVFNokpKSvLlJlXjOQJiW1tbnwpWDrEIDcnWlyQf6WPkvmhaQ1VBw5xz/fr13RjG+/r6XpaXl39KwnlA40052aGSugr34mnhyqE+8jlSnpC7QkhLcGFBiHtJjKyCkOrgtHb4RpeZ6QohCk7BKTgFp+AUnIJTcApOwSk4BafgFJyCU/DXFzzgxWQ6nS4dPixevt7D/4fIm7Z3ejmuBfY9FxCIr5+fi9S+d4pNZeN2X+eWOjZQDjVVpUWlfbRRFcGj/5j3T4tQhcTK1fxjQHJF4wKu5OKCm6ZeJWBpwbafS3gbvveoVkPqcsD5Lo/vSSwAFebjhi0CNdtDIycFp+DqGafXfENofL4iJz93CdRQZblDLugIomC1GuehqqJ16FaSa7zxae2EV5UWL+rRovGxY1V0svxvNDRyUnAKTsEpOAWn4BScglNwCj5x2v8EGAAYJEdp3vkt5wAAAABJRU5ErkJggg==);\n}\n\n.fancybox-light-skin-open {\n box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);\n}\n\n@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-moz-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 2dppx) {\n .fancybox-light a.fancybox-close {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFwAAAGQCAYAAAAjsgcjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpGNzRGRjc2NzEwNERFMjExQTc0M0U0NzZGQkE0MTM5RSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEMEQwOUQ1MjZBNEUxMUUyQjJGNkY3NDBEMEE5NDY5NyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEMEQwOUQ1MTZBNEUxMUUyQjJGNkY3NDBEMEE5NDY5NyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjE0QzZBQjVDNEU2QUUyMTE5NTdDREVCQjFFNDc0RjQzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkY3NEZGNzY3MTA0REUyMTFBNzQzRTQ3NkZCQTQxMzlFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+z3OoagAAHXpJREFUeNrsnQl4VEW2gG93J510OkASQzCQjMQl8IZN1iCjAREHCMoDGRHQECBsEuAhIomCTxAElcGERRg/UBwdBgOouMAoH09kcWNk2CKrGBCSEEIWyNadrd+pTlVSuXQnfZf0lnO+r75Op/v2vffv06fOOVV1SmOxWAQU54kGgSNwBI6CwBE4CgJH4CgIHIEjcBQEjsBRELhHA9doNEhKJHIV1Z2As5No6d/i1uB+bbQa7jUE3ghg8qijoHWiphV9AYIIMGnVosb+Z2nOL8BlwKWeWFP7YRoOsA80X66x5zx0e8AZ5EpoVfSxknvOvgCLxc6FylUmtwfOgWYg9bT50eZLn1uht2rVynfRokV/jI2N7REeHn5vmzZtIgwGQ1tfX1+jTqczks+srq4uraqqKqmoqMgtLS29XFhYeCYjI+PHefPmHc3Ozi6Dt1TQxr6Y28A7G7j1wKaakuM5bSaa6w+tNbS20CKhRUPrBq0PtAHt27cfkp6evuzy5cuHKysrSywyBb6E4oKCgq+PHz8+e/DgwR3oOf3pNWiZoinx0BzhZpNHcwLnNJpobiC0UAq6E7T7ofWHNnDAgAFjfvjhh61ms/mWRWUB+IWg7WlLliyJptegp9ek8SrgFDbRKAO0IGjtod0LrQe0B6A9HBUVNRJAp4M2l1uaWYj5uXbt2prp06eH02vyseH9eCZw+rMltthItfouaF2g9YM2CNrQjRs3vlpSUnLd4mSBLzfr7NmzT9Nr86XX6pnAOXvNTEgYtHuo+fgTtCHQAY4+duzYbouLpaio6F3Q9lB6rVqp2u4uwBnsVtDupJ1ib2KnoQ175JFHEvLz83+zuIlAn3Fq586d93HQPQe4CHY47Rj7ElsNLe7pp5+eBSYk1+JmAp3q799//31PqdBdCpz+HH2pGbmTwib2ejC0EU899dQsk8lUZHFTgQ4178cff+xO70Hj1sA5b8RIbXY01Wwr7KFDh04Fzc6zuLmApl/dt29ftKPei6uAMz/bQL2Re6jNJmZkRNu2bce6k81uSiBiPQlRahDz05sDuNLQnrl/BHgbaMH0kWi7H3gjM++///4/e1LatbS09N3AwMAkmo+pUTu01yq4Ng0HPIDabyOFr1+3bl1/T4NNxGg0JkKANEqOq+gM4Cw/YuRhd+rUKXDKlCnTPHVwAUxh2gcffBDiTsD5HImBangAzfr5bN68+YmAgIBgTwWu1WrvHDVq1EJHbLmzgfuJYPv26tWrTf/+/YcrvTAIwctccSwTsOMz9+7d29ZdgLMgx59quD8bNEhNTR3h4+PjL/eCCgsLBQiSTF27dtXPmDHjkpTOibw3KSnpUrdu3bTg+5sKCgrk20uNxgiKM1eh2VUFuNic+NO/fYKDg31jYmL+rAR2YmJixblz5/zBJPkcPny4Y0JCQpYj0Ml7Zs6cefWnn37qCMf6nz592n/cuHEVSqBDBzpt4cKFBjW1XC5wH26kho3WaJcuXdrLz8+vlVzY06ZNq8jNzdX7+/sLBoPB2v7zn/90mDhx4tXGoFPN/v3UqVMR7FjymJOTowdNlw0dbHnI/Pnz41wNXMcNh/lxCX3t8OHDY+VeCAQc5QSQr6+voNfrrQ2+PCs88Ocj7EFnZuTEiRN/YMexzyCPV65c0U+ePNkk97qCgoIm0PtzCXDe92awrcNWoaGh+o4dO/aQcxFkXPKXX37RkQALtMradDqdFRiDfvz48YhJkyY1gE7+nj17dubJkyc7kveSY9jx7LPIIxyrgShSVkcKX9wjS5YsUc2saGXab36U3ardYA7uldtZwnGBAwcOvFhTUyOQZg2BARQBCK9ZoRMTQaCDjb/CwuQ5c+ZkgmZHkfeQ95JjyP/Z51RXV1sfhwwZkgPgAuR2nvAL6asWcKmhvY66gME0dxJMI0zfL7/88r9HjBjxjJIhKwB4AczHfUxbGUACDn4F1kb+7tu37yWAXAP2/W4xbPI6uIWC2WwWysvLBYh2r/7jH/+IUDK35ubNm4vAtLwh1I78OzW05zXchwsMNJGRkeGKvnkAsm7duvvAjz/PwPKazswL0XToHDuCZt9t74sB8yGYTCYBPksxbCJwnmhXmxS+WYFDONxB8c8NwKxduza6Z8+eNqETbSaQSbOl2eQYptnwGVchPI9QY9YYnKuTK4FrBRtT0Fq3bh2qio0TQSc2mP2fdYh8x0iEvIfBJpqtJmwKPMLVwMXz/khvblTLdWLQ+/Tpc451ovxrPEjWSTJTojZses4gVwK3OaMVfuYGNUNgAiw1NbVTv379ztobCGH/Zx5J7969r/7973+PUHvyKXxeoKuA24Pu1RPIyXQWVyevbAUv5SrfpABh9fkjR450FpsRsXlhgdLRo0dvC45UupZSVwIXT4S3/g86rFI1Yc+dO/fXf//739F858ibER46eQ/xWkg4D755RFO5FxnXU+Iq4LZgW+XWrVs31IINAdBvEACRyNUKk+8c+cagMuDMT6e5lyy1oJPpcYJKE/vlAGcT4dkKBOuFXL9+PVst2BDC323PzyZRJGn2/HQu4dVBLehwvvOuBs7Dtl7I1atXs5XCJokoANVouE787B49elyAkP08+Z8t6MS0EE0nqd34+HjF0OG8F1wJXLymxgr98OHDvyq5kAULFpwH2FH2wnUWQXbv3j2TpADS0tLsRqR8ihf6gQ5Tp069rOTacnNzj7gaOL+Gxgp806ZNF+HmZeWdSXr2wIEDHfkIUgybRpC/b968OYp5J/bSAHyKlzzu27fvTrnpWeKhvPbaa0ddDbxKDD0/P78iMzPzpNz0bJcuXarEqVVR1u/Kli1b/sB7LBz0C8y88B0qe4RjLXLTs2VlZd9u27atzB00nLW6lWJ79uw5JPdCwEQEhIeHmwk4EqKTJkpERdrzxQH6fQD1IjuOfQZ5jIyMrIAvSvagdlZWVrrQcBmisqhVxlQ3trIhhDaSEyfa4xscHOyXk5PzN/AUAuVcDBnXnDJlivnKlSt+RFsJNJJidSQ3QgeRL0Hw05FoNoENX2DFRx99pA8JCZEFB66hMC4urvPevXsLqXI1OJ9s70DiZE4tBU7SsWQFGpls/xi0J6CN/fbbbz9RMqGyoKDAMn78+LLo6OjyadOm/QbwHD6WvHfWrFkXO3XqVP7kk0+WgZlTNLnz2rVrafRetXK4qTV7lqgaGc8k6ViSmCcr0YZCI/Px/gI/7alqLJIC7S5xxbH8IqwVK1ZE03vVqAVc7uxZH2pGgjizYqQXpzt48OCEhx566L89OWEF2r0BTNKLpN+kzoGghkmRm7winSRZ4VtOm4nvQBMTE3dB717oqbDBzbz+6quvrqb3WKPmZ8sFzrwVM9WAMvq3dU71hQsXysAzeM9TgZ88eXLxxo0bb6jpnSjxUvgviy0PDBbqJ+MbqCejO3Xq1LNdu3Yd5Emw8/LyPg4LC5sJf5Y0puGumJBvobaNmJNS2lhBAatpGTZs2BbwFC57Cmzw+c8lJCQk03uqEpqh9IdS4DXUjJRRjSilNt0KHYKGsnHjxr1RWlpa4O6wwbPKffPNNyf961//yhfql5uoX2ulORdVQRsN7ckxY8b8j8lkuumui6kAdsGqVasG03swCM24qErtZYPtBNGyQQr9LxMmTHiuuLj4urvBBjOS/dZbbw2j124U3HzZoLiYAVvy3WBhLIMeGxs748aNG5nuAhsU4CxEpg/Sa24lSCh24Kplg3VfCLyHFaHxo55La9oC6c/UOq0ZPAD/PXv2xPfu3XuoK212ZmbmjpEjRy7PyMjIo/2PmXaUNY4Cd7ZbeNuJRdCNFHgrEXTr9ObU1NS+06ZNm2I0GkOdCRr6klzoGN944okndsPTW7SjlwTbnYBrOJuup+F/K9rYskK2YkIXERHhv23btjFkEZaSdUEOZv7Kz5w5s2PixIl/O3bs2HX4VzHnxjIX0OJRwEWazq8DMgr1C2cDOOhWbScr39LS0kbExMQM1ev1gWqCBg+kGMzGrpSUlA/37t2bbct9lRO+u11VN6rtbGozW17IgJPGFmPVTeoPCQnRk3VCcXFxAyMjI7vLnT5XVVVVlp2dfezAgQNfJScnH8zJyblJtblUlIaQHbq7ZRk9Cp3XdrbMMECoXwHHL12pmwJtMBh0SUlJ9w4ePPiPUVFRd8GXER4YGBgCv4BWYH78ampqqomZIBOQwLUrKiwszIZA67dDhw6dAJ86o6SkhCXVyilk9rxOq4mn4nV1C0WFIZlt9+Pg+3HQfcXgOTdNXCjSIjScRcDGWSuoBps5yGbOVjcoHOlxwKWcS7BfKFLPNR66o6VQedgVHPTbCkWqFa57Uu1ZJaVQLaL0MAPeZClUtfMinlpdmdf65ij222yVlrGctZ1JpgjcSwSBexNwFBXtJgJH4AgcBYEjcBQEjsBREDgCR+AoCByBoyBwBI6CwBE4AkdB4AgcBYEjcBQEjsAROAoCR+AoCByBoyBwBI7AURA4AkdB4AgcRSFwXGB1u0hhiMBbOHB7C2JtbmWDwJWD5pd/swIHRPgiBqoXKvAo4Eo7XVHZJtJYDRU/ob6kHatzKy7FUVeGQ8H5Ww5wEWwCmNRPCeSanr5OAJMiM8VCfa0qa2EwUqfdk4BrXfUztAGbACa1yO8cN25czOnTp/9qMpm+qKqq+jonJ+f9jRs3joHXwoTamuWsoLBW42m9uOTKkgqPZ4V4hPrqzKTiW3tof4Q2cN68eS8C6FJbhR337t37AbznAWh30y+HHK+VW7RRrRhE9cqcagK3ATucwn541qxZiwB2eSN7PNTMnDlzGry3q1BbujQAgcuEPX369EXl5eWlTZUvPXTo0Mfw/j7QyLa5Rk8DrnWxzSZF3tslJib2T0tLe9Hf37/JzY2Cg4PbCg1LM3mUaF0NOyEhoe/atWsXGQwGh/ZUvnnzZr5QX35JQOBNwzZS2GHPPPNMnw0bNrwcEBDg6AbWlo8//ni/IKNWbIvwUkQ2m2j1ndRmDxo7duzzxcXFt6SUnz548CAp0BsL7V7qpfhhp9k47P8irt+YMWPm37p1S1LF/J9//vmQTqcbDsd3p25kIItEWzxwG7DbMdijRo2aB3a4SCLsH/z8/EYKtdsd/EGo3U1FsQ/uFcA52L4c7M7EFDz++ONzAXahFNjHjh07AjaebDtGKu5HUVPiTz0VTYsG3hjs4cOHzy4qKiqQAvvkyZNHwXsZTWGz6NKghinxFuAMtpGH/eijjyYVFhbekAI7IyPjWGBgIMmfxFDYd6gN26OBi2CTJBPZeCN2yJAhzxYUFORJgX3mzJkTISEhT4pgB6gN22OB24H90KBBg2beuHHjukTYZ4KCguKF2n06iQvZQajfzZDVHG/Oxld79hEa1r9VDNxHhcCGL8hupOnTsAEDBnTesWPH0jvuuKOto591+vTpiw8++ODbYOvJZhiV9Cb19GX/RkZ5NA7+r1FF5UaX+L2fq4SGG24rCraUAteKtNsKu1+/fp127dq1LDQ0NMzRDzp16tTVhx9+eBvY+kp6XQZ6g/4OhPIaBaDF0PkS2SausVEmQQl0JcBZyO5L4ZAtZEJjYmKiv/jii1fbtm3bztEPAm8kb+DAgV+DZrPtf6vpT9ssNF3/2xZsjQLgTLNJdf1SbpSpRKjfN1QjdzxVyRCbltNEEoi069OnT+fdu3evDAsL6yDlM00mU1V1dXUNfDbZk4FtFSD5hnx9ffU6spm9QiH7S0AknH/ixIkDCQkJWy5fvpwF/yYb+N0S6ncirJE1zKig09RSz4GYjS5RUVEjs7Ozf7N4meTk5Fy45557htNIOYwNerjCS/GhZoSE2v3279+/w+KlQgc9+tJ7bS02xc4agOCjSkPPnj1jBS+V7t27x/ID10o6ZqX58LpdS8geO94KHO4tWKifmKRolEkp8Do3qqysrMhbgZeUlBSKfHGXAGewiX9qAtfuO28FnpGRcZhzCZVt3auCl0L87a4gT+Tl5V31tg7zxo0bl+HeHqNpBpd6KWyAgUSXdxFPZdCgQYn5+fm5ngqXzHspLy8vIxORbt68ef3777/f1atXr8fpKFME9VD0SoArCXz4UZ26geHBgwd327lz57Lg4GCHNybNysoqgS/r819//fUqPCWj8jdplFehht2UYCL5nczZ9vElQv1GpyzEb2BWnDmZU5y4sk59GDJkSJft27cT6Hc4+rlXrlwpgOO2nD9/PhOekm1zi+hNVnI5DIsToNdwCSs+l1LJ2fAaGxlTpwAXQ2fzTcKGDh3aPT09fWmbNm1CJEC/NnDgwLcyMzN/46CXCAr3vpSQKZSVLXRWaG8rAGowrBYXFze3qKhI0hjm77//fjkqKipRqN0xvBu0SDq0FijUb3zqsflwtQYg7I3Sx8oZpb906dKFyMjI8ULtTNl7SBaSG/FRPFLvLUNsduehjB49+rlbt25Jgn7hwoUzISEhY+H4/hR6swyzecuo/W3QyUwrgC5pptWZM2dOAvS/cGObbNReJ+CofdPT28aPH/9CMYiCqRI4L8XBeeB10OPj4xeWlpaWSIF+9OjRH3Q6Hc68auxkQiOT7ydPnvyiVOhHjhw54OPjM4x6LuHU78e5hY5Cnzp16kuOrHjg5ZtvvtlFpl/QThTX+EiEPnjGjBmLTSZTmZRcRxIIzW3gGh+Jq9a6EOjA738bW0hlQ8s/EmrX+HQQcI2P3QtiiaEqOvWBhOskqZ/79ttvH05OTn7TbDabHPmsoKCgEEeiP3cVH2ediECneRiWFKpLDaxZs+YAeCGalStXLtTr9X6NfU5eXl4ON03B84q9uHidZmtqXsi6y8EpKSmvVlRUmO2Zk+rq6sqnnnpqIjVHYTQIQhsuEzqBOOjll19eSsyLrT5z165dm2jUGUWzknp0C5VBJ2mAAZMmTZp57ty5H8nIS2VlZUVWVtaZ1NTUV8hr0KK5oS6P88PdtZpEK+qBsGoSpKMtpyMvxfRvj6wm4a71Uvy5fLSGdpIVAtZLUU3EFYHYpBusCIQ1r7wLuEcKAkfgCFw2cBSFnRQCR+AIHAWBI3AUBI7AURA4AkfgKAgcgaMgcASOgsAROAJHQeAIHAWBI3AUBI7AETgKAkfgKAgcgaMgcASOwFEQOAJHQeAIHAWBI3AEjoLAETgKAkfgKMqB41r72wWLGyDw5vl1co9NFbSxIHDlsOv2gRPqSzaxSqOsTBMr2VTTnOA9qsiYZNINi5KRQmRsoww/Cp0vuUoa23DUZlGyFlfVTQZwtlMtAc22Bm5F/9ZT4KTqG9tel9S5rSu7J4bubOBawYOEanfdHp4C3fR68+bNY69du/Z+VVXV1yaT6Ytffvnlzfj4eFLBk1Tmv4N+If70i9JoXGkXXVWZU2YVTVbJk1RYJptwPLB///6PbNWpNZvNZSkpKaSa58NCbZnV9kLDvdQ0LaoUqgLgbIfDbnPmzHmWFHG3VxwYoJuTk5OXCfWbMN0GHYE3DZyUSCU7//X57rvvPm2qwDup1gzQX4P3P9Jc0KXcg4/gecLsuJYWb29UyNbry5Yte4HUJ1+xYsU3opeZByMITio86YnA2QZ0NXl5ebmOHADQfZcsWbJAC7J8+fJ9osDJudA90KQYmA2fMGFCIngmVY7uHwHmpWLx4sWvw7FDqHnpoIZ58XYbTuAEUy/lTzt27HiXlLSWAv2VV155g0LvrgZ0bwbOIkwj1XKyPc2Q7du3b5UKfenSpW/CsY+qAd1rgYu0vDX1VnpAG5aenv5PKdBJ5X2A/lc1oHs7cOal+NFIk+zN1hPa8G3btkmFXgkejGLoXg2cg66j4TqD3otA/yeIFOjQ5yqG7vXAG4Fu1fStIFKhg7u4moPOtlT3cwS6qzcwrQtMhPotBtRu/NYFehrukyQV2W6GbBs24sMPP/xnI1G/LehVEBilwrF/lgrdqZEml5/WiCBrnZiNZF9ENU3FFsfHx+8CZ0Q/efLkMY4kByES1S1cuHAOxEaalJSUPdxLxfSxUo3gSClwfuTFh6ZN9fTRtxmgW5oI95nGE6lKTEz8v/LycsOsWbPiHIW+YMGC2SQN8MILL+wWndeiRkSqBnAG2p/6xwZuMMBXxaycRQJ0A70e3ezZs38uLS0NBICxjkJ/7rnnksgvF+B/Qf9dI0oDuAQ4f4MB1N61CQsLC503b16/yMjICPh56sGOkr3SNArNlqWsrKzSZDJVsOd2bKn1F1ddXa0j5sRsNhugBeTm5lYfOXIkNyYmpp1D9gkE7mEWXL9l/vz5nwn1m+0pHx9V0GkyX5gNBvRbvXr1yyUlJYUWLxHSka5bty5NqN2l9l56r35iM+ksL0VHTQjJL3dftGjRPLIboMXLhEB//vnnn4N7vJ/eq1Go39DJqcB9qBkhrtiAS5cuHbd4qVy8ePGYULvxXhS9Zx+5wLUKbThzx/Tt27fvLHipREREdKamhM1/kd0nOcNl83hRc5RfqxAw67krsrOzz3krcLi3C0L9DoeKtgZWCpzNcCp9//33P1C6t6VbjufBPcG9bYU/ywRuMpErhti0NLhgbmHMpk2bVkJkV+wtnSXEENXvvffeBri3WGj30XyNvxK3UMlUN9Zp+lFXicxuCrrrrrvCkpKS+oaHh7dXK/CRIuR8JPCprKz0haDHnwY/xsmTJ3fr0KGDUYpmb968+d3p06dvh6dkp/F8oXba3G1a7sy5hVoutDfQiDOAC+19BOftP8/ndMj529BfX1h6evpjY8eO7SYF9jvvvPPus88+uxOeXqOwi7nQvkas4c7KpVi4b5tNoiwTwda6CDb55VV/8skng0aPHi0J9oYNGzbPnj37E3hKpmEU2tNsVySv2MlZjqGSXpiz0rMaG0krdk8+n3322UiQB6TAXr9+/aa5c+cy2AVC7cbXJnpvyueYe+gAhE40AEFscyjL6UAb+SWI1A5y7dq1G+gABBmYjuR+KaoNQHjLEFswN64Z9/nnn++SAhs62eo1a9bIgt3SB5HjPv30050SYVelpaW9zcGOkAK7JU+TiNuxY8d2qZnA1NTU9UpgtwTg/ESgDkL9RKBtUmGvXr16nWjQWDJsrwbODemxSflkqtsjAPtDidMiVIPdEoDzkzkHbN269R2psFetWrVGLdjeDpxNVw6D1hUCmonAr0IK7Ndffz1NTdgtAbiR2u7eX3311QfOmOijJnCPWjYoyuHo2oE48mbi+oFmr3nppZf20NwIiyDNqkWQTgrtXSUkjVBVWFiY7yDstYsXL/6KhuviRJTTYKse2jvZhndJSEiYTKLExqYjL1++fJWg4mqHluylkBH0mN27d2+x5aWQ5YIrV65cIdSv0bwNNi6MleaHEy2PJq7h+vXrl2ZlZZ0lqxrMZnPp2bNnf5o6dWoSvPYn6qvbXIXsCuCeXNzAj4JvRVuAcHtxgxKhvrhBnc12ZXEDbyjf4SfUl/BgM6IqKXQT54l4R/kOF0nLLVDjYug8fCzB1FIEgSNwBC4bOIrCjgeBI3AEjoLAETgKAkfgKAgcgSNwFASOwFEQOAJHQeAIHIGjIHAEjoLAETgKAkfgCBwFgSNwFASOwFEQOAJH4CgIHIGjIHAEjoLAETgCR0HgCBwFgSNwFASOwBE4CgJH4CgIHIGjIHAEjsBRPB24RqMZQf/sKvHQNxp7sanrhvMmSzxfBv3c3c3JQ4s651xxRoX8rlRzXnfwF5Gi5sllnBc1HDW8eSXDzT4HNRw1XJ73ktKYzW/Kq3G0Bq698zhq21HDUcOd40U44ZeFGu6NgsARONpwp9pOeN9jjngpjvrh0Ed86U62HDXcCzXcXtYvuTE/HDTTX+EvqmsT3tEbqOHYaaIgcASOgsAROAoCR+AIHMVDI01Z80OaihQd/ZxGItFkV0SgqOFeqOFMc14XaZi9scYv3el6UMOx00RB4GjDG/UWUlDDUbxPw+3NR+E0XpX54a6aYYUajsAROIqX2PAMid5IhoefFzXcnQSXDSJwBI6CwBE4CgJH4CgIHIEjcBQEjsBREDgCR0HgCByBoyBwBI6CwBE4CgJH4AgcBYEjcBQEjsBREDgCR+AoCByBoyBw95f/F2AAPX2XGJHD060AAAAASUVORK5CYII=);\n background-size: 46px auto;\n }\n\n .fancybox-light a.fancybox-expand, .fancybox-light a.fancybox-nav span {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFwAAAGQCAYAAAAjsgcjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpGNzRGRjc2NzEwNERFMjExQTc0M0U0NzZGQkE0MTM5RSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEMEQwOUQ1MjZBNEUxMUUyQjJGNkY3NDBEMEE5NDY5NyIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEMEQwOUQ1MTZBNEUxMUUyQjJGNkY3NDBEMEE5NDY5NyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M2IChXaW5kb3dzKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjE0QzZBQjVDNEU2QUUyMTE5NTdDREVCQjFFNDc0RjQzIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkY3NEZGNzY3MTA0REUyMTFBNzQzRTQ3NkZCQTQxMzlFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+z3OoagAAHXpJREFUeNrsnQl4VEW2gG93J510OkASQzCQjMQl8IZN1iCjAREHCMoDGRHQECBsEuAhIomCTxAElcGERRg/UBwdBgOouMAoH09kcWNk2CKrGBCSEEIWyNadrd+pTlVSuXQnfZf0lnO+r75Op/v2vffv06fOOVV1SmOxWAQU54kGgSNwBI6CwBE4CgJH4CgIHIEjcBQEjsBRELhHA9doNEhKJHIV1Z2As5No6d/i1uB+bbQa7jUE3ghg8qijoHWiphV9AYIIMGnVosb+Z2nOL8BlwKWeWFP7YRoOsA80X66x5zx0e8AZ5EpoVfSxknvOvgCLxc6FylUmtwfOgWYg9bT50eZLn1uht2rVynfRokV/jI2N7REeHn5vmzZtIgwGQ1tfX1+jTqczks+srq4uraqqKqmoqMgtLS29XFhYeCYjI+PHefPmHc3Ozi6Dt1TQxr6Y28A7G7j1wKaakuM5bSaa6w+tNbS20CKhRUPrBq0PtAHt27cfkp6evuzy5cuHKysrSywyBb6E4oKCgq+PHz8+e/DgwR3oOf3pNWiZoinx0BzhZpNHcwLnNJpobiC0UAq6E7T7ofWHNnDAgAFjfvjhh61ms/mWRWUB+IWg7WlLliyJptegp9ek8SrgFDbRKAO0IGjtod0LrQe0B6A9HBUVNRJAp4M2l1uaWYj5uXbt2prp06eH02vyseH9eCZw+rMltthItfouaF2g9YM2CNrQjRs3vlpSUnLd4mSBLzfr7NmzT9Nr86XX6pnAOXvNTEgYtHuo+fgTtCHQAY4+duzYbouLpaio6F3Q9lB6rVqp2u4uwBnsVtDupJ1ib2KnoQ175JFHEvLz83+zuIlAn3Fq586d93HQPQe4CHY47Rj7ElsNLe7pp5+eBSYk1+JmAp3q799//31PqdBdCpz+HH2pGbmTwib2ejC0EU899dQsk8lUZHFTgQ4178cff+xO70Hj1sA5b8RIbXY01Wwr7KFDh04Fzc6zuLmApl/dt29ftKPei6uAMz/bQL2Re6jNJmZkRNu2bce6k81uSiBiPQlRahDz05sDuNLQnrl/BHgbaMH0kWi7H3gjM++///4/e1LatbS09N3AwMAkmo+pUTu01yq4Ng0HPIDabyOFr1+3bl1/T4NNxGg0JkKANEqOq+gM4Cw/YuRhd+rUKXDKlCnTPHVwAUxh2gcffBDiTsD5HImBangAzfr5bN68+YmAgIBgTwWu1WrvHDVq1EJHbLmzgfuJYPv26tWrTf/+/YcrvTAIwctccSwTsOMz9+7d29ZdgLMgx59quD8bNEhNTR3h4+PjL/eCCgsLBQiSTF27dtXPmDHjkpTOibw3KSnpUrdu3bTg+5sKCgrk20uNxgiKM1eh2VUFuNic+NO/fYKDg31jYmL+rAR2YmJixblz5/zBJPkcPny4Y0JCQpYj0Ml7Zs6cefWnn37qCMf6nz592n/cuHEVSqBDBzpt4cKFBjW1XC5wH26kho3WaJcuXdrLz8+vlVzY06ZNq8jNzdX7+/sLBoPB2v7zn/90mDhx4tXGoFPN/v3UqVMR7FjymJOTowdNlw0dbHnI/Pnz41wNXMcNh/lxCX3t8OHDY+VeCAQc5QSQr6+voNfrrQ2+PCs88Ocj7EFnZuTEiRN/YMexzyCPV65c0U+ePNkk97qCgoIm0PtzCXDe92awrcNWoaGh+o4dO/aQcxFkXPKXX37RkQALtMradDqdFRiDfvz48YhJkyY1gE7+nj17dubJkyc7kveSY9jx7LPIIxyrgShSVkcKX9wjS5YsUc2saGXab36U3ardYA7uldtZwnGBAwcOvFhTUyOQZg2BARQBCK9ZoRMTQaCDjb/CwuQ5c+ZkgmZHkfeQ95JjyP/Z51RXV1sfhwwZkgPgAuR2nvAL6asWcKmhvY66gME0dxJMI0zfL7/88r9HjBjxjJIhKwB4AczHfUxbGUACDn4F1kb+7tu37yWAXAP2/W4xbPI6uIWC2WwWysvLBYh2r/7jH/+IUDK35ubNm4vAtLwh1I78OzW05zXchwsMNJGRkeGKvnkAsm7duvvAjz/PwPKazswL0XToHDuCZt9t74sB8yGYTCYBPksxbCJwnmhXmxS+WYFDONxB8c8NwKxduza6Z8+eNqETbSaQSbOl2eQYptnwGVchPI9QY9YYnKuTK4FrBRtT0Fq3bh2qio0TQSc2mP2fdYh8x0iEvIfBJpqtJmwKPMLVwMXz/khvblTLdWLQ+/Tpc451ovxrPEjWSTJTojZses4gVwK3OaMVfuYGNUNgAiw1NbVTv379ztobCGH/Zx5J7969r/7973+PUHvyKXxeoKuA24Pu1RPIyXQWVyevbAUv5SrfpABh9fkjR450FpsRsXlhgdLRo0dvC45UupZSVwIXT4S3/g86rFI1Yc+dO/fXf//739F858ibER46eQ/xWkg4D755RFO5FxnXU+Iq4LZgW+XWrVs31IINAdBvEACRyNUKk+8c+cagMuDMT6e5lyy1oJPpcYJKE/vlAGcT4dkKBOuFXL9+PVst2BDC323PzyZRJGn2/HQu4dVBLehwvvOuBs7Dtl7I1atXs5XCJokoANVouE787B49elyAkP08+Z8t6MS0EE0nqd34+HjF0OG8F1wJXLymxgr98OHDvyq5kAULFpwH2FH2wnUWQXbv3j2TpADS0tLsRqR8ihf6gQ5Tp069rOTacnNzj7gaOL+Gxgp806ZNF+HmZeWdSXr2wIEDHfkIUgybRpC/b968OYp5J/bSAHyKlzzu27fvTrnpWeKhvPbaa0ddDbxKDD0/P78iMzPzpNz0bJcuXarEqVVR1u/Kli1b/sB7LBz0C8y88B0qe4RjLXLTs2VlZd9u27atzB00nLW6lWJ79uw5JPdCwEQEhIeHmwk4EqKTJkpERdrzxQH6fQD1IjuOfQZ5jIyMrIAvSvagdlZWVrrQcBmisqhVxlQ3trIhhDaSEyfa4xscHOyXk5PzN/AUAuVcDBnXnDJlivnKlSt+RFsJNJJidSQ3QgeRL0Hw05FoNoENX2DFRx99pA8JCZEFB66hMC4urvPevXsLqXI1OJ9s70DiZE4tBU7SsWQFGpls/xi0J6CN/fbbbz9RMqGyoKDAMn78+LLo6OjyadOm/QbwHD6WvHfWrFkXO3XqVP7kk0+WgZlTNLnz2rVrafRetXK4qTV7lqgaGc8k6ViSmCcr0YZCI/Px/gI/7alqLJIC7S5xxbH8IqwVK1ZE03vVqAVc7uxZH2pGgjizYqQXpzt48OCEhx566L89OWEF2r0BTNKLpN+kzoGghkmRm7winSRZ4VtOm4nvQBMTE3dB717oqbDBzbz+6quvrqb3WKPmZ8sFzrwVM9WAMvq3dU71hQsXysAzeM9TgZ88eXLxxo0bb6jpnSjxUvgviy0PDBbqJ+MbqCejO3Xq1LNdu3Yd5Emw8/LyPg4LC5sJf5Y0puGumJBvobaNmJNS2lhBAatpGTZs2BbwFC57Cmzw+c8lJCQk03uqEpqh9IdS4DXUjJRRjSilNt0KHYKGsnHjxr1RWlpa4O6wwbPKffPNNyf961//yhfql5uoX2ulORdVQRsN7ckxY8b8j8lkuumui6kAdsGqVasG03swCM24qErtZYPtBNGyQQr9LxMmTHiuuLj4urvBBjOS/dZbbw2j124U3HzZoLiYAVvy3WBhLIMeGxs748aNG5nuAhsU4CxEpg/Sa24lSCh24Kplg3VfCLyHFaHxo55La9oC6c/UOq0ZPAD/PXv2xPfu3XuoK212ZmbmjpEjRy7PyMjIo/2PmXaUNY4Cd7ZbeNuJRdCNFHgrEXTr9ObU1NS+06ZNm2I0GkOdCRr6klzoGN944okndsPTW7SjlwTbnYBrOJuup+F/K9rYskK2YkIXERHhv23btjFkEZaSdUEOZv7Kz5w5s2PixIl/O3bs2HX4VzHnxjIX0OJRwEWazq8DMgr1C2cDOOhWbScr39LS0kbExMQM1ev1gWqCBg+kGMzGrpSUlA/37t2bbct9lRO+u11VN6rtbGozW17IgJPGFmPVTeoPCQnRk3VCcXFxAyMjI7vLnT5XVVVVlp2dfezAgQNfJScnH8zJyblJtblUlIaQHbq7ZRk9Cp3XdrbMMECoXwHHL12pmwJtMBh0SUlJ9w4ePPiPUVFRd8GXER4YGBgCv4BWYH78ampqqomZIBOQwLUrKiwszIZA67dDhw6dAJ86o6SkhCXVyilk9rxOq4mn4nV1C0WFIZlt9+Pg+3HQfcXgOTdNXCjSIjScRcDGWSuoBps5yGbOVjcoHOlxwKWcS7BfKFLPNR66o6VQedgVHPTbCkWqFa57Uu1ZJaVQLaL0MAPeZClUtfMinlpdmdf65ij222yVlrGctZ1JpgjcSwSBexNwFBXtJgJH4AgcBYEjcBQEjsBREDgCR+AoCByBoyBwBI6CwBE4AkdB4AgcBYEjcBQEjsAROAoCR+AoCByBoyBwBI7AURA4AkdB4AgcRSFwXGB1u0hhiMBbOHB7C2JtbmWDwJWD5pd/swIHRPgiBqoXKvAo4Eo7XVHZJtJYDRU/ob6kHatzKy7FUVeGQ8H5Ww5wEWwCmNRPCeSanr5OAJMiM8VCfa0qa2EwUqfdk4BrXfUztAGbACa1yO8cN25czOnTp/9qMpm+qKqq+jonJ+f9jRs3joHXwoTamuWsoLBW42m9uOTKkgqPZ4V4hPrqzKTiW3tof4Q2cN68eS8C6FJbhR337t37AbznAWh30y+HHK+VW7RRrRhE9cqcagK3ATucwn541qxZiwB2eSN7PNTMnDlzGry3q1BbujQAgcuEPX369EXl5eWlTZUvPXTo0Mfw/j7QyLa5Rk8DrnWxzSZF3tslJib2T0tLe9Hf37/JzY2Cg4PbCg1LM3mUaF0NOyEhoe/atWsXGQwGh/ZUvnnzZr5QX35JQOBNwzZS2GHPPPNMnw0bNrwcEBDg6AbWlo8//ni/IKNWbIvwUkQ2m2j1ndRmDxo7duzzxcXFt6SUnz548CAp0BsL7V7qpfhhp9k47P8irt+YMWPm37p1S1LF/J9//vmQTqcbDsd3p25kIItEWzxwG7DbMdijRo2aB3a4SCLsH/z8/EYKtdsd/EGo3U1FsQ/uFcA52L4c7M7EFDz++ONzAXahFNjHjh07AjaebDtGKu5HUVPiTz0VTYsG3hjs4cOHzy4qKiqQAvvkyZNHwXsZTWGz6NKghinxFuAMtpGH/eijjyYVFhbekAI7IyPjWGBgIMmfxFDYd6gN26OBi2CTJBPZeCN2yJAhzxYUFORJgX3mzJkTISEhT4pgB6gN22OB24H90KBBg2beuHHjukTYZ4KCguKF2n06iQvZQajfzZDVHG/Oxld79hEa1r9VDNxHhcCGL8hupOnTsAEDBnTesWPH0jvuuKOto591+vTpiw8++ODbYOvJZhiV9Cb19GX/RkZ5NA7+r1FF5UaX+L2fq4SGG24rCraUAteKtNsKu1+/fp127dq1LDQ0NMzRDzp16tTVhx9+eBvY+kp6XQZ6g/4OhPIaBaDF0PkS2SausVEmQQl0JcBZyO5L4ZAtZEJjYmKiv/jii1fbtm3bztEPAm8kb+DAgV+DZrPtf6vpT9ssNF3/2xZsjQLgTLNJdf1SbpSpRKjfN1QjdzxVyRCbltNEEoi069OnT+fdu3evDAsL6yDlM00mU1V1dXUNfDbZk4FtFSD5hnx9ffU6spm9QiH7S0AknH/ixIkDCQkJWy5fvpwF/yYb+N0S6ncirJE1zKig09RSz4GYjS5RUVEjs7Ozf7N4meTk5Fy45557htNIOYwNerjCS/GhZoSE2v3279+/w+KlQgc9+tJ7bS02xc4agOCjSkPPnj1jBS+V7t27x/ID10o6ZqX58LpdS8geO94KHO4tWKifmKRolEkp8Do3qqysrMhbgZeUlBSKfHGXAGewiX9qAtfuO28FnpGRcZhzCZVt3auCl0L87a4gT+Tl5V31tg7zxo0bl+HeHqNpBpd6KWyAgUSXdxFPZdCgQYn5+fm5ngqXzHspLy8vIxORbt68ef3777/f1atXr8fpKFME9VD0SoArCXz4UZ26geHBgwd327lz57Lg4GCHNybNysoqgS/r819//fUqPCWj8jdplFehht2UYCL5nczZ9vElQv1GpyzEb2BWnDmZU5y4sk59GDJkSJft27cT6Hc4+rlXrlwpgOO2nD9/PhOekm1zi+hNVnI5DIsToNdwCSs+l1LJ2fAaGxlTpwAXQ2fzTcKGDh3aPT09fWmbNm1CJEC/NnDgwLcyMzN/46CXCAr3vpSQKZSVLXRWaG8rAGowrBYXFze3qKhI0hjm77//fjkqKipRqN0xvBu0SDq0FijUb3zqsflwtQYg7I3Sx8oZpb906dKFyMjI8ULtTNl7SBaSG/FRPFLvLUNsduehjB49+rlbt25Jgn7hwoUzISEhY+H4/hR6swyzecuo/W3QyUwrgC5pptWZM2dOAvS/cGObbNReJ+CofdPT28aPH/9CMYiCqRI4L8XBeeB10OPj4xeWlpaWSIF+9OjRH3Q6Hc68auxkQiOT7ydPnvyiVOhHjhw54OPjM4x6LuHU78e5hY5Cnzp16kuOrHjg5ZtvvtlFpl/QThTX+EiEPnjGjBmLTSZTmZRcRxIIzW3gGh+Jq9a6EOjA738bW0hlQ8s/EmrX+HQQcI2P3QtiiaEqOvWBhOskqZ/79ttvH05OTn7TbDabHPmsoKCgEEeiP3cVH2ediECneRiWFKpLDaxZs+YAeCGalStXLtTr9X6NfU5eXl4ON03B84q9uHidZmtqXsi6y8EpKSmvVlRUmO2Zk+rq6sqnnnpqIjVHYTQIQhsuEzqBOOjll19eSsyLrT5z165dm2jUGUWzknp0C5VBJ2mAAZMmTZp57ty5H8nIS2VlZUVWVtaZ1NTUV8hr0KK5oS6P88PdtZpEK+qBsGoSpKMtpyMvxfRvj6wm4a71Uvy5fLSGdpIVAtZLUU3EFYHYpBusCIQ1r7wLuEcKAkfgCFw2cBSFnRQCR+AIHAWBI3AUBI7AURA4AkfgKAgcgaMgcASOgsAROAJHQeAIHAWBI3AUBI7AETgKAkfgKAgcgaMgcASOwFEQOAJHQeAIHAWBI3AEjoLAETgKAkfgKMqB41r72wWLGyDw5vl1co9NFbSxIHDlsOv2gRPqSzaxSqOsTBMr2VTTnOA9qsiYZNINi5KRQmRsoww/Cp0vuUoa23DUZlGyFlfVTQZwtlMtAc22Bm5F/9ZT4KTqG9tel9S5rSu7J4bubOBawYOEanfdHp4C3fR68+bNY69du/Z+VVXV1yaT6Ytffvnlzfj4eFLBk1Tmv4N+If70i9JoXGkXXVWZU2YVTVbJk1RYJptwPLB///6PbNWpNZvNZSkpKaSa58NCbZnV9kLDvdQ0LaoUqgLgbIfDbnPmzHmWFHG3VxwYoJuTk5OXCfWbMN0GHYE3DZyUSCU7//X57rvvPm2qwDup1gzQX4P3P9Jc0KXcg4/gecLsuJYWb29UyNbry5Yte4HUJ1+xYsU3opeZByMITio86YnA2QZ0NXl5ebmOHADQfZcsWbJAC7J8+fJ9osDJudA90KQYmA2fMGFCIngmVY7uHwHmpWLx4sWvw7FDqHnpoIZ58XYbTuAEUy/lTzt27HiXlLSWAv2VV155g0LvrgZ0bwbOIkwj1XKyPc2Q7du3b5UKfenSpW/CsY+qAd1rgYu0vDX1VnpAG5aenv5PKdBJ5X2A/lc1oHs7cOal+NFIk+zN1hPa8G3btkmFXgkejGLoXg2cg66j4TqD3otA/yeIFOjQ5yqG7vXAG4Fu1fStIFKhg7u4moPOtlT3cwS6qzcwrQtMhPotBtRu/NYFehrukyQV2W6GbBs24sMPP/xnI1G/LehVEBilwrF/lgrdqZEml5/WiCBrnZiNZF9ENU3FFsfHx+8CZ0Q/efLkMY4kByES1S1cuHAOxEaalJSUPdxLxfSxUo3gSClwfuTFh6ZN9fTRtxmgW5oI95nGE6lKTEz8v/LycsOsWbPiHIW+YMGC2SQN8MILL+wWndeiRkSqBnAG2p/6xwZuMMBXxaycRQJ0A70e3ezZs38uLS0NBICxjkJ/7rnnksgvF+B/Qf9dI0oDuAQ4f4MB1N61CQsLC503b16/yMjICPh56sGOkr3SNArNlqWsrKzSZDJVsOd2bKn1F1ddXa0j5sRsNhugBeTm5lYfOXIkNyYmpp1D9gkE7mEWXL9l/vz5nwn1m+0pHx9V0GkyX5gNBvRbvXr1yyUlJYUWLxHSka5bty5NqN2l9l56r35iM+ksL0VHTQjJL3dftGjRPLIboMXLhEB//vnnn4N7vJ/eq1Go39DJqcB9qBkhrtiAS5cuHbd4qVy8ePGYULvxXhS9Zx+5wLUKbThzx/Tt27fvLHipREREdKamhM1/kd0nOcNl83hRc5RfqxAw67krsrOzz3krcLi3C0L9DoeKtgZWCpzNcCp9//33P1C6t6VbjufBPcG9bYU/ywRuMpErhti0NLhgbmHMpk2bVkJkV+wtnSXEENXvvffeBri3WGj30XyNvxK3UMlUN9Zp+lFXicxuCrrrrrvCkpKS+oaHh7dXK/CRIuR8JPCprKz0haDHnwY/xsmTJ3fr0KGDUYpmb968+d3p06dvh6dkp/F8oXba3G1a7sy5hVoutDfQiDOAC+19BOftP8/ndMj529BfX1h6evpjY8eO7SYF9jvvvPPus88+uxOeXqOwi7nQvkas4c7KpVi4b5tNoiwTwda6CDb55VV/8skng0aPHi0J9oYNGzbPnj37E3hKpmEU2tNsVySv2MlZjqGSXpiz0rMaG0krdk8+n3322UiQB6TAXr9+/aa5c+cy2AVC7cbXJnpvyueYe+gAhE40AEFscyjL6UAb+SWI1A5y7dq1G+gABBmYjuR+KaoNQHjLEFswN64Z9/nnn++SAhs62eo1a9bIgt3SB5HjPv30050SYVelpaW9zcGOkAK7JU+TiNuxY8d2qZnA1NTU9UpgtwTg/ESgDkL9RKBtUmGvXr16nWjQWDJsrwbODemxSflkqtsjAPtDidMiVIPdEoDzkzkHbN269R2psFetWrVGLdjeDpxNVw6D1hUCmonAr0IK7Ndffz1NTdgtAbiR2u7eX3311QfOmOijJnCPWjYoyuHo2oE48mbi+oFmr3nppZf20NwIiyDNqkWQTgrtXSUkjVBVWFiY7yDstYsXL/6KhuviRJTTYKse2jvZhndJSEiYTKLExqYjL1++fJWg4mqHluylkBH0mN27d2+x5aWQ5YIrV65cIdSv0bwNNi6MleaHEy2PJq7h+vXrl2ZlZZ0lqxrMZnPp2bNnf5o6dWoSvPYn6qvbXIXsCuCeXNzAj4JvRVuAcHtxgxKhvrhBnc12ZXEDbyjf4SfUl/BgM6IqKXQT54l4R/kOF0nLLVDjYug8fCzB1FIEgSNwBC4bOIrCjgeBI3AEjoLAETgKAkfgKAgcgSNwFASOwFEQOAJHQeAIHIGjIHAEjoLAETgKAkfgCBwFgSNwFASOwFEQOAJH4CgIHIGjIHAEjoLAETgCR0HgCBwFgSNwFASOwBE4CgJH4CgIHIGjIHAEjsBRPB24RqMZQf/sKvHQNxp7sanrhvMmSzxfBv3c3c3JQ4s651xxRoX8rlRzXnfwF5Gi5sllnBc1HDW8eSXDzT4HNRw1XJ73ktKYzW/Kq3G0Bq698zhq21HDUcOd40U44ZeFGu6NgsARONpwp9pOeN9jjngpjvrh0Ed86U62HDXcCzXcXtYvuTE/HDTTX+EvqmsT3tEbqOHYaaIgcASOgsAROAoCR+AIHMVDI01Z80OaihQd/ZxGItFkV0SgqOFeqOFMc14XaZi9scYv3el6UMOx00RB4GjDG/UWUlDDUbxPw+3NR+E0XpX54a6aYYUajsAROIqX2PAMid5IhoefFzXcnQSXDSJwBI6CwBE4CgJH4CgIHIEjcBQEjsBREDgCR0HgCByBoyBwBI6CwBE4CgJH4AgcBYEjcBQEjsBREDgCR+AoCByBoyBw95f/F2AAPX2XGJHD060AAAAASUVORK5CYII=);\n background-size: 46px auto;\n }\n}\n.fancybox-light-overlay {\n opacity: 0.9;\n filter: alpha(opacity=90);\n background: #555555;\n /* Old browsers */\n background: -moz-radial-gradient(center, ellipse cover, #999999 0%, #555555 100%);\n /* FF3.6+ */\n background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #999999), color-stop(100%, #555555));\n /* Chrome,Safari4+ */\n background: -webkit-radial-gradient(center, ellipse cover, #999999 0%, #555555 100%);\n /* Chrome10+,Safari5.1+ */\n background: -o-radial-gradient(center, ellipse cover, #999999 0%, #555555 100%);\n /* Opera 12+ */\n background: -ms-radial-gradient(center, ellipse cover, #999999 0%, #555555 100%);\n /* IE10+ */\n /* \n commenting out due to bug it creates on production - bm\n background: radial-gradient(ellipse at center, #999999 0%, #555555 100%);\n */\n /* W3C */\n}\n </style>\n <style data-href=\"/assets/gulp/print-240f8bfaa7f6402dfd6c49ee3c1ffea57a89ddd4c8c90e2f2a5c7d63c5753e32.css\" media=\"print\">\n .print_only{display:block}body{overflow:hidden}.print_logo{position:absolute;top:0;left:0}.site_header_area{position:relative}.nav_is_fixed .site_header_area{position:absolute;top:0}.site_header_area .brand1,.site_header_area .brand2{display:none}.site_header_area .brand_area{width:23%}.site_header_area .grace_logo img.grace_logo_white{display:none}.custom_banner_container{height:68px}.custom_banner_container img{display:none}.custom_banner_container .banner_header_overlay{display:none}a[href]:after{content:\"\"}.module{padding:1em 0}#sticky_nav_spacer{display:none}.nav_is_fixed #sticky_nav_spacer{display:block}.main_carousel.module .slick-slider .grid_layout{width:100%}.main_carousel.module .slick-slider .right-col{width:3.75in !important;float:left;margin-right:12px;margin-bottom:1em}.main_carousel.module .slick-slider .left-col{width:3.75in !important;float:left}.definition_teaser{display:none;color:white !important}.double_teaser .column{width:48%;float:left}.double_teaser .column+.column{margin-left:1%;margin-top:0}#home .site_header_area{position:relative}#site_footer{border-top:1px solid gray}#site_footer .upper_footer{padding:1em 0}#site_footer .footer_science_calendar footer{display:none}#site_footer .footer_science_calendar .col1,#site_footer .footer_science_calendar .col2,#site_footer .footer_science_calendar .col3{display:inline-block;width:30%;padding:1%}#site_footer .sitemap,#site_footer .share{display:none}#site_footer .lower_footer{height:auto}#site_footer .lower_footer .nav_container{display:none}#primary_column{width:60%;float:left;overflow:hidden;position:relative;display:block}#secondary_column{width:32%;float:right;position:relative;font-size:80%}.double_teaser .column{width:46%}.double_teaser .column+.column{float:right}.grid_view .module_title{display:block}body #page .grid_gallery.grid_view li.slide{width:19%;margin:1%;float:left;clear:none}body #page .grid_gallery.grid_view .bottom_gradient{margin-top:0}body #page .grid_gallery.grid_view .bottom_gradient div{margin-top:.3em}.gradient_line{display:none}.multi_teaser,.teasers_module,.multimedia_teaser,.filter_bar,.tertiary_nav_container,.secondary_nav_mobile,.carousel_teaser,.image_of_the_day,.view_selectors,.related,.primary_media_feature,.fancybox-overlay,#fancybox-lock,.suggested_features,.homepage_carousel,#site_footer .brand_area{display:none}\n </style>\n <script src=\"/assets/public_manifest-b7762ffb108de93fcd0be3bfd82579b100241cc4ee1c087af5f886c0903244cf.js\">\n </script>\n <style>\n </style>\n <script src=\"/assets/mbcms/vendor/jquery.fancybox3-bd48876205805faa43a79e74b656191a4ad37809923b4f3247b571ba82d4458c.js\">\n </script>\n <script src=\"/assets/mb_manifest-a0ae601bc18c852649e350709ab440161da58529f782ae84172c21f8ea27b714.js\">\n </script>\n <!--[if gt IE 8]><!-->\n <script src=\"/assets/not_ie8_manifest.js\">\n </script>\n <style>\n </style>\n <!--[if !IE]>-->\n <script src=\"/assets/not_ie8_manifest.js\">\n </script>\n <style>\n </style>\n <!--<![endif]-->\n <!-- /twitter cards -->\n <meta content=\"summary_large_image\" name=\"twitter:card\"/>\n <meta content=\"News \" name=\"twitter:title\"/>\n <meta content=\"NASA’s real-time portal for Mars exploration, featuring the latest news, images, and discoveries from the Red Planet.\" name=\"twitter:description\"/>\n <meta content=\"https://mars.nasa.gov/system/site_config_values/meta_share_images/1_mars-nasa-gov.jpg\" name=\"twitter:image\"/>\n <style type=\"text/css\">\n .at-icon{fill:#fff;border:0}.at-icon-wrapper{display:inline-block;overflow:hidden}a .at-icon-wrapper{cursor:pointer}.at-rounded,.at-rounded-element .at-icon-wrapper{border-radius:12%}.at-circular,.at-circular-element .at-icon-wrapper{border-radius:50%}.addthis_32x32_style .at-icon{width:2pc;height:2pc}.addthis_24x24_style .at-icon{width:24px;height:24px}.addthis_20x20_style .at-icon{width:20px;height:20px}.addthis_16x16_style .at-icon{width:1pc;height:1pc}#at16lb{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:1001;background-color:#000;opacity:.001}#at_complete,#at_error,#at_share,#at_success{position:static!important}.at15dn{display:none}#at15s,#at16p,#at16p form input,#at16p label,#at16p textarea,#at_share .at_item{font-family:arial,helvetica,tahoma,verdana,sans-serif!important;font-size:9pt!important;outline-style:none;outline-width:0;line-height:1em}* html #at15s.mmborder{position:absolute!important}#at15s.mmborder{position:fixed!important;width:250px!important}#at15s{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABtJREFUeNpiZGBgaGAgAjAxEAlGFVJHIUCAAQDcngCUgqGMqwAAAABJRU5ErkJggg==);float:none;line-height:1em;margin:0;overflow:visible;padding:5px;text-align:left;position:absolute}#at15s a,#at15s span{outline:0;direction:ltr;text-transform:none}#at15s .at-label{margin-left:5px}#at15s .at-icon-wrapper{width:1pc;height:1pc;vertical-align:middle}#at15s .at-icon{width:1pc;height:1pc}.at4-icon{display:inline-block;background-repeat:no-repeat;background-position:top left;margin:0;overflow:hidden;cursor:pointer}.addthis_16x16_style .at4-icon,.addthis_default_style .at4-icon,.at4-icon,.at-16x16{width:1pc;height:1pc;line-height:1pc;background-size:1pc!important}.addthis_32x32_style .at4-icon,.at-32x32{width:2pc;height:2pc;line-height:2pc;background-size:2pc!important}.addthis_24x24_style .at4-icon,.at-24x24{width:24px;height:24px;line-height:24px;background-size:24px!important}.addthis_20x20_style .at4-icon,.at-20x20{width:20px;height:20px;line-height:20px;background-size:20px!important}.at4-icon.circular,.circular .at4-icon,.circular.aticon{border-radius:50%}.at4-icon.rounded,.rounded .at4-icon{border-radius:4px}.at4-icon-left{float:left}#at15s .at4-icon{text-indent:20px;padding:0;overflow:visible;white-space:nowrap;background-size:1pc;width:1pc;height:1pc;background-position:top left;display:inline-block;line-height:1pc}.addthis_vertical_style .at4-icon,.at4-follow-container .at4-icon{margin-right:5px}html>body #at15s{width:250px!important}#at15s.atm{background:none!important;padding:0!important;width:10pc!important}#at15s_inner{background:#fff;border:1px solid #fff;margin:0}#at15s_head{position:relative;background:#f2f2f2;padding:4px;cursor:default;border-bottom:1px solid #e5e5e5}.at15s_head_success{background:#cafd99!important;border-bottom:1px solid #a9d582!important}.at15s_head_success a,.at15s_head_success span{color:#000!important;text-decoration:none}#at15s_brand,#at15sptx,#at16_brand{position:absolute}#at15s_brand{top:4px;right:4px}.at15s_brandx{right:20px!important}a#at15sptx{top:4px;right:4px;text-decoration:none;color:#4c4c4c;font-weight:700}#at15sptx:hover{text-decoration:underline}#at16_brand{top:5px;right:30px;cursor:default}#at_hover{padding:4px}#at_hover .at_item,#at_share .at_item{background:#fff!important;float:left!important;color:#4c4c4c!important}#at_share .at_item .at-icon-wrapper{margin-right:5px}#at_hover .at_bold{font-weight:700;color:#000!important}#at_hover .at_item{width:7pc!important;padding:2px 3px!important;margin:1px;text-decoration:none!important}#at_hover .at_item.athov,#at_hover .at_item:focus,#at_hover .at_item:hover{margin:0!important}#at_hover .at_item.athov,#at_hover .at_item:focus,#at_hover .at_item:hover,#at_share .at_item.athov,#at_share .at_item:hover{background:#f2f2f2!important;border:1px solid #e5e5e5;color:#000!important;text-decoration:none}.ipad #at_hover .at_item:focus{background:#fff!important;border:1px solid #fff}.at15t{display:block!important;height:1pc!important;line-height:1pc!important;padding-left:20px!important;background-position:0 0;text-align:left}.addthis_button,.at15t{cursor:pointer}.addthis_toolbox a.at300b,.addthis_toolbox a.at300m{width:auto}.addthis_toolbox a{margin-bottom:5px;line-height:initial}.addthis_toolbox.addthis_vertical_style{width:200px}.addthis_button_facebook_like .fb_iframe_widget{line-height:100%}.addthis_button_facebook_like iframe.fb_iframe_widget_lift{max-width:none}.addthis_toolbox a.addthis_button_counter,.addthis_toolbox a.addthis_button_facebook_like,.addthis_toolbox a.addthis_button_facebook_send,.addthis_toolbox a.addthis_button_facebook_share,.addthis_toolbox a.addthis_button_foursquare,.addthis_toolbox a.addthis_button_linkedin_counter,.addthis_toolbox a.addthis_button_pinterest_pinit,.addthis_toolbox a.addthis_button_tweet{display:inline-block}.addthis_toolbox span.addthis_follow_label{display:none}.addthis_toolbox.addthis_vertical_style span.addthis_follow_label{display:block;white-space:nowrap}.addthis_toolbox.addthis_vertical_style a{display:block}.addthis_toolbox.addthis_vertical_style.addthis_32x32_style a{line-height:2pc;height:2pc}.addthis_toolbox.addthis_vertical_style .at300bs{margin-right:4px;float:left}.addthis_toolbox.addthis_20x20_style span{line-height:20px}.addthis_toolbox.addthis_32x32_style span{line-height:2pc}.addthis_toolbox.addthis_pill_combo_style .addthis_button_compact .at15t_compact,.addthis_toolbox.addthis_pill_combo_style a{float:left}.addthis_toolbox.addthis_pill_combo_style a.addthis_button_tweet{margin-top:-2px}.addthis_toolbox.addthis_pill_combo_style .addthis_button_compact .at15t_compact{margin-right:4px}.addthis_default_style .addthis_separator{margin:0 5px;display:inline}div.atclear{clear:both}.addthis_default_style .addthis_separator,.addthis_default_style .at4-icon,.addthis_default_style .at300b,.addthis_default_style .at300bo,.addthis_default_style .at300bs,.addthis_default_style .at300m{float:left}.at300b img,.at300bo img{border:0}a.at300b .at4-icon,a.at300m .at4-icon{display:block}.addthis_default_style .at300b,.addthis_default_style .at300bo,.addthis_default_style .at300m{padding:0 2px}.at300b,.at300bo,.at300bs,.at300m{cursor:pointer}.addthis_button_facebook_like.at300b:hover,.addthis_button_facebook_like.at300bs:hover,.addthis_button_facebook_send.at300b:hover,.addthis_button_facebook_send.at300bs:hover{opacity:1}.addthis_20x20_style .at15t,.addthis_20x20_style .at300bs{overflow:hidden;display:block;height:20px!important;width:20px!important;line-height:20px!important}.addthis_32x32_style .at15t,.addthis_32x32_style .at300bs{overflow:hidden;display:block;height:2pc!important;width:2pc!important;line-height:2pc!important}.at300bs{overflow:hidden;display:block;background-position:0 0;height:1pc;width:1pc;line-height:1pc!important}.addthis_default_style .at15t_compact,.addthis_default_style .at15t_expanded{margin-right:4px}#at_share .at_item{width:123px!important;padding:4px;margin-right:2px;border:1px solid #fff}#at16p{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABtJREFUeNpiZGBgaGAgAjAxEAlGFVJHIUCAAQDcngCUgqGMqwAAAABJRU5ErkJggg==);z-index:10000001;position:absolute;top:50%;left:50%;width:300px;padding:10px;margin:0 auto;margin-top:-185px;margin-left:-155px;font-family:arial,helvetica,tahoma,verdana,sans-serif;font-size:9pt;color:#5e5e5e}#at_share{margin:0;padding:0}#at16pt{position:relative;background:#f2f2f2;height:13px;padding:5px 10px}#at16pt a,#at16pt h4{font-weight:700}#at16pt h4{display:inline;margin:0;padding:0;font-size:9pt;color:#4c4c4c;cursor:default}#at16pt a{position:absolute;top:5px;right:10px;color:#4c4c4c;text-decoration:none;padding:2px}#at15sptx:focus,#at16pt a:focus{outline:thin dotted}#at15s #at16pf a{top:1px}#_atssh{width:1px!important;height:1px!important;border:0!important}.atm{width:10pc!important;padding:0;margin:0;line-height:9pt;letter-spacing:normal;font-family:arial,helvetica,tahoma,verdana,sans-serif;font-size:9pt;color:#444;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABtJREFUeNpiZGBgaGAgAjAxEAlGFVJHIUCAAQDcngCUgqGMqwAAAABJRU5ErkJggg==);padding:4px}.atm-f{text-align:right;border-top:1px solid #ddd;padding:5px 8px}.atm-i{background:#fff;border:1px solid #d5d6d6;padding:0;margin:0;box-shadow:1px 1px 5px rgba(0,0,0,.15)}.atm-s{margin:0!important;padding:0!important}.atm-s a:focus{border:transparent;outline:0;transition:none}#at_hover.atm-s a,.atm-s a{display:block;text-decoration:none;padding:4px 10px;color:#235dab!important;font-weight:400;font-style:normal;transition:none}#at_hover.atm-s .at_bold{color:#235dab!important}#at_hover.atm-s a:hover,.atm-s a:hover{background:#2095f0;text-decoration:none;color:#fff!important}#at_hover.atm-s .at_bold{font-weight:700}#at_hover.atm-s a:hover .at_bold{color:#fff!important}.atm-s a .at-label{vertical-align:middle;margin-left:5px;direction:ltr}.at_PinItButton{display:block;width:40px;height:20px;padding:0;margin:0;background-image:url(//s7.addthis.com/static/t00/pinit00.png);background-repeat:no-repeat}.at_PinItButton:hover{background-position:0 -20px}.addthis_toolbox .addthis_button_pinterest_pinit{position:relative}.at-share-tbx-element .fb_iframe_widget span{vertical-align:baseline!important}#at16pf{height:auto;text-align:right;padding:4px 8px}.at-privacy-info{position:absolute;left:7px;bottom:7px;cursor:pointer;text-decoration:none;font-family:helvetica,arial,sans-serif;font-size:10px;line-height:9pt;letter-spacing:.2px;color:#666}.at-privacy-info:hover{color:#000}.body .wsb-social-share .wsb-social-share-button-vert{padding-top:0;padding-bottom:0}.body .wsb-social-share.addthis_counter_style .addthis_button_tweet.wsb-social-share-button{padding-top:40px}.body .wsb-social-share.addthis_counter_style .addthis_button_facebook_like.wsb-social-share-button{padding-top:21px}@media print{#at4-follow,#at4-share,#at4-thankyou,#at4-whatsnext,#at4m-mobile,#at15s,.at4,.at4-recommended{display:none!important}}@media screen and (max-width:400px){.at4win{width:100%}}@media screen and (max-height:700px) and (max-width:400px){.at4-thankyou-inner .at4-recommended-container{height:122px;overflow:hidden}.at4-thankyou-inner .at4-recommended .at4-recommended-item:first-child{border-bottom:1px solid #c5c5c5}}\n </style>\n <style type=\"text/css\">\n .at-branding-logo{font-family:helvetica,arial,sans-serif;text-decoration:none;font-size:10px;display:inline-block;margin:2px 0;letter-spacing:.2px}.at-branding-logo .at-branding-icon{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////+GlNUkcc1QAAAB1JREFUeNpiYIQDBjQmAwMmkwEM0JnY1WIxFyDAABGeAFEudiZsAAAAAElFTkSuQmCC\")}.at-branding-logo .at-branding-icon,.at-branding-logo .at-privacy-icon{display:inline-block;height:10px;width:10px;margin-left:4px;margin-right:3px;margin-bottom:-1px;background-repeat:no-repeat}.at-branding-logo .at-privacy-icon{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAKCAMAAABR24SMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABhQTFRF8fr9ot/xXcfn2/P5AKva////////AKTWodjhjAAAAAd0Uk5T////////ABpLA0YAAAA6SURBVHjaJMzBDQAwCAJAQaj7b9xifV0kUKJ9ciWxlzWEWI5gMF65KUTv0VKkjVeTerqE/x7+9BVgAEXbAWI8QDcfAAAAAElFTkSuQmCC\")}.at-branding-logo span{text-decoration:none}.at-branding-logo .at-branding-addthis,.at-branding-logo .at-branding-powered-by{color:#666}.at-branding-logo .at-branding-addthis:hover{color:#333}.at-cv-with-image .at-branding-addthis,.at-cv-with-image .at-branding-addthis:hover{color:#fff}a.at-branding-logo:visited{color:initial}.at-branding-info{display:inline-block;padding:0 5px;color:#666;border:1px solid #666;border-radius:50%;font-size:10px;line-height:9pt;opacity:.7;transition:all .3s ease;text-decoration:none}.at-branding-info span{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.at-branding-info:before{content:'i';font-family:Times New Roman}.at-branding-info:hover{color:#0780df;border-color:#0780df}\n </style>\n <style type=\"text/css\">\n .fancybox-margin{margin-right:0px;}\n </style>\n <style type=\"text/css\">\n .fancybox-margin{margin-right:0px;}\n </style>\n <script async=\"\" charset=\"utf-8\" src=\"https://s7.addthis.com/static/layers.33f5b85045a5f2308467.js\" type=\"text/javascript\">\n </script>\n </head>\n <body id=\"news\" style=\"\">\n <svg display=\"none\" height=\"0\" width=\"0\">\n <symbol height=\"30\" id=\"circle_plus\" viewbox=\"0 0 30 30\" width=\"30\">\n <g fill-rule=\"evenodd\" transform=\"translate(1 1)\">\n <circle cx=\"14\" cy=\"14\" fill=\"#fff\" fill-opacity=\".1\" fill-rule=\"nonzero\" r=\"14\" stroke=\"inherit\" stroke-width=\"1\">\n </circle>\n <path class=\"the_plus\" d=\"m18.856 12.96v1.738h-4.004v3.938h-1.848v-3.938h-4.004v-1.738h4.004v-3.96h1.848v3.96z\" fill=\"inherit\" stroke-width=\"0\">\n </path>\n </g>\n </symbol>\n <symbol height=\"30\" id=\"circle_arrow\" viewbox=\"0 0 30 30\" width=\"30\" xmlns=\"http://www.w3.org/2000/svg\">\n <g transform=\"translate(1 1)\">\n <circle cx=\"14\" cy=\"14\" fill=\"#fff\" fill-opacity=\".1\" r=\"14\" stroke=\"inherit\" stroke-width=\"1\">\n </circle>\n <path class=\"the_arrow\" d=\"m8.5 15.00025h7.984l-2.342 2.42c-.189.197-.189.518 0 .715l.684.717c.188.197.494.197.684 0l4.35-4.506c.188-.199.188-.52 0-.717l-4.322-4.48c-.189-.199-.496-.199-.684 0l-.684.716c-.189.197-.189.519 0 .716l2.341 2.419h-8.011c-.276 0-.5.223-.5.5v1c0 .275.224.5.5.5z\" fill=\"inherit\" stroke-width=\"0\">\n </path>\n </g>\n </symbol>\n <symbol height=\"30\" id=\"circle_close\" viewbox=\"0 0 30 30\" width=\"30\">\n <g fill-rule=\"evenodd\" transform=\"translate(1 1)\">\n <circle cx=\"14\" cy=\"14\" fill=\"blue\" fill-opacity=\"1\" fill-rule=\"nonzero\" r=\"14\" stroke=\"inherit\" stroke-width=\"1\">\n </circle>\n <path class=\"the_plus\" d=\"m18.856 12.96v1.738h-4.004v3.938h-1.848v-3.938h-4.004v-1.738h4.004v-3.96h1.848v3.96z\" fill=\"inherit\" stroke-width=\"0\">\n </path>\n </g>\n </symbol>\n <symbol height=\"30\" id=\"circle_close_hover\" viewbox=\"0 0 30 30\" width=\"30\">\n <g fill-rule=\"evenodd\" transform=\"translate(1 1)\">\n <circle cx=\"14\" cy=\"14\" fill=\"white\" fill-opacity=\"1\" fill-rule=\"nonzero\" r=\"14\" stroke=\"inherit\" stroke-width=\"1\">\n </circle>\n <path class=\"the_plus\" d=\"m18.856 12.96v1.738h-4.004v3.938h-1.848v-3.938h-4.004v-1.738h4.004v-3.96h1.848v3.96z\" fill=\"inherit\" stroke-width=\"0\">\n </path>\n </g>\n </symbol>\n <symbol height=\"6\" id=\"chevron_down\" viewbox=\"0 0 10 6\" width=\"10\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m59 7v2.72727273l5 3.27272727 5-3.27272727v-2.72727273l-5 3.2727273z\" transform=\"translate(-59 -7)\">\n </path>\n </symbol>\n <symbol height=\"16\" id=\"gear\" viewbox=\"0 0 16 16\" width=\"16\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m68 9h-1.09c-.15-.91-.5-1.75-1.021-2.471l.761-.77c.39-.39.39-1.029 0-1.42-.391-.39-1.021-.39-1.41 0l-.771.77c-.719-.519-1.469-.869-2.469-1.019v-1.09c0-.55-.45-1-1-1s-1 .45-1 1v1.09c-1 .15-1.75.5-2.47 1.02l-.77-.77c-.389-.39-1.029-.39-1.42 0-.39.391-.39 1.03 0 1.42l.771.77c-.521.72-.871 1.56-1.021 2.47h-1.09c-.55 0-1 .48-1 1.029 0 .551.45.971 1.12.971h.97c.15.91.5 1.75 1.021 2.471l-.771.769c-.39.39-.39 1.029 0 1.42.391.39 1.021.39 1.41 0l.78-.77c.72.52 1.47.87 2.47 1.02v1.09c0 .55.45 1 1 1s1-.45 1-1v-1.09c1-.15 1.75-.5 2.47-1.02l.771.77c.391.39 1.02.39 1.41 0 .39-.391.39-1.03 0-1.42l-.761-.76c.51-.72.87-1.56 1.02-2.48h1.09c.55 0 1-.45 1-1s-.45-1-1-1zm-7 4c-1.66 0-3-1.35-3-3s1.34-3 3-3c1.65 0 3 1.35 3 3s-1.35 3-3 3z\" fill=\"#a79693\" transform=\"translate(-53 -2)\">\n </path>\n </symbol>\n </svg>\n <div data-react-cache-id=\"BrowseHappier-0\" data-react-class=\"BrowseHappier\" data-react-props='{\"gt\":1,\"lt\":11}'>\n </div>\n <div data-react-cache-id=\"HiPO-0\" data-react-class=\"HiPO\" data-react-props=\"{}\">\n <div class=\"\" id=\"dashboard_modal\" style=\"height: 100%;\">\n <div>\n </div>\n <div class=\"content\" id=\"dashboard_modal_content\">\n </div>\n </div>\n </div>\n <div id=\"main_container\">\n <div id=\"site_body\">\n <div class=\"site_header_area\">\n <header class=\"site_header\">\n <div class=\"brand_area\">\n <div class=\"brand1\">\n <a class=\"nasa_logo\" href=\"http://www.nasa.gov\" target=\"_blank\" title=\"visit nasa.gov\">\n NASA\n </a>\n </div>\n <div class=\"brand2\">\n <a class=\"top_logo\" href=\"https://science.nasa.gov/\" target=\"_blank\" title=\"Explore NASA Science\">\n NASA Science\n </a>\n <a class=\"sub_logo\" href=\"/mars-exploration/#\" title=\"Mars\">\n Mars Exploration Program\n </a>\n </div>\n <img alt=\"\" class=\"print_only print_logo\" src=\"/assets/[email protected]\"/>\n </div>\n <a class=\"visuallyhidden focusable\" href=\"#page\">\n Skip Navigation\n </a>\n <div class=\"right_header_container\">\n <a class=\"menu_button\" href=\"javascript:void(0);\" id=\"menu_button\">\n <span class=\"menu_icon\">\n menu\n </span>\n </a>\n <a class=\"modal_close\" id=\"modal_close\">\n <span class=\"modal_close_icon\">\n </span>\n </a>\n <div class=\"nav_area\">\n <div id=\"site_nav_container\">\n <nav class=\"site_nav\" data-react-cache-id=\"Meganav-0\" data-react-class=\"Meganav\" data-react-props=\"{"nav_items":[{"name":"Mars Now","style":"icon","li_class":"nav_icon mars_now","target":"_self","link":"/explore/mars-now","svg_icon_id":"nav_icon","id":261,"features":[{"title":"Mars Now","body":"View a 3D visualization of all the missions exploring the Red Planet","image_src":"/system/basic_html_elements/225_mars_now_nav.jpg","link":"/explore/mars-now/","target":"_self","categories":[]}],"title":"","short_description":"View the current location and spacecraft communications activity of operating landers, rovers and orbiters using the NASA’s Mars Relay Network."},{"name":"The Red Planet","link":"/#red_planet","target":"_self","sections":[{"items":[{"name":"Dashboard","link":"/#red_planet/0","target":"_self","id":9},{"name":"Science Goals","link":"/#red_planet/1","target":"_self","id":13},{"name":"The Planet","link":"/#red_planet/2","target":"_self","id":14},{"name":"Atmosphere","link":"/#red_planet/3","target":"_self","id":16},{"name":"Astrobiology","link":"/#red_planet/4","target":"_self","id":17},{"name":"Past, Present, Future, Timeline","link":"/#red_planet/5","target":"_self","id":18}]}],"id":3,"meganav_style":"","features":[],"short_description":null},{"name":"The Program","link":"/#mars_exploration_program","target":"_self","sections":[{"items":[{"name":"Mission Statement","link":"/#mars_exploration_program/0","target":"_self","id":8},{"name":"About the Program","link":"/#mars_exploration_program/1","target":"_self","id":42},{"name":"Organization","link":"/#mars_exploration_program/2","target":"_self","id":43},{"name":"Why Mars?","link":"/#mars_exploration_program/3","target":"_self","id":51},{"name":"Research Programs","link":"/#mars_exploration_program/4","target":"_self","id":44},{"name":"Planetary Resources","link":"/#mars_exploration_program/5","target":"_self","id":52},{"name":"Technologies","link":"/#mars_exploration_program/6","target":"_self","id":56}]}],"id":2,"meganav_style":"","features":[],"short_description":null},{"name":"News \\u0026 Events","link":"/#news_and_events","target":"_self","sections":[{"items":[{"name":"News","link":"/news","target":"_self","id":92},{"name":"Events","link":"/events","target":"_self","id":93}]}],"id":4,"meganav_style":"","features":[],"short_description":null},{"name":"Multimedia","link":"/#multimedia","target":"_self","sections":[{"items":[{"name":"Images","link":"/multimedia/images/","target":"_self","id":90},{"name":"Videos","link":"/multimedia/videos/","target":"_self","id":91},{"name":"More Resources","link":"/multimedia/more-resources/","target":"_self","id":413}]}],"id":5,"meganav_style":"","features":[],"short_description":null},{"name":"Missions","link":"/#missions_gallery_subnav","target":"_self","sections":[{"items":[{"name":"Past","link":"/mars-exploration/missions/?category=167","target":"_self","id":38},{"name":"Present","link":"/mars-exploration/missions/?category=170","target":"_self","id":59},{"name":"Future","link":"/mars-exploration/missions/?category=171","target":"_self","id":60},{"name":"International Partners","link":"/mars-exploration/partners","target":"_self","id":40}]}],"id":6,"meganav_style":"","features":[],"short_description":null},{"name":"More","link":"/#more","target":"_self","sections":[],"id":7,"meganav_style":"","features":[],"short_description":null}],"gallery_subnav_items":[{"thumb":"/system/missions/list_view_images/23_PIA23764-RoverNamePlateonMars-320x240.jpg","id":23,"title":"Mars 2020 Perseverance Rover","description":"A mission to investigate key questions about potential life on Mars. ","date":"July 17, 2020","url":"/mars-exploration/missions/mars2020/","link_text":"","target":"_blank","mi_traveled":null,"gallery_subnav_link":"https://mars.nasa.gov/mars2020/"},{"thumb":"/system/missions/list_view_images/2_PIA14175-thmfeat.jpg","id":2,"title":"Curiosity Rover","description":"The largest and most capable rover ever sent to Mars.","date":"November 26, 2011","url":"/mars-exploration/missions/mars-science-laboratory","link_text":"","target":"_blank","mi_traveled":14.33,"gallery_subnav_link":"https://mars.nasa.gov/msl/home/"},{"thumb":"/system/missions/list_view_images/21_PIA22743-320x240.jpg","id":21,"title":"InSight Lander","description":"A mission to study the deep interior of Mars. ","date":"November 26, 2018","url":"/mars-exploration/missions/insight/","link_text":"","target":"_blank","mi_traveled":null,"gallery_subnav_link":"https://mars.nasa.gov/insight/"},{"thumb":"/system/missions/list_view_images/6_maven_320x240.jpg","id":6,"title":"MAVEN","description":"Measures Mars' atmosphere to understand its climate change.","date":"November 18, 2013","url":"/mars-exploration/missions/maven","link_text":"","target":"_blank","mi_traveled":null,"gallery_subnav_link":"https://mars.nasa.gov/maven/"},{"thumb":"/system/missions/list_view_images/8_MRO_320x240.jpg","id":8,"title":"Mars Reconnaissance Orbiter","description":"Takes high-resolution imagery of Martian terrain with extraordinary clarity. ","date":"August 12, 2012","url":"/mars-exploration/missions/mars-reconnaissance-orbiter","link_text":"","target":"_blank","mi_traveled":null,"gallery_subnav_link":"https://mars.nasa.gov/mro/"},{"thumb":"/system/missions/list_view_images/5_mars_odyssey320x240.jpg","id":5,"title":"2001 Mars Odyssey","description":"NASA's longest-lasting spacecraft at Mars. ","date":"April 7, 2001","url":"/mars-exploration/missions/odyssey","link_text":"","target":"_blank","mi_traveled":null,"gallery_subnav_link":"https://mars.nasa.gov/odyssey/"}],"search":true,"search_placeholder":{"placeholder":""},"highlight_current":{"highlight":true,"current_id":83,"parent_ids":[]},"search_submit":"/search/"}\">\n <span style=\"visibility: visible;\">\n <ul class=\"nav\">\n <li class=\"nav_icon mars_now\">\n <div class=\"nav_title\" id=\"li_261\">\n <a class=\"main_nav_item icon\" href=\"/explore/mars-now\" title=\"Mars Now\">\n <span>\n Mars Now\n </span>\n </a>\n </div>\n <div class=\"global_subnav_container\">\n <div class=\"meganav_container\">\n <div class=\"nav_item_indicator\">\n </div>\n <div class=\"meganav\">\n <div class=\"sections_container\">\n <h2 class=\"section_title\">\n Mars Now\n </h2>\n <div class=\"section_description\">\n View the current location and spacecraft communications activity of operating landers, rovers and orbiters using the NASA’s Mars Relay Network.\n </div>\n <a class=\"button\" href=\"/explore/mars-now\">\n GO\n </a>\n </div>\n <div class=\"detail_container\">\n <div class=\"feature_info\">\n <div class=\"single_layout\">\n <a class=\"image_container\" href=\"/explore/mars-now/\" style='background-image: url(\"/system/basic_html_elements/225_mars_now_nav.jpg\");'>\n <div class=\"bottom_description\" id=\"261\">\n <div class=\"category_title\">\n </div>\n <div class=\"content_title\">\n Mars Now\n </div>\n <div class=\"description\">\n View a 3D visualization of all the missions exploring the Red Planet\n </div>\n </div>\n </a>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"gradient_line\">\n </div>\n </li>\n <li class=\"\">\n <div class=\"arrow_box\">\n <span class=\"arrow_down\">\n </span>\n </div>\n <div class=\"nav_title\" id=\"li_3\">\n <a class=\"main_nav_item\" href=\"/#red_planet\" target=\"_self\">\n <span>\n The Red Planet\n </span>\n </a>\n </div>\n <div class=\"global_subnav_container\">\n <div class=\"meganav_container no_feature\">\n <div class=\"nav_item_indicator\">\n </div>\n <div class=\"meganav\">\n <div class=\"sections_container\">\n <ul>\n <li>\n <a class=\"\" href=\"/#red_planet/0\" target=\"_self\">\n <span>\n Dashboard\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/1\" target=\"_self\">\n <span>\n Science Goals\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/2\" target=\"_self\">\n <span>\n The Planet\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/3\" target=\"_self\">\n <span>\n Atmosphere\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/4\" target=\"_self\">\n <span>\n Astrobiology\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/5\" target=\"_self\">\n <span>\n Past, Present, Future, Timeline\n </span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <ul class=\"subnav\">\n <div>\n <li>\n <a class=\"\" href=\"/#red_planet/0\" target=\"_self\">\n <span>\n Dashboard\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/1\" target=\"_self\">\n <span>\n Science Goals\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/2\" target=\"_self\">\n <span>\n The Planet\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/3\" target=\"_self\">\n <span>\n Atmosphere\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/4\" target=\"_self\">\n <span>\n Astrobiology\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#red_planet/5\" target=\"_self\">\n <span>\n Past, Present, Future, Timeline\n </span>\n </a>\n </li>\n </div>\n </ul>\n </div>\n <div class=\"gradient_line\">\n </div>\n </li>\n <li class=\"\">\n <div class=\"arrow_box\">\n <span class=\"arrow_down\">\n </span>\n </div>\n <div class=\"nav_title\" id=\"li_2\">\n <a class=\"main_nav_item\" href=\"/#mars_exploration_program\" target=\"_self\">\n <span>\n The Program\n </span>\n </a>\n </div>\n <div class=\"global_subnav_container\">\n <div class=\"meganav_container no_feature\">\n <div class=\"nav_item_indicator\">\n </div>\n <div class=\"meganav\">\n <div class=\"sections_container\">\n <ul>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/0\" target=\"_self\">\n <span>\n Mission Statement\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/1\" target=\"_self\">\n <span>\n About the Program\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/2\" target=\"_self\">\n <span>\n Organization\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/3\" target=\"_self\">\n <span>\n Why Mars?\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/4\" target=\"_self\">\n <span>\n Research Programs\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/5\" target=\"_self\">\n <span>\n Planetary Resources\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/6\" target=\"_self\">\n <span>\n Technologies\n </span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <ul class=\"subnav\">\n <div>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/0\" target=\"_self\">\n <span>\n Mission Statement\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/1\" target=\"_self\">\n <span>\n About the Program\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/2\" target=\"_self\">\n <span>\n Organization\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/3\" target=\"_self\">\n <span>\n Why Mars?\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/4\" target=\"_self\">\n <span>\n Research Programs\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/5\" target=\"_self\">\n <span>\n Planetary Resources\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/#mars_exploration_program/6\" target=\"_self\">\n <span>\n Technologies\n </span>\n </a>\n </li>\n </div>\n </ul>\n </div>\n <div class=\"gradient_line\">\n </div>\n </li>\n <li class=\"\">\n <div class=\"arrow_box\">\n <span class=\"arrow_down\">\n </span>\n </div>\n <div class=\"nav_title\" id=\"li_4\">\n <a class=\"main_nav_item\" href=\"/#news_and_events\" target=\"_self\">\n <span>\n News & Events\n </span>\n </a>\n </div>\n <div class=\"global_subnav_container\">\n <div class=\"meganav_container no_feature\">\n <div class=\"nav_item_indicator\">\n </div>\n <div class=\"meganav\">\n <div class=\"sections_container\">\n <ul>\n <li>\n <a class=\"\" href=\"/news\" target=\"_self\">\n <span>\n News\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/events\" target=\"_self\">\n <span>\n Events\n </span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <ul class=\"subnav\">\n <div>\n <li>\n <a class=\"\" href=\"/news\" target=\"_self\">\n <span>\n News\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/events\" target=\"_self\">\n <span>\n Events\n </span>\n </a>\n </li>\n </div>\n </ul>\n </div>\n <div class=\"gradient_line\">\n </div>\n </li>\n <li class=\"\">\n <div class=\"arrow_box\">\n <span class=\"arrow_down\">\n </span>\n </div>\n <div class=\"nav_title\" id=\"li_5\">\n <a class=\"main_nav_item\" href=\"/#multimedia\" target=\"_self\">\n <span>\n Multimedia\n </span>\n </a>\n </div>\n <div class=\"global_subnav_container\">\n <div class=\"meganav_container no_feature\">\n <div class=\"nav_item_indicator\">\n </div>\n <div class=\"meganav\">\n <div class=\"sections_container\">\n <ul>\n <li>\n <a class=\"\" href=\"/multimedia/images/\" target=\"_self\">\n <span>\n Images\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/multimedia/videos/\" target=\"_self\">\n <span>\n Videos\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/multimedia/more-resources/\" target=\"_self\">\n <span>\n More Resources\n </span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <ul class=\"subnav\">\n <div>\n <li>\n <a class=\"\" href=\"/multimedia/images/\" target=\"_self\">\n <span>\n Images\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/multimedia/videos/\" target=\"_self\">\n <span>\n Videos\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/multimedia/more-resources/\" target=\"_self\">\n <span>\n More Resources\n </span>\n </a>\n </li>\n </div>\n </ul>\n </div>\n <div class=\"gradient_line\">\n </div>\n </li>\n <li class=\"missions_gallery_subnav_item\">\n <div class=\"arrow_box\">\n <span class=\"arrow_down\">\n </span>\n </div>\n <div class=\"nav_title\" id=\"li_6\">\n <a class=\"main_nav_item\">\n Missions\n <img alt=\"expand arrow\" class=\"arrow_expand\" src=\"/assets/arrow_down.png\"/>\n </a>\n </div>\n <div class=\"global_subnav_container\">\n <div class=\"meganav_container no_feature\">\n <div class=\"nav_item_indicator\">\n </div>\n <div class=\"meganav\">\n <div class=\"sections_container\">\n <ul>\n <li>\n <a class=\"\" href=\"/mars-exploration/missions/?category=167\" target=\"_self\">\n <span>\n Past\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/mars-exploration/missions/?category=170\" target=\"_self\">\n <span>\n Present\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/mars-exploration/missions/?category=171\" target=\"_self\">\n <span>\n Future\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/mars-exploration/partners\" target=\"_self\">\n <span>\n International Partners\n </span>\n </a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <ul class=\"subnav\">\n <div>\n <li>\n <a class=\"\" href=\"/mars-exploration/missions/?category=167\" target=\"_self\">\n <span>\n Past\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/mars-exploration/missions/?category=170\" target=\"_self\">\n <span>\n Present\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/mars-exploration/missions/?category=171\" target=\"_self\">\n <span>\n Future\n </span>\n </a>\n </li>\n <li>\n <a class=\"\" href=\"/mars-exploration/partners\" target=\"_self\">\n <span>\n International Partners\n </span>\n </a>\n </li>\n </div>\n </ul>\n </div>\n <div class=\"missions_gallery_subnav\">\n <h2 class=\"missions_gallery_subnav_title\">\n Active & Future Missions\n </h2>\n <a class=\"close_button\" title=\"close\">\n <span class=\"close_icon\">\n </span>\n </a>\n <div class=\"mission_items\">\n <div class=\"mission_item\">\n <div class=\"mission_item_overlay\">\n </div>\n <a class=\"mission_link\" href=\"https://mars.nasa.gov/mars2020/\" target=\"\">\n <div class=\"mission_description rollover_description\">\n <div class=\"rollover_description_inner\">\n A mission to investigate key questions about potential life on Mars.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"Mars 2020 Perseverance Rover\" class=\"mission_image\" src=\"/system/missions/list_view_images/23_PIA23764-RoverNamePlateonMars-320x240.jpg\"/>\n <h3 class=\"mission_title\">\n <span>\n Mars 2020 Perseverance Rover\n </span>\n </h3>\n </a>\n </div>\n <div class=\"mission_item\">\n <div class=\"mission_item_overlay\">\n </div>\n <a class=\"mission_link\" href=\"https://mars.nasa.gov/msl/home/\" target=\"\">\n <div class=\"mission_description rollover_description\">\n <div class=\"rollover_description_inner\">\n The largest and most capable rover ever sent to Mars.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"Curiosity Rover\" class=\"mission_image\" src=\"/system/missions/list_view_images/2_PIA14175-thmfeat.jpg\"/>\n <h3 class=\"mission_title\">\n <span>\n Curiosity Rover\n </span>\n </h3>\n </a>\n </div>\n <div class=\"mission_item\">\n <div class=\"mission_item_overlay\">\n </div>\n <a class=\"mission_link\" href=\"https://mars.nasa.gov/insight/\" target=\"_blank\">\n <div class=\"mission_description rollover_description\">\n <div class=\"rollover_description_inner\">\n A mission to study the deep interior of Mars.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"InSight Lander\" class=\"mission_image\" src=\"/system/missions/list_view_images/21_PIA22743-320x240.jpg\"/>\n <h3 class=\"mission_title\">\n <span>\n InSight Lander\n </span>\n </h3>\n </a>\n </div>\n <div class=\"mission_item\">\n <div class=\"mission_item_overlay\">\n </div>\n <a class=\"mission_link\" href=\"https://mars.nasa.gov/maven/\" target=\"\">\n <div class=\"mission_description rollover_description\">\n <div class=\"rollover_description_inner\">\n Measures Mars' atmosphere to understand its climate change.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"MAVEN\" class=\"mission_image\" src=\"/system/missions/list_view_images/6_maven_320x240.jpg\"/>\n <h3 class=\"mission_title\">\n <span>\n MAVEN\n </span>\n </h3>\n </a>\n </div>\n <div class=\"mission_item\">\n <div class=\"mission_item_overlay\">\n </div>\n <a class=\"mission_link\" href=\"https://mars.nasa.gov/mro/\" target=\"\">\n <div class=\"mission_description rollover_description\">\n <div class=\"rollover_description_inner\">\n Takes high-resolution imagery of Martian terrain with extraordinary clarity.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"Mars Reconnaissance Orbiter\" class=\"mission_image\" src=\"/system/missions/list_view_images/8_MRO_320x240.jpg\"/>\n <h3 class=\"mission_title\">\n <span>\n Mars Reconnaissance Orbiter\n </span>\n </h3>\n </a>\n </div>\n <div class=\"mission_item\">\n <div class=\"mission_item_overlay\">\n </div>\n <a class=\"mission_link\" href=\"https://mars.nasa.gov/odyssey/\" target=\"\">\n <div class=\"mission_description rollover_description\">\n <div class=\"rollover_description_inner\">\n NASA's longest-lasting spacecraft at Mars.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"2001 Mars Odyssey\" class=\"mission_image\" src=\"/system/missions/list_view_images/5_mars_odyssey320x240.jpg\"/>\n <h3 class=\"mission_title\">\n <span>\n 2001 Mars Odyssey\n </span>\n </h3>\n </a>\n </div>\n <div class=\"background_area\">\n </div>\n </div>\n <ul class=\"missions_links\">\n <li>\n <a class=\"button\" href=\"/mars-exploration/missions\">\n All Missions\n </a>\n </li>\n <li>\n <a class=\"button\" href=\"/mars-exploration/partners\" target=\"_blank\">\n International Partners\n </a>\n </li>\n </ul>\n </div>\n <div class=\"gradient_line\">\n </div>\n </li>\n <li class=\"\">\n <div class=\"nav_title\">\n <a class=\"main_nav_item\" href=\"/#more\" target=\"_self\">\n <span>\n More\n </span>\n </a>\n </div>\n <div class=\"gradient_line\">\n </div>\n </li>\n </ul>\n <form action=\"/search/\" class=\"meganav_overlay_search meganav_search\">\n <input class=\"search_field\" name=\"q\" placeholder=\"\" type=\"text\" value=\"\"/>\n <div class=\"search_submit\">\n </div>\n </form>\n </span>\n </nav>\n </div>\n </div>\n </div>\n </header>\n </div>\n <div id=\"sticky_nav_spacer\">\n </div>\n <div id=\"page\">\n <div class=\"page_cover\">\n </div>\n <!-- title to go in the page_header -->\n <div class=\"header_mask\">\n <section class=\"content_page module\">\n </section>\n </div>\n <div class=\"grid_list_page module content_page\">\n <div class=\"grid_layout\">\n <article>\n <header id=\"page_header\">\n </header>\n <div class=\"react_grid_list grid_list_container\" data-react-cache-id=\"GridListPage-0\" data-react-class=\"GridListPage\" data-react-props='{\"left_column\":false,\"class_name\":\"\",\"default_view\":\"list_view\",\"model\":\"news_items\",\"view_toggle\":false,\"search\":\"true\",\"list_item\":\"News\",\"title\":\"News\",\"categories\":[\"19,165,184,204\"],\"order\":\"publish_date desc,created_at desc\",\"no_items_text\":\"There are no items matching these criteria.\",\"site_title\":\"NASA’s Mars Exploration Program \",\"short_title\":\"Mars\",\"site_share_image\":\"/system/site_config_values/meta_share_images/1_mars-nasa-gov.jpg\",\"per_page\":null,\"filters\":\"[ [ \\\"date\\\", [ [ \\\"2020\\\", \\\"2020\\\" ], [ \\\"2019\\\", \\\"2019\\\" ], [ \\\"2018\\\", \\\"2018\\\" ], [ \\\"2017\\\", \\\"2017\\\" ], [ \\\"2016\\\", \\\"2016\\\" ], [ \\\"2015\\\", \\\"2015\\\" ], [ \\\"2014\\\", \\\"2014\\\" ], [ \\\"2013\\\", \\\"2013\\\" ], [ \\\"2012\\\", \\\"2012\\\" ], [ \\\"2011\\\", \\\"2011\\\" ], [ \\\"2010\\\", \\\"2010\\\" ], [ \\\"2009\\\", \\\"2009\\\" ], [ \\\"2008\\\", \\\"2008\\\" ], [ \\\"2007\\\", \\\"2007\\\" ], [ \\\"2006\\\", \\\"2006\\\" ], [ \\\"2005\\\", \\\"2005\\\" ], [ \\\"2004\\\", \\\"2004\\\" ], [ \\\"2003\\\", \\\"2003\\\" ], [ \\\"2002\\\", \\\"2002\\\" ], [ \\\"2001\\\", \\\"2001\\\" ], [ \\\"2000\\\", \\\"2000\\\" ] ], [ \\\"Latest\\\", \\\"\\\" ], false ], [ \\\"categories\\\", [ [ \\\"Feature Stories\\\", 165 ], [ \\\"Press Releases\\\", 19 ], [ \\\"Spotlights\\\", 184 ], [ \\\"Status Reports\\\", 204 ] ], [ \\\"All Categories\\\", \\\"\\\" ], false ] ]\",\"conditions\":null,\"scope_in_title\":true,\"options\":{\"blank_scope\":\"Latest\"},\"results_in_title\":false}'>\n <section class=\"grid_gallery module list_view\">\n <div class=\"grid_layout\">\n <header class=\"gallery_header\">\n <h2 class=\"module_title\">\n News\n </h2>\n <section class=\"filter_bar\">\n <div class=\"section_search\">\n <div class=\"search_binder\">\n <input class=\"search_field\" name=\"search\" placeholder=\"search\" type=\"text\" value=\"\"/>\n <input class=\"search_submit\" type=\"submit\" value=\"\"/>\n </div>\n <select class=\"filter\" id=\"date\" name=\"date\">\n <option value=\"\">\n Latest\n </option>\n <option value=\"2020\">\n 2020\n </option>\n <option value=\"2019\">\n 2019\n </option>\n <option value=\"2018\">\n 2018\n </option>\n <option value=\"2017\">\n 2017\n </option>\n <option value=\"2016\">\n 2016\n </option>\n <option value=\"2015\">\n 2015\n </option>\n <option value=\"2014\">\n 2014\n </option>\n <option value=\"2013\">\n 2013\n </option>\n <option value=\"2012\">\n 2012\n </option>\n <option value=\"2011\">\n 2011\n </option>\n <option value=\"2010\">\n 2010\n </option>\n <option value=\"2009\">\n 2009\n </option>\n <option value=\"2008\">\n 2008\n </option>\n <option value=\"2007\">\n 2007\n </option>\n <option value=\"2006\">\n 2006\n </option>\n <option value=\"2005\">\n 2005\n </option>\n <option value=\"2004\">\n 2004\n </option>\n <option value=\"2003\">\n 2003\n </option>\n <option value=\"2002\">\n 2002\n </option>\n <option value=\"2001\">\n 2001\n </option>\n <option value=\"2000\">\n 2000\n </option>\n </select>\n <select class=\"filter\" id=\"categories\" name=\"categories\">\n <option value=\"\">\n All Categories\n </option>\n <option value=\"165\">\n Feature Stories\n </option>\n <option value=\"19\">\n Press Releases\n </option>\n <option value=\"184\">\n Spotlights\n </option>\n <option value=\"204\">\n Status Reports\n </option>\n </select>\n </div>\n </section>\n </header>\n Loading...\n </div>\n </section>\n </div>\n </article>\n </div>\n </div>\n <section class=\"module suggested_features\">\n <div class=\"grid_layout\">\n <header>\n <h2 class=\"module_title\">\n You Might Also Like\n </h2>\n </header>\n <section>\n <script>\n $(document).ready(function(){\n $(\".features\").slick({\n dots: false,\n infinite: true,\n speed: 300,\n slide: '.features .slide',\n slidesToShow: 3,\n slidesToScroll: 3,\n lazyLoad: 'ondemand',\n centerMode: false,\n arrows: true,\n appendArrows: '.features .slick-nav',\n appendDots: \".features .slick-nav\",\n responsive: [{\"breakpoint\":953,\"settings\":{\"slidesToShow\":2,\"slidesToScroll\":2,\"centerMode\":false}},{\"breakpoint\":480,\"settings\":{\"slidesToShow\":1,\"slidesToScroll\":1,\"centerMode\":true,\"arrows\":false,\"centerPadding\":\"25px\"}}]\n });\n });\n </script>\n <div class=\"features slick-initialized slick-slider\">\n <div class=\"slick-list draggable\" tabindex=\"0\">\n <div class=\"slick-track\" style=\"opacity: 1; width: 4200px; transform: translate3d(-1050px, 0px, 0px);\">\n <div class=\"slide slick-slide slick-cloned\" index=\"-3\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8659/alabama-high-school-student-names-nasas-mars-helicopter/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n Vaneeza Rupani's essay was chosen as the name for the small spacecraft, which will mark NASA's first attempt at powered flight on another planet.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"Alabama High School Student Names NASA's Mars Helicopter\" class=\"img-lazy\" data-lazy=\"/system/news_items/list_view_images/8659_1-PIA23883-MAIN-320x240.jpg\" src=\"/assets/loading_320x240.png\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8659/alabama-high-school-student-names-nasas-mars-helicopter/\">\n Alabama High School Student Names NASA's Mars Helicopter\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide slick-cloned\" index=\"-2\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8645/mars-helicopter-attached-to-nasas-perseverance-rover/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n The team also fueled the rover's sky crane to get ready for this summer's history-making launch.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"Mars Helicopter Attached to NASA's Perseverance Rover\" class=\"img-lazy\" data-lazy=\"/system/news_items/list_view_images/8645_PIA23824-RoverWithHelicopter-32x24.jpg\" src=\"/assets/loading_320x240.png\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8645/mars-helicopter-attached-to-nasas-perseverance-rover/\">\n Mars Helicopter Attached to NASA's Perseverance Rover\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide slick-cloned\" index=\"-1\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8641/nasas-perseverance-mars-rover-gets-its-wheels-and-air-brakes/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n After the rover was shipped from JPL to Kennedy Space Center, the team is getting closer to finalizing the spacecraft for launch later this summer.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"NASA's Perseverance Mars Rover Gets Its Wheels and Air Brakes\" class=\"img-lazy\" data-lazy=\"/system/news_items/list_view_images/8641_PIA-23821-320x240.jpg\" src=\"/assets/loading_320x240.png\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8641/nasas-perseverance-mars-rover-gets-its-wheels-and-air-brakes/\">\n NASA's Perseverance Mars Rover Gets Its Wheels and Air Brakes\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide slick-active\" index=\"0\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8716/nasa-to-broadcast-mars-2020-perseverance-launch-prelaunch-activities/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n Starting July 27, news activities will cover everything from mission engineering and science to returning samples from Mars to, of course, the launch itself.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"NASA to Broadcast Mars 2020 Perseverance Launch, Prelaunch Activities\" class=\"img-lazy\" src=\"/system/news_items/list_view_images/8716_PIA23499-320x240.jpg?1598917708276\" style=\"opacity: 1;\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8716/nasa-to-broadcast-mars-2020-perseverance-launch-prelaunch-activities/\">\n NASA to Broadcast Mars 2020 Perseverance Launch, Prelaunch Activities\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide slick-active\" index=\"1\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8695/the-launch-is-approaching-for-nasas-next-mars-rover-perseverance/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n The Red Planet's surface has been visited by eight NASA spacecraft. The ninth will be the first that includes a roundtrip ticket in its flight plan.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"The Launch Is Approaching for NASA's Next Mars Rover, Perseverance\" class=\"img-lazy\" src=\"/system/news_items/list_view_images/8695_24732_PIA23499-226.jpg?1598917708276\" style=\"opacity: 1;\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8695/the-launch-is-approaching-for-nasas-next-mars-rover-perseverance/\">\n The Launch Is Approaching for NASA's Next Mars Rover, Perseverance\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide slick-active\" index=\"2\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8692/nasa-to-hold-mars-2020-perseverance-rover-launch-briefing/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n Learn more about the agency's next Red Planet mission during a live event on June 17.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"NASA to Hold Mars 2020 Perseverance Rover Launch Briefing\" class=\"img-lazy\" src=\"/system/news_items/list_view_images/8692_PIA23920-320x240.jpg?1598917708276\" style=\"opacity: 1;\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8692/nasa-to-hold-mars-2020-perseverance-rover-launch-briefing/\">\n NASA to Hold Mars 2020 Perseverance Rover Launch Briefing\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide\" index=\"3\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8659/alabama-high-school-student-names-nasas-mars-helicopter/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n Vaneeza Rupani's essay was chosen as the name for the small spacecraft, which will mark NASA's first attempt at powered flight on another planet.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"Alabama High School Student Names NASA's Mars Helicopter\" class=\"img-lazy\" data-lazy=\"/system/news_items/list_view_images/8659_1-PIA23883-MAIN-320x240.jpg\" src=\"/assets/loading_320x240.png\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8659/alabama-high-school-student-names-nasas-mars-helicopter/\">\n Alabama High School Student Names NASA's Mars Helicopter\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide\" index=\"4\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8645/mars-helicopter-attached-to-nasas-perseverance-rover/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n The team also fueled the rover's sky crane to get ready for this summer's history-making launch.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"Mars Helicopter Attached to NASA's Perseverance Rover\" class=\"img-lazy\" data-lazy=\"/system/news_items/list_view_images/8645_PIA23824-RoverWithHelicopter-32x24.jpg\" src=\"/assets/loading_320x240.png\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8645/mars-helicopter-attached-to-nasas-perseverance-rover/\">\n Mars Helicopter Attached to NASA's Perseverance Rover\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide\" index=\"5\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8641/nasas-perseverance-mars-rover-gets-its-wheels-and-air-brakes/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n After the rover was shipped from JPL to Kennedy Space Center, the team is getting closer to finalizing the spacecraft for launch later this summer.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"NASA's Perseverance Mars Rover Gets Its Wheels and Air Brakes\" class=\"img-lazy\" data-lazy=\"/system/news_items/list_view_images/8641_PIA-23821-320x240.jpg\" src=\"/assets/loading_320x240.png\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8641/nasas-perseverance-mars-rover-gets-its-wheels-and-air-brakes/\">\n NASA's Perseverance Mars Rover Gets Its Wheels and Air Brakes\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide slick-cloned\" index=\"6\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8716/nasa-to-broadcast-mars-2020-perseverance-launch-prelaunch-activities/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n Starting July 27, news activities will cover everything from mission engineering and science to returning samples from Mars to, of course, the launch itself.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"NASA to Broadcast Mars 2020 Perseverance Launch, Prelaunch Activities\" class=\"img-lazy\" src=\"/system/news_items/list_view_images/8716_PIA23499-320x240.jpg?1598917708276\" style=\"opacity: 1;\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8716/nasa-to-broadcast-mars-2020-perseverance-launch-prelaunch-activities/\">\n NASA to Broadcast Mars 2020 Perseverance Launch, Prelaunch Activities\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide slick-cloned\" index=\"7\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8695/the-launch-is-approaching-for-nasas-next-mars-rover-perseverance/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n The Red Planet's surface has been visited by eight NASA spacecraft. The ninth will be the first that includes a roundtrip ticket in its flight plan.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"The Launch Is Approaching for NASA's Next Mars Rover, Perseverance\" class=\"img-lazy\" src=\"/system/news_items/list_view_images/8695_24732_PIA23499-226.jpg?1598917708277\" style=\"opacity: 1;\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8695/the-launch-is-approaching-for-nasas-next-mars-rover-perseverance/\">\n The Launch Is Approaching for NASA's Next Mars Rover, Perseverance\n </a>\n </div>\n </div>\n <div class=\"slide slick-slide slick-cloned\" index=\"8\" style=\"width: 332px;\">\n <div class=\"image_and_description_container\">\n <a href=\"/news/8692/nasa-to-hold-mars-2020-perseverance-rover-launch-briefing/\">\n <div class=\"rollover_description\">\n <div class=\"rollover_description_inner\">\n Learn more about the agency's next Red Planet mission during a live event on June 17.\n </div>\n <div class=\"overlay_arrow\">\n <img alt=\"More\" src=\"/assets/overlay-arrow.png\"/>\n </div>\n </div>\n <img alt=\"NASA to Hold Mars 2020 Perseverance Rover Launch Briefing\" class=\"img-lazy\" src=\"/system/news_items/list_view_images/8692_PIA23920-320x240.jpg?1598917708277\" style=\"opacity: 1;\"/>\n </a>\n </div>\n <div class=\"content_title\">\n <a href=\"/news/8692/nasa-to-hold-mars-2020-perseverance-rover-launch-briefing/\">\n NASA to Hold Mars 2020 Perseverance Rover Launch Briefing\n </a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"grid_layout\">\n <div class=\"slick-nav_container\">\n <div class=\"slick-nav\">\n <button class=\"slick-prev\" data-role=\"none\" style=\"display: block;\" type=\"button\">\n Previous\n </button>\n <button class=\"slick-next\" data-role=\"none\" style=\"display: block;\" type=\"button\">\n Next\n </button>\n </div>\n </div>\n </div>\n </div>\n </section>\n </div>\n </section>\n </div>\n <footer id=\"site_footer\">\n <div class=\"grid_layout\">\n <section class=\"upper_footer\">\n <div class=\"share_newsletter_container\">\n <div class=\"newsletter\">\n <h2>\n Get the Mars Newsletter\n </h2>\n <form action=\"/newsletter-subscribe\">\n <input id=\"email\" name=\"email\" placeholder=\"enter email address\" type=\"email\" value=\"\"/>\n <input data-disable-with=\"\" name=\"commit\" type=\"submit\" value=\"\"/>\n </form>\n </div>\n <div class=\"share\">\n <h2>\n Follow the Journey\n </h2>\n <div class=\"social_icons\">\n <!-- AddThis Button BEGIN -->\n <div class=\"addthis_toolbox addthis_default_style addthis_32x32_style\">\n <a addthis:userid=\"MarsCuriosity\" class=\"addthis_button_twitter_follow icon at300b\" href=\"//twitter.com/MarsCuriosity\" target=\"_blank\" title=\"Follow on Twitter\">\n <img alt=\"twitter\" src=\"/assets/[email protected]\"/>\n <span class=\"addthis_follow_label\">\n Twitter\n </span>\n </a>\n <a addthis:userid=\"MarsCuriosity\" class=\"addthis_button_facebook_follow icon at300b\" href=\"http://www.facebook.com/MarsCuriosity\" target=\"_blank\" title=\"Follow on Facebook\">\n <img alt=\"facebook\" src=\"/assets/[email protected]\"/>\n <span class=\"addthis_follow_label\">\n Facebook\n </span>\n </a>\n <a addthis:userid=\"nasa\" class=\"addthis_button_instagram_follow icon at300b\" href=\"http://instagram.com/nasa\" target=\"_blank\" title=\"Follow on Instagram\">\n <img alt=\"instagram\" src=\"/assets/[email protected]\"/>\n <span class=\"addthis_follow_label\">\n Instagram\n </span>\n </a>\n <a addthis:url=\"https://mars.nasa.gov/rss/api/?feed=news&category=all&feedtype=rss\" class=\"addthis_button_rss_follow icon at300b\" href=\"https://mars.nasa.gov/rss/api/?feed=news&category=all&feedtype=rss\" target=\"_blank\" title=\"Follow on RSS\">\n <img alt=\"rss\" src=\"/assets/[email protected]\"/>\n <span class=\"addthis_follow_label\">\n RSS\n </span>\n </a>\n <div class=\"atclear\">\n </div>\n </div>\n </div>\n <script src=\"//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5a690e4c1320e328\">\n </script>\n </div>\n </div>\n <div class=\"gradient_line\">\n </div>\n </section>\n <section class=\"sitemap\">\n <div class=\"sitemap_directory\" id=\"sitemap_directory\" style=\"position: relative; height: 293.516px;\">\n <div class=\"sitemap_block\" style=\"position: absolute; left: 0px; top: 0px;\">\n <div class=\"footer_sitemap_item\">\n <h3 class=\"sitemap_title\">\n <a href=\"/#red_planet\">\n The Red Planet\n </a>\n </h3>\n <ul>\n <li>\n <div class=\"global_subnav_container\">\n <ul class=\"subnav\">\n <li>\n <a href=\"/#red_planet/0\" target=\"_self\">\n Dashboard\n </a>\n </li>\n <li>\n <a href=\"/#red_planet/1\" target=\"_self\">\n Science Goals\n </a>\n </li>\n <li>\n <a href=\"/#red_planet/2\" target=\"_self\">\n The Planet\n </a>\n </li>\n <li>\n <a href=\"/#red_planet/3\" target=\"_self\">\n Atmosphere\n </a>\n </li>\n <li>\n <a href=\"/#red_planet/4\" target=\"_self\">\n Astrobiology\n </a>\n </li>\n <li>\n <a href=\"/#red_planet/5\" target=\"_self\">\n Past, Present, Future, Timeline\n </a>\n </li>\n </ul>\n </div>\n </li>\n </ul>\n </div>\n </div>\n <div class=\"sitemap_block\" style=\"position: absolute; left: 194px; top: 0px;\">\n <div class=\"footer_sitemap_item\">\n <h3 class=\"sitemap_title\">\n <a href=\"/#mars_exploration_program\">\n The Program\n </a>\n </h3>\n <ul>\n <li>\n <div class=\"global_subnav_container\">\n <ul class=\"subnav\">\n <li>\n <a href=\"/#mars_exploration_program/0\" target=\"_self\">\n Mission Statement\n </a>\n </li>\n <li>\n <a href=\"/#mars_exploration_program/1\" target=\"_self\">\n About the Program\n </a>\n </li>\n <li>\n <a href=\"/#mars_exploration_program/2\" target=\"_self\">\n Organization\n </a>\n </li>\n <li>\n <a href=\"/#mars_exploration_program/3\" target=\"_self\">\n Why Mars?\n </a>\n </li>\n <li>\n <a href=\"/#mars_exploration_program/4\" target=\"_self\">\n Research Programs\n </a>\n </li>\n <li>\n <a href=\"/#mars_exploration_program/5\" target=\"_self\">\n Planetary Resources\n </a>\n </li>\n <li>\n <a href=\"/#mars_exploration_program/6\" target=\"_self\">\n Technologies\n </a>\n </li>\n </ul>\n </div>\n </li>\n </ul>\n </div>\n </div>\n <div class=\"sitemap_block\" style=\"position: absolute; left: 388px; top: 0px;\">\n <div class=\"footer_sitemap_item\">\n <h3 class=\"sitemap_title\">\n <a href=\"/#news_and_events\">\n News & Events\n </a>\n </h3>\n <ul>\n <li>\n <div class=\"global_subnav_container\">\n <ul class=\"subnav\">\n <li class=\"current\">\n <a href=\"/news\" target=\"_self\">\n News\n </a>\n </li>\n <li>\n <a href=\"/events\" target=\"_self\">\n Events\n </a>\n </li>\n </ul>\n </div>\n </li>\n </ul>\n </div>\n </div>\n <div class=\"sitemap_block\" style=\"position: absolute; left: 582px; top: 0px;\">\n <div class=\"footer_sitemap_item\">\n <h3 class=\"sitemap_title\">\n <a href=\"/#multimedia\">\n Multimedia\n </a>\n </h3>\n <ul>\n <li>\n <div class=\"global_subnav_container\">\n <ul class=\"subnav\">\n <li>\n <a href=\"/multimedia/images/\" target=\"_self\">\n Images\n </a>\n </li>\n <li>\n <a href=\"/multimedia/videos/\" target=\"_self\">\n Videos\n </a>\n </li>\n <li>\n <a href=\"/multimedia/more-resources/\" target=\"_self\">\n More Resources\n </a>\n </li>\n </ul>\n </div>\n </li>\n </ul>\n </div>\n </div>\n <div class=\"sitemap_block\" style=\"position: absolute; left: 776px; top: 0px;\">\n <div class=\"footer_sitemap_item\">\n <h3 class=\"sitemap_title\">\n <a href=\"/#missions_gallery_subnav\">\n Missions\n </a>\n </h3>\n <ul>\n <li>\n <div class=\"global_subnav_container\">\n <ul class=\"subnav\">\n <li>\n <a href=\"/mars-exploration/missions/?category=167\" target=\"_self\">\n Past\n </a>\n </li>\n <li>\n <a href=\"/mars-exploration/missions/?category=170\" target=\"_self\">\n Present\n </a>\n </li>\n <li>\n <a href=\"/mars-exploration/missions/?category=171\" target=\"_self\">\n Future\n </a>\n </li>\n <li>\n <a href=\"/mars-exploration/partners\" target=\"_self\">\n International Partners\n </a>\n </li>\n </ul>\n </div>\n </li>\n </ul>\n </div>\n </div>\n <div class=\"sitemap_block\" style=\"position: absolute; left: 970px; top: 0px;\">\n <div class=\"footer_sitemap_item\">\n <h3 class=\"sitemap_title\">\n <a href=\"/#more\">\n More\n </a>\n </h3>\n <ul>\n <li>\n <div class=\"global_subnav_container\">\n <ul class=\"subnav\">\n </ul>\n </div>\n </li>\n </ul>\n </div>\n </div>\n </div>\n <div class=\"gradient_line\">\n </div>\n </section>\n <section class=\"lower_footer\">\n <div class=\"nav_container\">\n <nav>\n <ul>\n <li>\n <a href=\"http://science.nasa.gov/\" target=\"_blank\">\n NASA Science Mission Directorate\n </a>\n </li>\n <li>\n <a href=\"https://www.jpl.nasa.gov/copyrights.php\" target=\"_blank\">\n Privacy\n </a>\n </li>\n <li>\n <a href=\"http://www.jpl.nasa.gov/imagepolicy/\" target=\"_blank\">\n Image Policy\n </a>\n </li>\n <li>\n <a href=\"https://mars.nasa.gov/feedback/\" target=\"_self\">\n Feedback\n </a>\n </li>\n </ul>\n </nav>\n </div>\n <div class=\"credits\">\n <div class=\"footer_brands_top\">\n <p>\n Managed by the Mars Exploration Program and the Jet Propulsion Laboratory for NASA’s Science Mission Directorate\n </p>\n </div>\n <!-- .footer_brands -->\n <!-- %a.jpl{href: \"\", target: \"_blank\"}Institution -->\n <!-- -->\n <!-- %a.caltech{href: \"\", target: \"_blank\"}Institution -->\n <!-- .staff -->\n <!-- %p -->\n <!-- - get_staff_for_category(get_field_from_admin_config(:web_staff_category_id)) -->\n <!-- - @staff.each_with_index do |staff, idx| -->\n <!-- - unless staff.is_in_footer == 0 -->\n <!-- = staff.title + \": \" -->\n <!-- - if staff.contact_link =~ /@/ -->\n <!-- = mail_to staff.contact_link, staff.name, :subject => \"[#{@site_title}]\" -->\n <!-- - elsif staff.contact_link.present? -->\n <!-- = link_to staff.name, staff.contact_link -->\n <!-- - else -->\n <!-- = staff.name -->\n <!-- - unless (idx + 1 == @staff.size) -->\n <!-- %br -->\n </div>\n </section>\n </div>\n </footer>\n </div>\n </div>\n <div id=\"_atssh\" style=\"visibility: hidden; height: 1px; width: 1px; position: absolute; top: -9999px; z-index: 100000;\">\n <iframe id=\"_atssh19\" src=\"https://s7.addthis.com/static/sh.f48a1a04fe8dbf021b4cda1d.html#rand=0.15475128410496586&iit=1598917708381&tmr=load%3D1598917708022%26core%3D1598917708080%26main%3D1598917708370%26ifr%3D1598917708388&cb=0&cdn=0&md=0&kw=Mars%2Cmissions%2CNASA%2Crover%2CCuriosity%2COpportunity%2CInSight%2CMars%20Reconnaissance%20Orbiter%2Cfacts&ab=-&dh=mars.nasa.gov&dr=&du=https%3A%2F%2Fmars.nasa.gov%2Fnews%2F&href=https%3A%2F%2Fmars.nasa.gov%2Fnews%2F&dt=News%20%20%E2%80%93%20NASA%E2%80%99s%20Mars%20Exploration%20Program&dbg=0&cap=tc%3D0%26ab%3D0&inst=1&jsl=1&prod=undefined&lng=en&ogt=image%2Cupdated_time%2Ctype%3Darticle%2Curl%2Ctitle%2Cdescription%2Csite_name&pc=men&pub=ra-5a690e4c1320e328&ssl=1&sid=5f4d8c4c188abfcf&srf=0.01&ver=300&xck=1&xtr=0&og=site_name%3DNASA%25E2%2580%2599s%2520Mars%2520Exploration%2520Program%26description%3DNASA%25E2%2580%2599s%2520real-time%2520portal%2520for%2520Mars%2520exploration%252C%2520featuring%2520the%2520latest%2520news%252C%2520images%252C%2520and%2520discoveries%2520from%2520the%2520Red%2520Planet.%26title%3DNews%2520%2520%25E2%2580%2593%2520NASA%25E2%2580%2599s%2520Mars%2520Exploration%2520Program%26url%3Dhttps%253A%252F%252Fmars.nasa.gov%252Fnews%26type%3Darticle%26updated_time%3D2017-09-22%252019%253A53%253A22%2520UTC%26image%3Dhttps%253A%252F%252Fmars.nasa.gov%252Fsystem%252Fsite_config_values%252Fmeta_share_images%252F1_mars-nasa-gov.jpg&csi=undefined&rev=v8.28.7-wp&ct=1&xld=1&xd=1\" style=\"height: 1px; width: 1px; position: absolute; top: 0px; z-index: 100000; border: 0px; left: 0px;\" title=\"AddThis utility frame\">\n </iframe>\n </div>\n <style id=\"service-icons-0\">\n </style>\n <script id=\"_fed_an_ua_tag\" src=\"https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=NASA&subagency=JPL-Mars-MEPJPL&pua=UA-9453474-9,UA-118212757-11&dclink=true&sp=searchbox&exts=tif,tiff,wav\" type=\"text/javascript\">\n </script>\n </body>\n</html>\n"
],
[
"#get the newest title from website\nelement = soup.select_one('ul.item_list li.slide')\nelement",
"_____no_output_____"
],
[
"\nnews_titles = element.find('div', class_=\"content_title\").get_text()\n",
"_____no_output_____"
],
[
"news_titles",
"_____no_output_____"
],
[
"#get paragraph from website\nnews_p = element.find('div', class_=\"article_teaser_body\").get_text()\nprint(news_p)",
"_____no_output_____"
],
[
"#get the current feature mars image \nwebsite_url = 'https://www.jpl.nasa.gov/spaceimages/?search=&category=Mars'\ncore_url = 'https://www.jpl.nasa.gov'\n#image_url = \"/spaceimages/images/largesize/PIA17838_hires.jpg\"\n#fina_url = core_url + imag_url\n#fina_url",
"_____no_output_____"
],
[
"#Visit the url for JPL Featured Space Image here\nbrowser.visit(website_url)\n",
"_____no_output_____"
],
[
"#Use splinter to navigate the site and find the image url for the current Featured Mars Image and \n#assign the url string to a variable called featured_image_url\nelement_full_image = browser.find_by_id(\"full_image\")\nelement_full_image.click()\n",
"_____no_output_____"
],
[
"browser.is_element_present_by_text('more info', wait_time = 1)\nelement_more_info = browser.links.find_by_partial_text('more info')\nelement_more_info.click()",
"_____no_output_____"
],
[
"#Make sure to find the image url to the full size .jpg image\nimage_html = browser.html\nimage_soup = BeautifulSoup(image_html, 'html.parser')",
"_____no_output_____"
],
[
"#Make sure to save a complete url string for this image\nimage_url_final = image_soup.select_one('figure.lede a img').get('src')\nimage_url_final",
"_____no_output_____"
],
[
"final_url = core_url + image_url_final\nfinal_url",
"_____no_output_____"
],
[
"mars_info = 'https://space-facts.com/mars/'\ntable = pd.read_html(mars_info)\ntable[0]",
"_____no_output_____"
],
[
"mars_info_df = table[0]\nmars_info_df.columns = [\"Info\", \"Value\"]\nmars_info_df.set_index([\"Info\"], inplace=True)\nmars_info_df",
"_____no_output_____"
],
[
"info_html = mars_info_df.to_html()\ninfo_html = info_html.replace(\"\\n\",\"\")\ninfo_html",
"_____no_output_____"
],
[
"cerberus_url = 'https://astrogeology.usgs.gov/search/map/Mars/Viking/cerberus_enhanced'\nresponse = requests.get(cerberus_url)\nsoup = BeautifulSoup(response.text, 'html.parser')",
"_____no_output_____"
],
[
"cerberus_image = soup.find_all('div', class_=\"wide-image-wrapper\")\nprint(cerberus_image)",
"[<div class=\"wide-image-wrapper\" id=\"wide-image\">\n<div class=\"downloads\">\n<img class=\"thumb\" src=\"/cache/images/39d3266553462198bd2fbc4d18fbed17_cerberus_enhanced.tif_thumb.png\"/>\n<h3>Download</h3>\n<ul>\n<li><a href=\"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif/full.jpg\" target=\"_blank\">Sample</a> (jpg) 1024px wide</li>\n<li><a href=\"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif\" target=\"_blank\">Original</a> (tif) 21 MB</li>\n</ul>\n</div>\n<img class=\"wide-image\" src=\"/cache/images/f5e372a36edfa389625da6d0cc25d905_cerberus_enhanced.tif_full.jpg\"/>\n<a class=\"open-toggle\" href=\"#open\" id=\"wide-image-toggle\">Open</a>\n</div>]\n"
],
[
"for image in cerberus_image:\n picture = image.find('li')\n full_image = picture.find('a')['href']\n print(full_image)\ncerberus_title = soup.find('h2', class_='title').text\nprint(cerberus_title)\ncerberus_hem = {\"Title\": cerberus_title, \"url\": full_image}\nprint(cerberus_hem)",
"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif/full.jpg\nCerberus Hemisphere Enhanced\n{'Title': 'Cerberus Hemisphere Enhanced', 'url': 'https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif/full.jpg'}\n"
],
[
"schiaparelli_url = 'https://astrogeology.usgs.gov/search/map/Mars/Viking/schiaparelli_enhanced'",
"_____no_output_____"
],
[
"response = requests.get(cerberus_url)\nsoup = BeautifulSoup(response.text, 'html.parser')",
"_____no_output_____"
],
[
"schiaparelli_image = soup.find_all('div', class_=\"wide-image-wrapper\")\nprint(schiaparelli_image)",
"[<div class=\"wide-image-wrapper\" id=\"wide-image\">\n<div class=\"downloads\">\n<img class=\"thumb\" src=\"/cache/images/39d3266553462198bd2fbc4d18fbed17_cerberus_enhanced.tif_thumb.png\"/>\n<h3>Download</h3>\n<ul>\n<li><a href=\"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif/full.jpg\" target=\"_blank\">Sample</a> (jpg) 1024px wide</li>\n<li><a href=\"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif\" target=\"_blank\">Original</a> (tif) 21 MB</li>\n</ul>\n</div>\n<img class=\"wide-image\" src=\"/cache/images/f5e372a36edfa389625da6d0cc25d905_cerberus_enhanced.tif_full.jpg\"/>\n<a class=\"open-toggle\" href=\"#open\" id=\"wide-image-toggle\">Open</a>\n</div>]\n"
],
[
"for image in schiaparelli_image:\n picture = image.find('li')\n full_image2 = picture.find('a')['href']\n print(full_image2)\nschiaparelli_title = soup.find('h2', class_='title').text\nprint(schiaparelli_title)\nschiaparelli_hem = {\"Title\": schiaparelli_title, \"url\": full_image2}\nprint(schiaparelli_hem)",
"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif/full.jpg\nCerberus Hemisphere Enhanced\n{'Title': 'Cerberus Hemisphere Enhanced', 'url': 'https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/cerberus_enhanced.tif/full.jpg'}\n"
],
[
"syrtis_url = 'https://astrogeology.usgs.gov/search/map/Mars/Viking/syrtis_major_enhanced'",
"_____no_output_____"
],
[
"response = requests.get(syrtis_url)\nsoup = BeautifulSoup(response.text, 'html.parser')",
"_____no_output_____"
],
[
"syrtis_image = soup.find_all('div', class_=\"wide-image-wrapper\")\nprint(syrtis_image)",
"[<div class=\"wide-image-wrapper\" id=\"wide-image\">\n<div class=\"downloads\">\n<img class=\"thumb\" src=\"/cache/images/55a0a1e2796313fdeafb17c35925e8ac_syrtis_major_enhanced.tif_thumb.png\"/>\n<h3>Download</h3>\n<ul>\n<li><a href=\"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/syrtis_major_enhanced.tif/full.jpg\" target=\"_blank\">Sample</a> (jpg) 1024px wide</li>\n<li><a href=\"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/syrtis_major_enhanced.tif\" target=\"_blank\">Original</a> (tif) 25 MB</li>\n</ul>\n</div>\n<img class=\"wide-image\" src=\"/cache/images/555e6403a6ddd7ba16ddb0e471cadcf7_syrtis_major_enhanced.tif_full.jpg\"/>\n<a class=\"open-toggle\" href=\"#open\" id=\"wide-image-toggle\">Open</a>\n</div>]\n"
],
[
"for image in syrtis_image:\n picture = image.find('li')\n full_image3 = picture.find('a')['href']\n print(full_image3)\nsyrtis_title = soup.find('h2', class_='title').text\nprint(syrtis_title)\nsyrtis_hem = {\"Title\": syrtis_title, \"url\": full_image3}\nprint(syrtis_hem)",
"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/syrtis_major_enhanced.tif/full.jpg\nSyrtis Major Hemisphere Enhanced\n{'Title': 'Syrtis Major Hemisphere Enhanced', 'url': 'https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/syrtis_major_enhanced.tif/full.jpg'}\n"
],
[
"valles_url = 'https://astrogeology.usgs.gov/search/map/Mars/Viking/valles_marineris_enhanced'",
"_____no_output_____"
],
[
"response = requests.get(valles_url)\nsoup = BeautifulSoup(response.text, 'html.parser')",
"_____no_output_____"
],
[
"valles_image = soup.find_all('div', class_=\"wide-image-wrapper\")\nprint(valles_image)",
"[<div class=\"wide-image-wrapper\" id=\"wide-image\">\n<div class=\"downloads\">\n<img class=\"thumb\" src=\"/cache/images/4e59980c1c57f89c680c0e1ccabbeff1_valles_marineris_enhanced.tif_thumb.png\"/>\n<h3>Download</h3>\n<ul>\n<li><a href=\"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/valles_marineris_enhanced.tif/full.jpg\" target=\"_blank\">Sample</a> (jpg) 1024px wide</li>\n<li><a href=\"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/valles_marineris_enhanced.tif\" target=\"_blank\">Original</a> (tif) 27 MB</li>\n</ul>\n</div>\n<img class=\"wide-image\" src=\"/cache/images/b3c7c6c9138f57b4756be9b9c43e3a48_valles_marineris_enhanced.tif_full.jpg\"/>\n<a class=\"open-toggle\" href=\"#open\" id=\"wide-image-toggle\">Open</a>\n</div>]\n"
],
[
"for image in valles_image:\n picture = image.find('li')\n full_image4 = picture.find('a')['href']\n print(full_image4)\nvalles_title = soup.find('h2', class_='title').text\nprint(valles_title)\nvalles_hem = {\"Title\": valles_title, \"url\": full_image4}\nprint(valles_hem)",
"https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/valles_marineris_enhanced.tif/full.jpg\nValles Marineris Hemisphere Enhanced\n{'Title': 'Valles Marineris Hemisphere Enhanced', 'url': 'https://astropedia.astrogeology.usgs.gov/download/Mars/Viking/valles_marineris_enhanced.tif/full.jpg'}\n"
],
[
"mars_hemispheres = [{\"Title\": cerberus_title, \"url\": full_image},\n {\"Title\": schiaparelli_title, \"url\": full_image2},\n {\"Title\": syrtis_title, \"url\": full_image3},\n {\"Title\": valles_title, \"url\": full_image4}]\n ",
"_____no_output_____"
],
[
"mars_hemispheres",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6c48a7f535faab5288342778c6cc2f63cba82c | 80,291 | ipynb | Jupyter Notebook | Data_Science_2/Full_Day/Full_Day_3-AzureMLStudio-Reference-Simplified-Chinese.ipynb | Prtfw/Reactors | b216994d1903c3227583c050a6dcea357270bece | [
"MIT"
]
| 2 | 2020-05-07T12:10:56.000Z | 2021-11-21T12:09:38.000Z | Data_Science_2/Full_Day/Full_Day_3-AzureMLStudio-Reference-Simplified-Chinese.ipynb | Prtfw/Reactors | b216994d1903c3227583c050a6dcea357270bece | [
"MIT"
]
| null | null | null | Data_Science_2/Full_Day/Full_Day_3-AzureMLStudio-Reference-Simplified-Chinese.ipynb | Prtfw/Reactors | b216994d1903c3227583c050a6dcea357270bece | [
"MIT"
]
| 6 | 2020-05-07T11:53:00.000Z | 2020-07-28T00:49:26.000Z | 240.392216 | 37,095 | 0.847393 | [
[
[
"# Cloud-based machine learning || 云端机器学习\n\nThus far, we have looked at building and fitting ML models “locally.” True, the notebooks have been located in the cloud themselves, but the models with all of their predictive and classification power are stuck in those notebooks. To use these models, you would have to load data into your notebooks and get the results there.\n\n到目前为止,我们已经在“本地”构建和調適機器學習模型。的确,这些notebook檔案本身已经在云端,但是所有预测和分类功能的模型也都只在这些notebook中。 要使用这些模型,您必须将数据加载到其中以获取结果。\n\nIn practice, we want those models accessible from a number of locations. And while the management of production ML models has a lifecycle all its own, one part of that is making models accessible from the web. One way to do so is to develop them using third-party cloud tools, such as [Microsoft Azure ML Studio](https://studio.azureml.net) (not to be confused with Microsoft Azure Machine Learning sService, which provides end-to-end lifecycle management for ML models).\n\n在实际操作中,我们希望可以从多个位置取得这些模型。 尽管生产ML模型的管理具有其自己的生命周期,使模型可以从网络获取是其中一部分。使用第三方云端工具是一种开发方式,例如Microsoft Azure ML Studio。(不要与Microsoft Azure Machine Learning sService混淆,后者为ML模型提供端到端的生命周期管理)。\n\nAlternatively, we can develop and deploy a function that can be accessed by other programs over the web—a web service—that runs within Azure ML Studio, and we can do so entirely from a Python notebook. In this section, we will use the [`azureml`](https://github.com/Azure/Azure-MachineLearning-ClientLibrary-Python) package to deploy an Azure ML web service directly from within a Python notebook (or other Python environment).\n\n或者,我们可以开发和部署一个功能,该功能可以在Azure ML Studio中运行,并且我们可以通过Web上的其他程序通过Web服务来访问,并且可以完全通过Python notebook进行操作。 在本节中,我们将使用azureml package直接在一個Python notebook(或其他Python环境)中部署Azure ML Web服务。\n\n> <font color=red>**Note:**</font> The `azureml` package presently works only with Python 2. If your notebook is not currently running Python 2, change it in the menu at the top of the notebook by clicking **Kernel > Change kernel > Python 2**.\n\n\n> 注意:azureml软件包目前仅支持Python2。如果您的notebook当前未运行Python 2,请在上方菜单中单击进行更改\nKernel>Change Kernel> Python 2。\n\n## Create and connect to an Azure ML Studio workspace || 创建并连接到Azure ML Studio工作区\n\nThe `azureml` package is installed by default with Azure Notebooks, so we don't have to worry about that. It uses an Azure ML Studio workspace ID and authorization token to connect your notebook to the workspace; you will obtain the ID and token by following these steps:\n\nAzure笔记本会把Azureml软件包默认安装,它使用Azure ML Studio工作区ID和授权令牌确认将笔记本连接到工作区。遵循以下步骤,您将获取ID和令牌:\n\n1. Open [Azure ML Studio](https://studio.azureml.net) in a new browser tab and sign in with a Microsoft account. Azure ML Studio is free and does not require an Azure subscription. Once signed in with your Microsoft account (the same credentials you’ve used for Azure Notebooks), you're in your “workspace.”\n\n 在新的浏览器选项标签中打开Azure ML Studio,然后使用Microsoft帐户登录。 Azure ML Studio是免费的,不用认购就能使用。 使用Microsoft帐户(与Azure notebook使用的凭证相同)登录后,就可进入“工作区”。\n \n \n2. On the left pane, click **Settings**.\n\n 在左窗格中单击设置。\n\n <br/><br/>\n \n\n3. On the **Name** tab, the **Workspace ID** field contains your workspace ID. Copy that ID into the `workspace_id` value in the code cell in Step 5 of the notebook below.\n \n 在``名称''选项标签上的``工作区ID''字段上有您的工作区ID。 将该ID复制到下面第5步代码单元中的workspace_id值。\n\n <br/><br/>\n \n\n4. Click the **Authorization Tokens** tab, and then copy either token into the `authorization_token` value in the code cell in Step 5 of the notebook.\n\n 单击“授权token”选项,然后复制任一token至第5步代码单元中的authorization_token”值中。\n\n <br/><br/>\n \n\n5.\tRun the code cell below; if it runs without error, you're ready to continue.\n 运行下面的代码单元; 如果没有错误可继续运行。",
"_____no_output_____"
]
],
[
[
"from azureml import Workspace\n\n# Replace the values with those from your own Azure ML Studio instance; see Prerequisites\n# The workspace_id is a string of hexadecimal characters; the token is a long string of random characters.\n\n# 将值替换为您自己的Azure ML Studio实例中的值; 请参阅前提条件(Prerequisites)\n# workspace_id是十六进制字符的字符串; token是一长串随机字符。\n\nworkspace_id = 'deff291c5b7b42f1b5fdc60669aa8f8b'\nauthorization_token = 'token'\n\nws = Workspace(workspace_id, authorization_token)",
"_____no_output_____"
]
],
[
[
"## Explore forest fire data\n\nLet’s look at a meteorological dataset collected by Cortez and Morais for 2007 to study the burned area of forest fires in the northeast region of Portugal.\n\n让我们看一下由Cortez和Morais于2007年收集到的气象数据集,研究的是葡萄牙东北部森林大火燃烧面积\n\n> P. Cortez and A. Morais. A Data Mining Approach to Predict Forest Fires using Meteorological Data. \n In J. Neves, M. F. Santos and J. Machado Eds., New Trends in Artificial Intelligence, \n Proceedings of the 13th EPIA 2007 - Portuguese Conference on Artificial Intelligence, December, \n Guimaraes, Portugal, pp. 512-523, 2007. APPIA, ISBN-13 978-989-95618-0-9. \n \n> P. Cortez和A. Morais。一种使用气象数据预测森林火灾的数据挖掘方法。。 参见J. Neves,MF Santos和J. Machado编辑,《人工智能的新趋势》,第13届EPIA大会论文集-葡萄牙人工智能会议,12月,葡萄牙吉马良斯,第512-523页,2007年。APPIA,ISBN -13 978-989-95618-0-9。\n\n\nThe dataset contains the following features:\n\n数据集包含以下特征:\n\n- **`X`**: x-axis spatial coordinate within the Montesinho park map: 1 to 9\n- **`Y`**: y-axis spatial coordinate within the Montesinho park map: 2 to 9\n- **`month`**: month of the year: \"1\" to \"12\" jan-dec\n- **`day`**: day of the week: \"1\" to \"7\" sun-sat\n- **`FFMC`**: FFMC index from the FWI system: 18.7 to 96.20\n- **`DMC`**: DMC index from the FWI system: 1.1 to 291.3 \n- **`DC`**: DC index from the FWI system: 7.9 to 860.6 \n- **`ISI`**: ISI index from the FWI system: 0.0 to 56.10\n- **`temp`**: temperature in Celsius degrees: 2.2 to 33.30\n- **`RH`**: relative humidity in %: 15.0 to 100\n- **`wind`**: wind speed in km/h: 0.40 to 9.40 \n- **`rain`**: outside rain in mm/m2 : 0.0 to 6.4 \n- **`area`**: the burned area of the forest (in ha): 0.00 to 1090.84 \n\n\n- X:Montesinho公园地图内的x轴空间坐标:1到9\n\n- Y:Montesinho公园地图内的y轴空间坐标:2到9\n\n- month:一年中的月份:“ 1”至“ 12” 指一月至十二月\n\n- 日期:一星期的天數:“ 1”至“ 7”指星期一至星期日\n\n- FFMC:FWI系统中的FFMC指数:18.7至96.20\n\n- DMC:来自FWI系统的DMC指数:1.1至291.3\n\n- DC:FWI系统中的DC指数:7.9至860.6\n\n- ISI:FWI系统中的ISI指数:0.0至56.10\n\n- temp:摄氏温度:2.2至33.30\n\n- RH:相对湿度(%):15.0至100\n\n- 风:以km / h为单位的风速:0.40至9.40\n\n- 雨水:室外雨水(mm / m2):0.0至6.4\n\n- 面积:森林被烧毁的面积(公顷):0.00至1090.84\n",
"_____no_output_____"
],
[
"Let's load the dataset and visualize the area that was burned in relation to the temperature in that region.\n\n让我们加载数据集,并可视化区域温度与燃烧区域的关系。\n",
"_____no_output_____"
]
],
[
[
"import pandas as pd\ndf = pd.DataFrame(pd.read_csv('./Data/forestfires.csv'))\n%matplotlib inline\nfrom ggplot import *\nggplot(aes(x='temp', y='area'), data=df) + geom_line() + geom_point()",
"_____no_output_____"
]
],
[
[
"Intuitively, the hotter the weather, the more hectares burned in forest fires.\n\n直观地说,天气越热,森林大火烧毁的公顷数就越多。",
"_____no_output_____"
],
[
"## Transfer your data to Azure ML Studio\n\nWe have our data, but how do we get it into Azure ML Studio in order to use it there? That is where the `azureml` package comes in. It enables us to load data and models into Azure ML Studio from an Azure Notebook (or any Python environment).\n\n我们有我们的数据,但是我们如何将其放入Azure ML Studio以便在那里使用?这就是“azureml”包的好处。它使我们能够从Azure笔记本(或任何Python环境)将数据和模型加载到Azure ML Studio中。\n\nThe first code cell of this notebook is what establishes the connection with *your* Azure ML Studio account.\n\n此笔记本的第一个代码单元是与*您的*Azure ML Studio帐户建立连接。",
"_____no_output_____"
],
[
"Now that you have your notebook talking to Azure ML Studio, you can export your data to it:\n现在您的笔记本已经与Azure ML Studio进行了对话,您可以将数据导出到云端:",
"_____no_output_____"
]
],
[
[
"# from azureml import DataTypeIds\n\n# dataset = ws.datasets.add_from_dataframe(\n# dataframe=df,\n# data_type_id=DataTypeIds.GenericCSV,\n# name='Forest Fire Data 2',\n# description='Paulo Cortez and Aníbal Morais (Univ. Minho) @ 2007'\n# )",
"_____no_output_____"
]
],
[
[
"After running the code above, you can see the dataset listed in the **Datasets** section of the Azure Machine Learning Studio workspace. (**Note**: You might need to switch between browser tabs and refresh the page in order to see the dataset.)\n\n运行上述代码后,您可以在Azure Machine Learning Studio工作区的**数据集**部分中看到列出的数据集\n\n<br/>\n\nIt is also straightforward to list the datasets available in the workspace and transfer datasets from the workspace to the notebook:\n\n列出工作区中可用的数据集并将数据集从工作区传输到笔记本也很简单:",
"_____no_output_____"
]
],
[
[
"print('\\n'.join([i.name for i in ws.datasets if not i.is_example])) # only list user-created datasets",
"Forest Fire Data\nForest Fire Data 2\n"
]
],
[
[
"You can also interact with and examine the dataset in Azure ML Studio directly from your notebook:\n您还可以直接从笔记本与Azure ML Studio中的数据集进行操作和检查:",
"_____no_output_____"
]
],
[
[
"# Read some more of the metadata\nds = ws.datasets['Forest Fire Data 2']\nprint(ds.name)\nprint(ds.description)\nprint(ds.family_id)\nprint(ds.data_type_id)\nprint(ds.created_date)\nprint(ds.size)\n\n# Read the contents\ndf2 = ds.to_dataframe()\ndf2.head()",
"Forest Fire Data 2\nPaulo Cortez and Aníbal Morais (Univ. Minho) @ 2007\nbb121b3a973f4e57b21477c933c171a8\nGenericCSV\n2020-05-03 21:01:05.096000\n25557\n"
]
],
[
[
"## Create your model || 创建模型\n\nWe're now back into familiar territory: prepping data for the model and fitting the model. To keep it interesting, we'll use the scikit-learn `train_test_split()` function with a slight change of parameters to select 75 percent of the data points for training and 25 percent for validation (testing).\n\n现在我们又回到了熟悉的领域:为模型准备数据并拟合模型。\n我们将使用scikit learn“train_test_split()”,只需稍微更改参数,就可以选择75%的数据点进行训练,25%的数据点进行验证(测试)。\n\n",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import train_test_split\n\nX_train, X_test, y_train, y_test = train_test_split(\n df[['wind','rain','month','RH']],\n df['temp'],\n test_size=0.25,\n random_state=42\n )",
"_____no_output_____"
]
],
[
[
"Did you see what we did there? Rather than select all of the variables for the model, we were more selective and just chose windspeed, rainfall, month, and relative humidity in order to predict temperature.\n\n我们没有为模型选择所有的变量,而是选择了[风速、降雨量、月份,相对湿度]来预测温度。\n\nFit scikit-learn's `DecisionTreeRegressor` model using the training data. This algorithm is a combination of the linear regression and decision tree classification that you worked with in Section 6.\n\n使用训练数据拟合scikit learn的“决策树处理器”模型。此算法是您在第6节中使用的线性回归和决策树分类的组合。",
"_____no_output_____"
]
],
[
[
"from sklearn.tree import DecisionTreeRegressor\nfrom sklearn.metrics import r2_score\nregressor = DecisionTreeRegressor(random_state=42)\nregressor.fit(X_train, y_train)\ny_test_predictions = regressor.predict(X_test)\nprint('R^2 for true vs. predicted test set forest temperature: {:0.2f}'.format(r2_score(y_test, y_test_predictions)))",
"R^2 for true vs. predicted test set forest temperature: 0.63\n"
],
[
"# Play around with this algorithm. 玩玩这个算法。\n# Can you get better results changing the variables you select for the training and test data? \n# 改变你为训练和测试数据选择的变量,你能得到更好的结果吗?\n# What if you look at different variables for the response?\n# 改变选择的变量来预测温度?",
"_____no_output_____"
]
],
[
[
"## Deploy your model as a web service || 将模型部署为web服务\n\nThis is the important part. Once deployed as a web service, your model can be accessed from anywhere. This means that rather than refit a model every time you need a new prediction for a business or humanitarian use case, you can send the data to the pre-fitted model and get back a prediction.\n\n这是重要的部分。一旦部署为web服务,就可以从任何地方访问您的模型。\n\nFirst, deploy the model as a predictive web service. To do so, create a wrapper function that takes input data as an argument and calls `predict()` with your trained model and this input data, returning the results.\n\n首先,将模型部署为预测性web服务。 然后,创建一个\"包装器\"函数,该函数将输入数据作为参数,并使用经过训练的模型和该输入数据调用“predict()”,返回结果。",
"_____no_output_____"
]
],
[
[
"from azureml import services\n\[email protected](workspace_id, authorization_token)\[email protected](wind=float, rain=float, month=int, RH=float)\[email protected](float)\n\n# The name of your web service is set to this function's name\n# web服务的名称将设置为此函数的名称\n\n\ndef forest_fire_predictor(wind, rain, month, RH):\n return regressor.predict([wind, rain, month, RH])\n\n# Hold onto information about your web service so \n# you can call it within the notebook later\nservice_url = forest_fire_predictor.service.url \napi_key = forest_fire_predictor.service.api_key\nhelp_url = forest_fire_predictor.service.help_url\nservice_id = forest_fire_predictor.service.service_id",
"_____no_output_____"
]
],
[
[
"You can also go to the **Web Services** section of your Azure ML Studio workspace to see the predictive web service running there.\n\n您还可以转到Azure ML Studio工作区的**Web服务**部分,查看在那里运行的Web服务。",
"_____no_output_____"
],
[
"## Consuming the web service || 使用web服务\n\nNext, consume the web service. To see if this works, try it here from the notebook session in which the web service was created. Just call the predictor directly:\n\n接下来,使用web服务。若要查看此方法是否有效,请在创建web服务的笔记本直接预测:",
"_____no_output_____"
]
],
[
[
"forest_fire_predictor.service(5.4, 0.2, 9, 22.1)",
"_____no_output_____"
]
],
[
[
"At any later time, you can use the stored API key and service URL to call the service. In the example below, data can be packaged in JavaScript Object Notation (JSON) format and sent to the web service.\n\n以后任何时候,您都可以使用存储的API密钥和服务URL来调用服务。在下面的示例中,数据可以用(JSON)格式打包并发送到web服务。",
"_____no_output_____"
]
],
[
[
"import urllib2\nimport json\n\ndata = {\"Inputs\": { \n \"input1\": {\n \"ColumnNames\": [ \"wind\", \"rain\", \"month\", \"RH\"],\n \"Values\": [[\"5.4\", \"0.2\", \"9\", \"22.1\"]] \n }\n }, # Specified feature values\n \n \"GlobalParameters\": {}\n }\n\nbody = json.dumps(data)\nheaders = {'Content-Type':'application/json', 'Authorization':('Bearer '+ api_key)}\nreq = urllib2.Request(service_url, body, headers) \n\ntry:\n response = urllib2.urlopen(req)\n result = json.loads(response.read()) # load JSON-formatted string response as dictionary\n print(result['Results']['output1']['value']['Values'][0][0]) # Get the returned prediction\n \nexcept urllib2.HTTPError, error:\n print(\"The request failed with status code: \" + str(error.code))\n print(error.info())\n print(json.loads(error.read())) ",
"26.4\n"
],
[
"from sklearn.datasets import load_iris\n'''\nIris plants dataset\nData Set Characteristics:\n\nNumber of Instances\n150 (50 in each of three classes)\n\nNumber of Attributes\n4 numeric, predictive attributes and the class\n\nAttribute Information\nsepal length in cm\n\nsepal width in cm\n\npetal length in cm\n\npetal width in cm\n\nclass:\nIris-Setosa\n\nIris-Versicolour\n\nIris-Virginica\n\nMissing Attribute Values\nNone\n\nClass Distribution\n33.3% for each of 3 classes.\n\nCreator\nR.A. Fisher\n'''\n\n# 鸢尾花植物数据集\n# 数据集特征:\n\n# 实例数\n# 150(三类各50个)\n\n# 属性数\n# 4个数值,预测属性和类别\n\n# 属性信息\n# 花萼长度(厘米)\n\n# 花萼宽度(厘米)\n\n# 花瓣长度(厘米)\n\n# 花瓣宽度(厘米)\n\n# 类:\n# 山鸢尾\n\n# 杂色鸢尾\n\n# 维吉尼亚鸢尾\n\n# 缺少属性值\n# 没有\n\n# 分布\n# 3个类别各33.3%。\n\n# 创作者\n# 费舍尔(R.A. Fisher)\n\n\n'''\nThe famous Iris database, first used by Sir R.A. Fisher. The dataset is taken from Fisher’s paper. Note that it’s the same as in R, but not as in the UCI Machine Learning Repository, which has two wrong data points.\n\nThis is perhaps the best known database to be found in the pattern recognition literature. Fisher’s paper is a classic in the field and is referenced frequently to this day. (See Duda & Hart, for example.) The data set contains 3 classes of 50 instances each, where each class refers to a type of iris plant. One class is linearly separable from the other 2; the latter are NOT linearly separable from each other.\n'''\n\n\n#著名的鸢尾花数据库,最早是由费舍尔(R.A. Fisher)所采用。该数据集摘自费舍尔的论文。请注意,它与R中的相同,但与UCI机器学习数据集中的R不同,后者有两个错误的数据点。\n\n#这也许是模式识别文献中最有名的数据库。费舍尔的论文是该领域的经典之作,至今一直被引用。 (Duda&Hart的论文就是一个例子)数据集包含3类,每类50个实例,其中每一类都涉及一种鸢尾植物。有一类与另两类可线性分离;但这两类彼此不能线性分离。\n\n# for photos of the flowers: https://www.jianshu.com/p/147c62ad4d2f 鸢尾花照片:https://www.jianshu.com/p/147c62ad4d2f\n\n\niris_data_raw = load_iris()\nX, y = load_iris(return_X_y=True)\nprint(list(iris_data_raw.target_names))\n\n\n\niris_df = pd.DataFrame(iris_data_raw.data, columns=iris_data_raw.feature_names)\niris_df.head()\n\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, \ntest_size=.2, random_state=42)",
"['setosa', 'versicolor', 'virginica']\n"
],
[
"from sklearn.ensemble import GradientBoostingClassifier\nfrom sklearn.metrics import accuracy_score\n# for more details about ensemble methods and gradient boosting please see: https://sklearn.apachecn.org/docs/master/12.html\n# 更多集成方法与梯度提升信息,请参见:https://sklearn.apachecn.org/docs/master/12.html\n",
"_____no_output_____"
],
[
"gbc = GradientBoostingClassifier(random_state=42)\ngbc.fit(X_train, y_train)\ny_prediction_gbc = gbc.predict(X_test)\n\n#预测精度\nprint('accuracy_score for true vs. predicted test set forest temperature: {:0.2f}'.format(accuracy_score(y_test, y_prediction_gbc)))\n#(实际值 , 预测值)\nprint('actual', 'predicted')\nzip(y_test, y_prediction_gbc)",
"accuracy_score for true vs. predicted test set forest temperature: 1.00\n('actual', 'predicted')\n"
],
[
"'''\n\nas you can see we were able to achieve a perfect prediction using one of the most powerful models in sklearn\n如您所见,我们能够使用sklearn其中一个最强大的模型,来获得完美的预测\n\nand the best part is... we did not even do a parameter tuneing step (if we did we can expect potentially significantly results i.e. on harder problems or regression)\n最棒的部分是...我们甚至没有执行参数调整步骤(如果有的话,我们可以预期获得明显更好的结果(在更困难的回归问题上))\n\nsklearn is highly optimized with reasonable default parameters / priors\nsklearn是经过高度优化,具有合理的默认参数/先验值\n\nwhen applying the right model to the right data, most of the time it works \"right outside of the box/right off the shelf\"\n当在正确的数据上应用正确的模型,多数/经常 它工作起来是“易用的” / “现成的\"\n'''",
"_____no_output_____"
],
[
"'''\nnow you can try to follow the same steps from above and deploy gbc model\n现在您可以试试使用上面相同的步骤把gbc ML模型部署到云端\n'''",
"_____no_output_____"
]
],
[
[
"You have now created your own ML web service. Let's now see how you can also interact with existing ML web services for even more sophisticated applications.",
"_____no_output_____"
],
[
"### Exercise: 练习\n\nTry this same process of training and hosting a model through Azure ML Studio with the Pima Indians Diabetes dataset (in CSV format in your data folder). The dataset has nine columns; use any of the eight features you see fit to try and predict the ninth column, Outcome (1 = diabetes, 0 = no diabetes).\n\n尝试使用Pima Indians Diabetes数据集(数据文件夹中的CSV格式)通过Azure ML Studio进行相同的模型培训和部署过程.数据集有九列;使用您认为合适的八个特性中的任何一个来尝试和预测第九列,结果(1=糖尿病,0=无糖尿病)。\n\n> **Takeaway**: In this part, you explored fitting a model and deploying it as a web service. You did this by using now-familiar tools in an Azure Notebook to build a model relating variables surrounding forest fires and then posting that as a function in Azure ML Studio. From there, you saw how you and others can access the pre-fitted models to make predictions on new data from anywhere on the web.\n\n在本部分中,探讨了如何拟合模型并将其部署为web服务。通过在Azure笔记本中使用Data Science必备的工具来构建一个与森林火灾相关的模型,然后将其作为函数发布到Azure ML Studio中。从那里,您看到了您和其他人如何访问预先安装的模型,以便从web上的任何位置对新数据进行预测。",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
]
]
|
cb6c63ec8268f70e350eae8dec1047ab75b9fd81 | 459,990 | ipynb | Jupyter Notebook | Code Notebooks/Data_preprocessing.ipynb | piyushr385/RealEstatePricePrediction | 2a3fa5929454a30554fbdbcd1fbb9d19f01aa917 | [
"MIT"
]
| 1 | 2021-03-19T13:49:32.000Z | 2021-03-19T13:49:32.000Z | Code Notebooks/Data_preprocessing.ipynb | piyushr385/RealEstatePricePrediction | 2a3fa5929454a30554fbdbcd1fbb9d19f01aa917 | [
"MIT"
]
| null | null | null | Code Notebooks/Data_preprocessing.ipynb | piyushr385/RealEstatePricePrediction | 2a3fa5929454a30554fbdbcd1fbb9d19f01aa917 | [
"MIT"
]
| null | null | null | 114.968758 | 77,860 | 0.807702 | [
[
[
"# Mumbai House Price Prediction - Supervised Machine Learning-Regression Problem\n\n## Data Preprocessing",
"_____no_output_____"
],
[
"# The main goal of this project is to Predict the price of the houses in Mumbai using their features.",
"_____no_output_____"
],
[
"# Import Libraries",
"_____no_output_____"
]
],
[
[
"# importing necessary libraries\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport seaborn as sns\nimport numpy as np \nfrom scipy import stats\nimport re",
"_____no_output_____"
]
],
[
[
"# Load dataset ",
"_____no_output_____"
]
],
[
[
"# Load the dataset\n\ndf=pd.read_csv('house_scrape.csv')\ndf.head(5)",
"C:\\Users\\piyus\\anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3146: DtypeWarning: Columns (3) have mixed types.Specify dtype option on import or set low_memory=False.\n has_raised = await self.run_ast_nodes(code_ast.body, cell_name,\n"
],
[
"df = df.drop(['type_of_sale'], axis = 1) ",
"_____no_output_____"
],
[
"df.shape",
"_____no_output_____"
],
[
"duplicate = df[df.duplicated()] \nduplicate",
"_____no_output_____"
],
[
"# Drops the duplicate entires in the dataset.\n\ndf=df.drop_duplicates()",
"_____no_output_____"
],
[
"# As number of rows would vary we need to reset index.\n\ndf=df.reset_index()\ndf.head()",
"_____no_output_____"
],
[
"# Dropping unnecessary columns in dataset.\n\ndf=df.drop(labels='index',axis=1)\ndf.head()\n",
"_____no_output_____"
]
],
[
[
"# Exploratory Data Analysis",
"_____no_output_____"
]
],
[
[
"df.shape",
"_____no_output_____"
],
[
"df.info()\n\n#we have 3 numeric variables and 5 categorical variables\n#we have column price in lakhs",
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 84040 entries, 0 to 84039\nData columns (total 8 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 BHK 84040 non-null int64 \n 1 location 84040 non-null object \n 2 price(L) 84040 non-null float64\n 3 rate_persqft 84040 non-null object \n 4 area_insqft 84040 non-null int64 \n 5 construction_status 84040 non-null object \n 6 Sale_type 51033 non-null object \n 7 Bathroom 75088 non-null object \ndtypes: float64(1), int64(2), object(5)\nmemory usage: 5.1+ MB\n"
],
[
"df.describe()\n\n#observe 75% and max value it shows huge diff",
"_____no_output_____"
],
[
"sns.pairplot(df)\nplt.show()\n\n# area_insqft and price(L) have slightly linear correlation with some outliers",
"_____no_output_____"
],
[
"# value count of each feature\ndef value_count(df):\n for var in df.columns:\n print(df[var].value_counts())\n print(\"--------------------------------\")",
"_____no_output_____"
],
[
"value_count(df)",
"1 34598\n2 32489\n3 13527\n4 2777\n5 476\n6 141\n7 18\n8 11\n9 3\nName: BHK, dtype: int64\n--------------------------------\nThane West 6749\nMira Road East 5843\nKharghar 2857\nKandivali East 2470\nUlwe 2396\n ... \nSector 29 Vashi 1\nNear Khopat 1\nVishveshwar Nagar 1\nGrant Road Area 1\nPenkarpada Road 1\nName: location, Length: 1244, dtype: int64\n--------------------------------\n85.00 994\n75.00 943\n110.00 927\n90.00 913\n95.00 875\n ... \n90.67 1\n7.49 1\n674.00 1\n32.83 1\n31.80 1\nName: price(L), Length: 6161, dtype: int64\n--------------------------------\n10000 231\n10000 222\n20000 210\n5000 206\n25000 185\n ... \n22260 1\n16011 1\n27080 1\n27081 1\n22848 1\nName: rate_persqft, Length: 30314, dtype: int64\n--------------------------------\n650 2114\n600 1490\n1000 1277\n1050 1264\n550 1213\n ... \n2522 1\n219 1\n2074 1\n1754 1\n192 1\nName: area_insqft, Length: 2647, dtype: int64\n--------------------------------\nReady to move 55952\nUnder Construction 28088\nName: construction_status, dtype: int64\n--------------------------------\nnew 26916\nresale 24117\nName: Sale_type, dtype: int64\n--------------------------------\n2 bathrooms 39432\n1 bathrooms 21358\n3 bathrooms 10962\n4 bathrooms 2401\n5 bathrooms 663\n6 bathrooms 217\n7 bathrooms 31\n8 bathrooms 16\n9 bathrooms 8\nName: Bathroom, dtype: int64\n--------------------------------\n"
],
[
"# correlation heatmap\n\nsns.heatmap(df.corr(),cmap=\"coolwarm\", annot=True)\nplt.show()\n\n",
"_____no_output_____"
]
],
[
[
"# Preare Data for Machine Learning Model",
"_____no_output_____"
],
[
"# Data Cleaning",
"_____no_output_____"
]
],
[
[
"df.isnull().sum() # find the homuch missing data available",
"_____no_output_____"
],
[
"df.isnull().mean()*100 # % of measing value",
"_____no_output_____"
],
[
"# visualize missing value using heatmap to get idea where is the value missing\n\nplt.figure(figsize=(16,9))\nsns.heatmap(df.isnull())",
"_____no_output_____"
]
],
[
[
"# Handling the null values of sale_type",
"_____no_output_____"
]
],
[
[
"df.loc[df['construction_status'] == 'Under Construction', 'Sale_type'] = 'new'\ndf\n\n#so here we can replace the null values for sale_type with help of construnction_status column we can replace 'new' in sale_type where status is 'Under Construntion'.",
"_____no_output_____"
],
[
"df1 = df['Sale_type']\ndf1",
"_____no_output_____"
],
[
"df = df.drop(['Sale_type'],axis = 1)\ndf.head()\n\n#we can drop the Sale_type as we will concatenate it in df. ",
"_____no_output_____"
],
[
"df1 = df1.fillna(method='ffill')\ndf1.isnull().sum()\n\n#to handle rest of the null values in Sale_type we used ffill() method ",
"_____no_output_____"
],
[
"df = pd.concat([df, df1], axis=1)\ndf.head()",
"_____no_output_____"
]
],
[
[
"# Handling the null values of Bathroom ",
"_____no_output_____"
]
],
[
[
"#we need to extract the numeric value from string first\n\ndf[\"Bathroom\"] = df.assign(Bathroom = lambda x: x['Bathroom'].str.extract('(\\d+)'))",
"_____no_output_____"
],
[
"#lets convert the bathroom from object type to numeric\n\ndf[\"Bathroom\"] = pd.to_numeric(df[\"Bathroom\"])",
"_____no_output_____"
],
[
"df2 = df['Bathroom']\ndf2",
"_____no_output_____"
],
[
"df = df.drop(['Bathroom'],axis = 1)\ndf.head()\n\n#we can drop the Bathroom as we will concatenate it in df. ",
"_____no_output_____"
],
[
"df2 = df2.fillna(method='bfill')\ndf2.isnull().sum()\n\n#to handle rest of the null values in Sale_type we used ffill() method ",
"_____no_output_____"
],
[
"df = pd.concat([df, df2], axis=1)\ndf.head()",
"_____no_output_____"
],
[
"df.isnull().sum() #check for the null values\n\n#so our data has no null values now we can proceed further now with other data preprocessing",
"_____no_output_____"
],
[
"#lets convert the rate_persqft from object type to numeric\n# got error cannot convert str \"price\" at position 604 so replacing price with rate/sqft value.\n\ndf[\"rate_persqft\"] = df[\"rate_persqft\"].replace(\"Price\", 8761)\n\ndf[\"rate_persqft\"] = pd.to_numeric(df[\"rate_persqft\"])",
"_____no_output_____"
],
[
"#now we can check the description of the data again\n\ndf.describe() ",
"_____no_output_____"
],
[
"sns.heatmap(df.corr(), annot=True)\nplt.show()",
"_____no_output_____"
]
],
[
[
"# Finding outliers and removing them",
"_____no_output_____"
]
],
[
[
"# function to create histogram, Q-Q plot and boxplot\n\n# for Q-Q plots\nimport scipy.stats as stats\n\ndef diagnostic_plots(df, variable):\n # function takes a dataframe (df) and\n # the variable of interest as arguments\n\n # define figure size\n plt.figure(figsize=(16, 4))\n\n # histogram\n plt.subplot(1, 3, 1)\n sns.distplot(df[variable], bins=30)\n plt.title('Histogram')\n\n # Q-Q plot\n plt.subplot(1, 3, 2)\n stats.probplot(df[variable], dist=\"norm\", plot=plt)\n plt.ylabel('Variable quantiles')\n\n # boxplot\n plt.subplot(1, 3, 3)\n sns.boxplot(y=df[variable])\n plt.title('Boxplot')\n\n plt.show()",
"_____no_output_____"
],
[
"num_var = [\"BHK\",\"price(L)\",\"rate_persqft\",\"area_insqft\",\"Bathroom\"]\nfor var in num_var:\n print(\"******* {} *******\".format(var))\n diagnostic_plots(df, var)\n\n# here we observe outlier using histogram,, qq plot and boxplot \n#here we can see there are outliers in some features that we will remove to balance our dataset so other variable didnt get affected.",
"******* BHK *******\n"
],
[
"df3 = df[['price(L)', 'rate_persqft', 'area_insqft']].copy()\ndf3\n\n#here we make a new data frame to remove the outliers of the features needed and then concatenate with previous dataframe",
"_____no_output_____"
],
[
"df = df.drop(['price(L)','rate_persqft','area_insqft'],axis = 1)\ndf.head()\n\n#droping the values so we can concat the new clean features",
"_____no_output_____"
],
[
"z_scores = stats.zscore(df3)\nabs_z_scores = np.abs(z_scores)\nfiltered_entries = (abs_z_scores < 3).all(axis=1)\ndf3 = df3[filtered_entries]\n\n#using Z-sore to remove the outliers from the features selected",
"_____no_output_____"
],
[
"df3\n\n#this is our new dataframe with removed outliers affecting our data",
"_____no_output_____"
],
[
"sns.boxplot(x=df3['price(L)'])\n\n#we can compare the above box plots and see the difference outliers has been removed the ones remaining are relevant to our data",
"_____no_output_____"
],
[
"sns.boxplot(x=df3['rate_persqft'])",
"_____no_output_____"
],
[
"sns.boxplot(x=df3['area_insqft'])",
"_____no_output_____"
],
[
"df = pd.concat([df, df3], axis=1)\ndf.head()\n\n#concatenate to our previous dataframe",
"_____no_output_____"
],
[
"df.isnull().sum()\n\n#after we removed the outliers we get some na values ",
"_____no_output_____"
],
[
"df = df.dropna()\ndf\n\n#we can drop those values and reset the index so we get all aligned dataset",
"_____no_output_____"
],
[
"df=df.reset_index()\n\n#resetting the index",
"_____no_output_____"
],
[
"df=df.drop(labels='index',axis=1)\ndf.head()\n\n#drop the extra index created that we dont need",
"_____no_output_____"
]
],
[
[
"# Categorical variable encoding",
"_____no_output_____"
],
[
"# Encoding Construction_status",
"_____no_output_____"
]
],
[
[
"for cat_var in [\"Under Construction\",\"Ready to move\"]:\n df[\"construction_status\"+cat_var] = np.where(df['construction_status']==cat_var, 1,0)\ndf.shape",
"_____no_output_____"
]
],
[
[
"# Encoding Sale_type",
"_____no_output_____"
]
],
[
[
"for cat_var in [\"new\",\"resale\"]:\n df[\"Sale_type\"+cat_var] = np.where(df['Sale_type']==cat_var, 1,0)\ndf.shape",
"_____no_output_____"
]
],
[
[
"# Encoding Location",
"_____no_output_____"
]
],
[
[
"# here we are selecting only the location which have count above 50\n\nlocation_value_count = df['location'].value_counts()\nlocation_value_count",
"_____no_output_____"
],
[
"location_get_50 = location_value_count[location_value_count>=50].index\nlocation_get_50",
"_____no_output_____"
],
[
"for cat_var in location_get_50:\n df['location_'+cat_var]=np.where(df['location']==cat_var, 1,0)\ndf.shape",
"_____no_output_____"
],
[
"df.head()",
"_____no_output_____"
]
],
[
[
"# Drop categorical variable",
"_____no_output_____"
]
],
[
[
"df = df.drop([\"location\",\"construction_status\",'Sale_type'], axis =1)\ndf.shape",
"_____no_output_____"
],
[
"df.head()",
"_____no_output_____"
],
[
"df.to_csv('final_house_scrape.csv', index=False) ",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
]
|
cb6c7691a643630ef8e8d90207c5c0dbbc50a259 | 948,959 | ipynb | Jupyter Notebook | seurat_dimension_reduction/main_seurat_cluster.ipynb | xiaoyanLi629/Finance_quant_machine_learning | a0a3a3f67aaff1f1250172664d9f556beadc94c7 | [
"MIT"
]
| null | null | null | seurat_dimension_reduction/main_seurat_cluster.ipynb | xiaoyanLi629/Finance_quant_machine_learning | a0a3a3f67aaff1f1250172664d9f556beadc94c7 | [
"MIT"
]
| null | null | null | seurat_dimension_reduction/main_seurat_cluster.ipynb | xiaoyanLi629/Finance_quant_machine_learning | a0a3a3f67aaff1f1250172664d9f556beadc94c7 | [
"MIT"
]
| null | null | null | 328.132434 | 394,232 | 0.903372 | [
[
[
"import os\nimport glob\nimport math\nimport time\nfrom joblib import Parallel, delayed\nimport pandas as pd\nimport numpy as np\nimport scipy as sc\nfrom sklearn.model_selection import KFold\nimport lightgbm as lgb\nimport warnings\nimport matplotlib.pyplot as plt\nimport matplotlib\nfrom sklearn.model_selection import train_test_split\nfrom torch.utils.data import TensorDataset, DataLoader\nimport torch\nimport torch.nn as nn\nimport random\nimport seaborn as sns; sns.set_theme()\nimport torch.nn.functional as F\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.linear_model import Ridge\nfrom sklearn.linear_model import Lasso\nimport statsmodels.api as sm\nimport pylab as pl\nfrom matplotlib.pyplot import figure\nfrom IPython import display\nfrom pandas.plotting import scatter_matrix\nfrom sklearn.decomposition import PCA\nfrom sklearn.metrics import r2_score\nimport umap\nfrom sklearn import svm\nfrom lightgbm import LGBMClassifier\nfrom numpy import std\nfrom numpy import mean\nfrom sklearn.model_selection import cross_val_score\nfrom sklearn.model_selection import RepeatedStratifiedKFold\nfrom matplotlib import cm\nfrom sklearn.metrics import confusion_matrix",
"_____no_output_____"
],
[
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")",
"_____no_output_____"
],
[
"warnings.filterwarnings('ignore')\npd.set_option('max_columns', 300)",
"_____no_output_____"
],
[
"train_test_seurat = pd.read_csv('./integrate.csv')",
"_____no_output_____"
],
[
"train_test_seurat = train_test_seurat.T",
"_____no_output_____"
],
[
"train_test_seurat_std = train_test_seurat.std()\ncolumn_names = list(train_test_seurat.columns)\ncolumns_remove = []\nfor i in range(train_test_seurat.shape[1]):\n if train_test_seurat_std[i] == 0:\n columns_remove.append(column_names[i])",
"_____no_output_____"
],
[
"train_test_seurat = train_test_seurat.drop(columns_remove, axis=1)",
"_____no_output_____"
],
[
"train_test_seurat[columns_remove[0]] = train_test_seurat.iloc[:, 0]",
"_____no_output_____"
],
[
"clusters = pd.read_csv('./clusters.csv')\ntrain_test_seurat['class'] = clusters",
"_____no_output_____"
],
[
"train = pd.read_csv('./MLR_Project_train.csv')\ntest = pd.read_csv('./MLR_Project_test.csv')\n\ntarget = pd.DataFrame(pd.concat([train['TARGET'], test['TARGET']]))\ntarget = target.rename(index=lambda s: 'Sample' + str(int(s)+1))\n\ntrain_test_seurat['TARGET'] = 1.0\n\nfor i in range(train_test_seurat.shape[0]):\n train_test_seurat['TARGET'][i] = target['TARGET'][i]",
"_____no_output_____"
],
[
"train_test_seurat",
"_____no_output_____"
],
[
"train_seurat = train_test_seurat.iloc[:90000, :]\ntest_seurfat = train_test_seurat.iloc[90000:, :]",
"_____no_output_____"
],
[
"pca = PCA(n_components=2)\npca.fit(train_seurat.iloc[:, :-2])\nprint(pca.explained_variance_ratio_)\ntrain_pca = pca.fit_transform(train_seurat.iloc[:, :-2])\nreducer = umap.UMAP()\ntrain_umap = reducer.fit_transform(train_seurat.iloc[:, :-2])",
"[0.64043368 0.09965526]\n"
],
[
"new_inferno = cm.get_cmap('inferno', 5)\n\nfigure, ax = plt.subplots(1, 2, figsize = (15, 7))\n\ncolor_map = (train_seurat['TARGET'] - np.min(train_seurat['TARGET'])) / (np.max(train_seurat['TARGET']) - np.min(train_seurat['TARGET']))*2-1\n\n# ax.scatter(train_pca[:, 0], train_pca[:, 1], c=np.sign(train['TARGET']), cmap=matplotlib.colors.ListedColormap(colors))\nim_0 = ax[0].scatter(train_pca[:, 0], train_pca[:, 1], c=color_map, cmap='Reds', alpha = 1)\nim_1 = ax[1].scatter(train_umap[:, 0], train_umap[:, 1], c=color_map, cmap='Reds', alpha = 1)\n\nax[0].set_title('PCA visualization of Test data', fontsize=15)\nax[0].set_xlabel('component 1', fontsize=10)\nax[0].set_ylabel('component 2', fontsize=10)\n\nax[1].set_title('UMAP visualization of Test data', fontsize=15)\nax[1].set_xlabel('component 1', fontsize=10)\nax[1].set_ylabel('component 2', fontsize=10)\nplt.colorbar(im_1)\nplt.show()",
"_____no_output_____"
],
[
"train_seurat['group'] = 1.0\n\nquantiles = [train_seurat['TARGET'].quantile(x/10) for x in range(1, 10)]\nquantiles",
"_____no_output_____"
],
[
"for i in range(train_seurat.shape[0]):\n for j in range(9):\n if train_seurat['TARGET'][i] < quantiles[j]:\n train_seurat['group'][i] = j\n break\n train_seurat['group'][i] = 9",
"_____no_output_____"
],
[
"train_seurat",
"_____no_output_____"
],
[
"colors = ['red', 'green', 'blue', 'orange', 'pink', 'yellow', 'greenyellow', 'gold', 'cyan', 'black']\n\nnew_inferno = cm.get_cmap('inferno', 5)\n\nfigure, ax = plt.subplots(1, 2, figsize = (15, 7))\n\ncolor_map = (train_seurat['TARGET'] - np.min(train_seurat['TARGET'])) / (np.max(train_seurat['TARGET']) - np.min(train_seurat['TARGET']))*2-1\n\nim_0 = ax[0].scatter(train_pca[:, 0], train_pca[:, 1], c=(np.sign(train_seurat['TARGET'])+1)/2, cmap=matplotlib.colors.ListedColormap(colors))\n# im_0 = ax[0].scatter(train_pca[:, 0], train_pca[:, 1], c=color_map, cmap='Reds', alpha = 1)\nim_1 = ax[1].scatter(train_umap[:, 0], train_umap[:, 1], c=(np.sign(train_seurat['TARGET'])+1)/2, cmap=matplotlib.colors.ListedColormap(colors))\n\nax[0].set_title('PCA visualization of Test data', fontsize=15)\nax[0].set_xlabel('component 1', fontsize=10)\nax[0].set_ylabel('component 2', fontsize=10)\n\nax[1].set_title('UMAP visualization of Test data', fontsize=15)\nax[1].set_xlabel('component 1', fontsize=10)\nax[1].set_ylabel('component 2', fontsize=10)\nplt.colorbar(im_1)\nplt.show()",
"_____no_output_____"
],
[
"colors = ['red', 'green', 'blue', 'orange', 'pink', 'yellow', 'greenyellow', 'gold', 'cyan', 'black']\n\nnew_inferno = cm.get_cmap('inferno', 5)\n\nfigure, ax = plt.subplots(1, 2, figsize = (15, 7))\n\nim_0 = ax[0].scatter(train_pca[:, 0], train_pca[:, 1], c=train_seurat['group'], cmap=matplotlib.colors.ListedColormap(colors))\nim_1 = ax[1].scatter(train_umap[:, 0], train_umap[:, 1], c=train_seurat['group'], cmap=matplotlib.colors.ListedColormap(colors))\n\nax[0].set_title('PCA visualization of Train data', fontsize=15)\nax[0].set_xlabel('component 1', fontsize=10)\nax[0].set_ylabel('component 2', fontsize=10)\n\nax[1].set_title('UMAP visualization of Train data', fontsize=15)\nax[1].set_xlabel('component 1', fontsize=10)\nax[1].set_ylabel('component 2', fontsize=10)\nplt.colorbar(im_1)\nplt.show()",
"_____no_output_____"
]
],
[
[
"## 1.3 Show the maximum return of train and test",
"_____no_output_____"
]
],
[
[
"train_max = np.sum(train['TARGET'][train['TARGET']>0])\ntest_max = np.sum(test['TARGET'][test['TARGET']>0])\n\nprint('Maximum return of training set:', train_max)\nprint('Maximum return of testing set:', test_max)",
"Maximum return of training set: 195.6927566509\nMaximum return of testing set: 55.96225182400002\n"
],
[
"reg = Ridge(alpha=0.5).fit(pd.DataFrame(train_seurat.iloc[:, :]), train['TARGET'])\npred = reg.predict(pd.DataFrame(train_seurat.iloc[:, :]))\n\npred_test = reg.predict(pd.DataFrame(test_seurat.iloc[:, :]))\n\ntrain_res = np.sum(train['TARGET'][pred>0])\ntest_res = np.sum(test['TARGET'][pred_test>0])",
"_____no_output_____"
],
[
"print(f'Train naive random selection percentage return: {train_res/train_max*100}%')\nprint(f'Test naive random selection percentage return: {test_res/test_max*100}%')",
"Train naive random selection percentage return: 6.32652526152815%\nTest naive random selection percentage return: 4.010962118285209%\n"
]
],
[
[
"### 1.3.1 Remove the Unnamed columns in dataframe",
"_____no_output_____"
]
],
[
[
"train = train.loc[:, ~train.columns.str.contains('^Unnamed')]\ntest = test.loc[:, ~test.columns.str.contains('^Unnamed')]",
"_____no_output_____"
]
],
[
[
"## 1.4 Naive random selection experiment",
"_____no_output_____"
]
],
[
[
"train_random = 0\nfor j in range(10000):\n ind = np.random.randint(2, size=train.shape[0])\n train_random = train_random + sum(train['TARGET'][ind>0])\n\nprint('Result of train naive random selection:', train_random/10000)\n\ntest_random = 0\nfor j in range(10000):\n ind = np.random.randint(2, size=test.shape[0])\n test_random = test_random + sum(test['TARGET'][ind>0])\n\nprint('Result of test naive random selection:', test_random/10000)\n",
"Result of train naive random selection: -0.8170112755425528\nResult of test naive random selection: -0.6496402211191966\n"
],
[
"print(f'Train naive random selection percentage return: {(train_random/10000)/train_max*100}%')\nprint(f'Test naive random selection percentage return: {(test_random/10000)/test_max*100}%')",
"Train naive random selection percentage return: -0.41749694241368096%\nTest naive random selection percentage return: -1.1608543258092974%\n"
]
],
[
[
"## 1.5 Get data shape",
"_____no_output_____"
]
],
[
[
"# print('Train shape:', train.shape)\n# print('Test shape:', test.shape)",
"_____no_output_____"
]
],
[
[
"## 3.1 Remove extreme Target values",
"_____no_output_____"
]
],
[
[
"# train = train.sort_values(by=['TARGET'])\n# # remove samples with extreme large target values and samples with extreme negative values\n# num_remove = 10\n# train_remove = train.iloc[num_remove:-num_remove, :]\n# # train.shape",
"_____no_output_____"
]
],
[
[
"## 3.2 Remove extreme features values",
"_____no_output_____"
]
],
[
[
"# for i in range(train.shape[1]-1):\n# train_remove = train_remove.sort_values(by=[str(i)])\n# num_remove = 5\n# train_remove = train_remove.iloc[num_remove:-num_remove, :]",
"_____no_output_____"
],
[
"# train_remove.shape",
"_____no_output_____"
],
[
"# figure, ax = plt.subplots(1, 1, figsize = (35, 7))\n\n# train_remove_mean_values = train_remove.mean()\n# train_remove_std_values = train_remove.std()\n\n# train_remove_std = (train_remove-train_remove.mean())/train_remove.std()\n\n# # train_remove_std.boxplot()\n# # ax.set_xlabel('Features', fontsize=20)\n# ax.set_ylabel('Values', fontsize=20)\n# ax.set_title('Train standardized features variability', fontsize=25)\n\n# figure.savefig(\"features_std_dis.png\", bbox_inches='tight', dpi=600)",
"_____no_output_____"
]
],
[
[
"### The devil is in the details, we need to standardize test dataset by using train mean and train standard deviation",
"_____no_output_____"
]
],
[
[
"# test_std = (test-train_remove_mean_values)/train_remove_std_values",
"_____no_output_____"
]
],
[
[
"## 5.5 Autoencoder Resnet model",
"_____no_output_____"
]
],
[
[
"input_features = train_seurat.to_numpy()\noutput_features = pd.DataFrame(train['TARGET']).to_numpy()\n\n#######\nfor i in range(input_features.shape[0]):\n input_features[i, :] = (input_features[i, :] - np.mean(input_features[i, :]))/np.std(input_features[i, :])\n#######\n\ninput_ = np.zeros((input_features.shape[0], 9, 6))\noutput_ = np.zeros((output_features.shape[0], 9, 6))\n\nfor i in range(input_.shape[0]):\n input_[i, :, :] = np.reshape(input_features[i, :], (9, 6))\n \ninput_features = input_\n \n# input_features = torch.tensor(input_features, 1)\n\nX_test = test_seurat.to_numpy()\nY_test = pd.DataFrame(test['TARGET']).to_numpy()\n\n#######\nfor i in range(X_test.shape[0]):\n X_test[i, :] = (X_test[i, :] - np.mean(X_test[i, :]))/np.std(X_test[i, :])\n#######\n\n\nX_test_ = np.zeros((X_test.shape[0], 9, 6))\nfor i in range(X_test_.shape[0]):\n X_test_[i, :, :] = np.reshape(X_test[i, :], (9, 6))\nX_test = X_test_\n \nX_train, X_val, Y_train, Y_val = train_test_split(input_features, output_features, test_size=0.2, random_state=42)\n\n#####\n# to calculate returns\ntrain_data, val_data = train_test_split(train, test_size=0.2, random_state=42)\ntest_data = test\n#####\n\nauto_train_max = np.sum(train_data['TARGET'][train_data['TARGET']>0])\nauto_val_max = np.sum(val_data['TARGET'][val_data['TARGET']>0])\nauto_test_max = np.sum(test['TARGET'][test['TARGET']>0])\n\nprint('Train X shape:', X_train.shape)\nprint('Validation X shape:', X_val.shape)\nprint('Test X shape:', X_test.shape)\n\nprint('Train Y shape:', Y_train.shape)\nprint('Val Y shape:', Y_val.shape)\nprint('Test Y shape:', Y_test.shape)\n\nprint('train_max:', auto_train_max)\nprint('val_max:', auto_val_max)\nprint('test_max:', auto_test_max)",
"Train X shape: (72000, 9, 6)\nValidation X shape: (18000, 9, 6)\nTest X shape: (19707, 9, 6)\nTrain Y shape: (72000, 1)\nVal Y shape: (18000, 1)\nTest Y shape: (19707, 1)\ntrain_max: 156.45405680890002\nval_max: 39.238699842\ntest_max: 55.96225182400002\n"
],
[
"train_input = torch.from_numpy(X_train)\ntrain_output = torch.from_numpy(Y_train)\nval_input = torch.from_numpy(X_val)\nval_output = torch.from_numpy(Y_val)\ntest_input = torch.from_numpy(X_test)\ntest_output = torch.from_numpy(Y_test)\n\ntrain_input = torch.unsqueeze(train_input, 1)\nval_input = torch.unsqueeze(val_input, 1)\ntest_input = torch.unsqueeze(test_input, 1)\n\ntrain_input = train_input.float()\ntrain_output = train_output.float()\nval_input = val_input.float()\nval_output = val_output.float()\ntest_input = test_input.float()\ntest_output = test_output.float()\n\ninput_feature = train_input.shape[1]\noutput_feature = 1\n\n# print('input_feature:', input_feature)\n# print('output_feature:', output_feature)",
"_____no_output_____"
],
[
"train_input = train_input.to(device)\ntrain_output = train_output.to(device)\nval_input = val_input.to(device)\nval_output = val_output.to(device)\ntest_input = test_input.to(device)\ntest_output = test_output.to(device)",
"_____no_output_____"
],
[
"def seed_everything(seed=1234):\n random.seed(seed)\n os.environ['PYTHONHASHSEED'] = str(seed)\n np.random.seed(seed)\n torch.manual_seed(seed)\n torch.cuda.manual_seed(seed)\n torch.backends.cudnn.deterministic = True\n\nseed_everything()",
"_____no_output_____"
],
[
"# auto-encoder model\n# base model\nclass Autoencoder(nn.Module):\n def __init__(self):\n super(Autoencoder, self).__init__()\n self.conv1 = nn.Conv2d(1, 16, 2)\n self.conv2 = nn.Conv2d(16, 32, 2)\n self.maxpool = nn.MaxPool2d(2)\n \n self.linear = nn.Linear(96, 1)\n \n self.linear2 = nn.Linear(input_feature//2, input_feature//4)\n self.linear3 = nn.Linear(input_feature//4, input_feature//16)\n self.linear4 = nn.Linear(input_feature//16, input_feature//16)\n \n self.linear5 = nn.Linear(input_feature//16, input_feature//16)\n self.linear6 = nn.Linear(input_feature//16+input_feature, input_feature//16)\n \n self.batchnorm_1 = nn.BatchNorm1d(input_feature//2)\n self.batchnorm_2 = nn.BatchNorm1d(input_feature//4)\n self.batchnorm_3 = nn.BatchNorm1d(input_feature//16)\n \n self.relu = nn.ReLU()\n self.dropout = nn.Dropout(0.15)\n \n self.softmax = nn.Softmax()\n \n\n def forward(self, x_):\n x = self.conv1(x_)\n x = self.maxpool(x)\n x = self.conv2(x)\n x = torch.flatten(x, 1)\n x = self.relu(x)\n output = self.linear(x)\n return output.float()",
"_____no_output_____"
],
[
"batch_size = 100000\ntrain_ds = TensorDataset(train_input, train_output)\ntrain_dl = DataLoader(train_ds, batch_size= batch_size, shuffle=False)",
"_____no_output_____"
],
[
"%matplotlib inline\ndef fit(num_epochs, model, loss_fn, train_input, train_output, val_input, val_output, test_input, test_output, model_path):\n best_loss = float('inf')\n train_pred_output = []\n val_pred_output = []\n train_error = []\n val_error = []\n test_error = []\n epochs = []\n \n train_returns = []\n val_returns = []\n test_returns = []\n \n train_sum = []\n val_sum = []\n test_sum = []\n\n for epoch in range(num_epochs):\n for x,y in train_dl:\n model = model.train()\n opt.zero_grad()\n pred = model(x)\n y = torch.reshape(y, (y.shape[0], 1))\n loss = loss_fn(pred, y)\n loss.backward()\n opt.step()\n\n if epoch % 50 == 0:\n \n model = model.eval()\n \n train_pred = model(train_input)\n train_pred_index = (torch.sign(train_pred)+1)//2\n train_output = torch.reshape(train_output, (train_output.shape[0], 1))\n train_loss = loss_fn(train_output, train_pred)\n # train_loss = loss_fn(train_pred, train_output.long().squeeze())\n train_loss = train_loss.cpu().detach().numpy()\n \n val_pred = model(val_input)\n val_pred_index = (torch.sign(val_pred)+1)//2\n val_output = torch.reshape(val_output, (val_output.shape[0], 1))\n val_loss = loss_fn(val_output, val_pred)\n # val_loss = loss_fn(val_pred, val_output.long().squeeze())\n val_loss = val_loss.cpu().detach().numpy()\n \n test_pred = model(test_input)\n test_pred_index = (torch.sign(test_pred)+1)//2\n test_output = torch.reshape(test_output, (test_output.shape[0], 1))\n test_loss = loss_fn(test_output, test_pred)\n # test_loss = loss_fn(test_pred, test_output.long().squeeze())\n test_loss = test_loss.cpu().detach().numpy()\n \n epochs.append(epoch)\n train_error.append(math.log(train_loss+1))\n val_error.append(math.log(val_loss+1))\n test_error.append(math.log(test_loss+1))\n \n# figure, ax = plt.subplots(1, 2, figsize = (20, 7))\n# ax = ax.flatten()\n \n# figure, ax = plt.subplots(1, 4, figsize = (22, 5))\n# ax = ax.flatten()\n \n# plt.grid(False)\n # train_conf = confusion_matrix(train_output, train_pred_index)\n# g1 = sns.heatmap(train_conf, cmap=\"YlGnBu\",cbar=False, ax=ax[0], annot = True)\n# g1.set_ylabel('True Target')\n# g1.set_xlabel('Predict Target')\n# g1.set_title('Train dataset')\n\n# plt.grid(False)\n # val_conf = confusion_matrix(val_output, val_pred_index)\n# g2 = sns.heatmap(val_conf, cmap=\"YlGnBu\",cbar=False, ax=ax[1], annot = True)\n# g2.set_ylabel('True Target')\n# g2.set_xlabel('Predict Target')\n# g2.set_title('Val dataset')\n \n# plt.grid(False)\n # test_conf = confusion_matrix(test_output, test_pred_index)\n# g3 = sns.heatmap(test_conf, cmap=\"YlGnBu\",cbar=False, ax=ax[2], annot = True)\n# g3.set_ylabel('True Target')\n# g3.set_xlabel('Predict Target')\n# g3.set_title('Test dataset')\n \n train_pred_np = train_pred_index.cpu().detach().numpy()\n train_output_np = train_output.cpu().detach().numpy()\n val_pred_np = val_pred_index.cpu().detach().numpy()\n val_output_np = val_output.cpu().detach().numpy()\n test_pred_np = test_pred_index.cpu().detach().numpy()\n test_output_np = test_output.cpu().detach().numpy()\n \n# train_max_value = max(max(train_output_np), max(train_pred_np))\n# train_min_value = min(min(train_output_np), min(train_pred_np))\n# val_max_value = max(max(val_output_np), max(val_pred_np))\n# val_min_value = min(min(val_output_np), min(val_pred_np))\n# test_max_value = max(max(test_output_np), max(test_pred_np))\n# test_min_value = min(min(test_output_np), min(test_pred_np))\n \n# ax[0].scatter(train_output_np, train_pred_np, s = 20, alpha=0.3, c='blue')\n# ax[1].scatter(val_output_np, val_pred_np, s = 20, alpha=0.3, c='red')\n# ax[2].scatter(test_output_np, test_pred_np, s = 20, alpha=0.3, c='green')\n \n# ax[0].plot(epochs, train_error, c='blue')\n# ax[0].plot(epochs, val_error, c='red')\n# ax[0].plot(epochs, test_error, c='green')\n# ax[0].set_title('Errors vs Epochs', fontsize=15)\n# ax[0].set_xlabel('Epoch', fontsize=10)\n# ax[0].set_ylabel('Errors', fontsize=10)\n\n# ax[0].legend(['train', 'valid', 'test'])\n \n# ax[0].set_xlim([train_min_value, train_max_value])\n# ax[0].set_ylim([train_min_value, train_max_value])\n# ax[0].set_title('Trainig data', fontsize=15)\n# ax[0].set_xlabel('Target', fontsize=10)\n# ax[0].set_ylabel('Prediction', fontsize=10)\n# ax[0].plot([train_min_value, train_max_value], [train_min_value, train_max_value], 'k-')\n \n# ax[1].set_xlim([val_min_value, val_max_value])\n# ax[1].set_ylim([val_min_value, val_max_value])\n# ax[1].set_title('Validation data', fontsize=15)\n# ax[1].set_xlabel('Target', fontsize=10)\n# ax[1].set_ylabel('Prediction', fontsize=10)\n# ax[1].plot([val_min_value, val_max_value], [val_min_value, val_max_value], 'k-')\n \n# ax[2].set_xlim([test_min_value, test_max_value])\n# ax[2].set_ylim([test_min_value, test_max_value])\n# ax[2].set_title('Testing data', fontsize=15)\n# ax[2].set_xlabel('Target', fontsize=10)\n# ax[2].set_ylabel('Prediction', fontsize=10)\n# ax[2].plot([test_min_value, test_max_value], [test_min_value, test_max_value], 'k-')\n \n# ax[3].plot(epochs, train_error, c='blue')\n# ax[3].plot(epochs, val_error, c='red')\n# ax[3].plot(epochs, test_error, c='green')\n# ax[3].set_title('Training and Validation error', fontsize=15)\n# ax[3].set_xlabel('Epochs', fontsize=10)\n# ax[3].set_ylabel('MSE error', fontsize=10)\n \n# display.clear_output(wait=True)\n# display.display(pl.gcf())\n \n# print('Epoch ', epoch, 'Train_loss: ', train_loss*1000, ' Validation_loss: ', val_loss*100, ' Test_loss: ', test_loss*100)\n # print(train_pred_np.shape, train_pred_np)\n # print(train_pred, train_pred_np)\n train_pred_np = np.squeeze(train_pred_np)\n val_pred_np = np.squeeze(val_pred_np)\n test_pred_np = np.squeeze(test_pred_np)\n \n train_res = np.sum(train_data['TARGET'][train_pred_np>0])\n train_output_check = np.squeeze(train_output_np)\n train_check = np.sum(train_data['TARGET'][train_output_check>0])\n \n val_res = np.sum(val_data['TARGET'][val_pred_np>0])\n val_output_check = np.squeeze(val_output_np)\n val_check = np.sum(val_data['TARGET'][val_output_check>0])\n \n test_res = np.sum(test_data['TARGET'][test_pred_np>0])\n test_output_check = np.squeeze(test_output_np)\n test_check = np.sum(test_data['TARGET'][test_output_check>0])\n \n# train_returns.append(train_res)\n# val_returns.append(val_res)\n# test_returns.append(test_res)\n \n# ax[1].plot(epochs, train_returns, c='blu`e')\n# ax[1].plot(epochs, val_returns, c='red')\n# ax[1].plot(epochs, test_returns, c='green')\n# ax[1].legend(['train', 'valid', 'test'])\n# ax[1].set_title('Return vs Epochs', fontsize=15)\n# ax[1].set_xlabel('Epoch', fontsize=10)\n# ax[1].set_ylabel('Returns', fontsize=10)\n\n# display.clear_output(wait=True)\n# display.display(pl.gcf())\n \n train_sum.append(train_res)\n val_sum.append(val_res)\n test_sum.append(test_res)\n # print(f'Checks: {train_check/auto_train_max*100}%, {val_check/auto_val_max*100}%, {test_check/auto_test_max*100}%')\n# print(f'Maximum sum train return {train_res}, Total train return: {auto_train_max}, Maximum train percentage return: {train_res/auto_train_max*100}%')\n# print(f'Maximum sum train return {val_res}, Total train return: {auto_val_max}, Maximum train percentage return: {val_res/auto_val_max*100}%')\n# print(f'Maximum sum test return {test_res}, Total test return: {auto_test_max}, Maximum test percentage return: {test_res/auto_test_max*100}%')\n# print('Epoch:', epoch, 'Train loss:', train_loss, 'Val loss:', val_loss, 'Test loss:', test_loss)\n print(f'Epoch: {epoch}, Train loss: {train_loss}, Train return: {train_res/auto_train_max*100}%, Val loss: {val_loss}, Val return: {val_res/auto_val_max*100}%, Test loss: {test_loss}, Test return: {test_res/auto_test_max*100}%')\n \n if val_loss < best_loss:\n torch.save(model.state_dict(), model_path)\n best_loss = val_loss\n \n# train_pred_output.append([train_pred.cpu().detach().numpy(), train_output.cpu().detach().numpy()])\n# val_pred_output.append([val_pred.cpu().detach().numpy(), val_output.cpu().detach().numpy()])\n return train_sum, val_sum, test_sum\n",
"_____no_output_____"
],
[
"num_epochs = 20000\nlearning_rate = 0.001\nloss_fn = F.mse_loss\n# loss_fn = nn.CrossEntropyLoss()\n\nseed_everything()\n\nmodel = Autoencoder()\nmodel = model.to(device)\nopt = torch.optim.SGD(model.parameters(), lr=learning_rate, momentum=0.9)\ntrain_sum_1, val_sum_1, test_sum_1, train_conf_1, val_conf_1, test_conf_1 = fit(num_epochs, model, loss_fn, train_input, train_output, val_input, val_output, test_input, test_output, 'model_path_cnn')\n# fig.savefig(\"auto_encoder.png\", bbox_inches='tight', dpi=600)",
"Epoch: 0, Train loss: 0.00842222385108471, Train return: -0.6734364015162209%, Val loss: 0.008379928767681122, Val return: -0.7255568205531266%, Test loss: 0.008193804882466793, Test return: -0.9211383123416649%\nEpoch: 50, Train loss: 0.004782435018569231, Train return: -1.6590978959213156%, Val loss: 0.004779001232236624, Val return: -2.0249661181421565%, Test loss: 0.004752246662974358, Test return: 0.6427081492917412%\nEpoch: 100, Train loss: 0.0033749272115528584, Train return: -1.4823133729492781%, Val loss: 0.0033766848500818014, Val return: -2.027651507832037%, Test loss: 0.0033532101660966873, Test return: 0.6526274141874032%\nEpoch: 150, Train loss: 0.002630552975460887, Train return: -1.4579789081379864%, Val loss: 0.002631840528920293, Val return: -1.7021610774297176%, Test loss: 0.002607585396617651, Test return: 0.6699481771732899%\nEpoch: 200, Train loss: 0.002166937105357647, Train return: -1.3340090258888442%, Val loss: 0.002166402991861105, Val return: -1.587414426339595%, Test loss: 0.002143685705959797, Test return: 1.5856418712219247%\nEpoch: 250, Train loss: 0.0018506728811189532, Train return: -1.2511445360543911%, Val loss: 0.0018483124440535903, Val return: -1.237479766035109%, Test loss: 0.001828427193686366, Test return: 1.8715686697060732%\nEpoch: 300, Train loss: 0.0016218476230278611, Train return: -1.264916947227033%, Val loss: 0.0016179063823074102, Val return: -1.2865742698733327%, Test loss: 0.00160136295016855, Test return: 1.634932066131792%\nEpoch: 350, Train loss: 0.0014487841399386525, Train return: -1.2725056350771036%, Val loss: 0.001443664194084704, Val return: -0.6543401591639315%, Test loss: 0.001430515549145639, Test return: 1.9861990033848347%\nEpoch: 400, Train loss: 0.0013132691383361816, Train return: -1.2614598320135835%, Val loss: 0.001307287602685392, Val return: -0.023209762394450606%, Test loss: 0.001297317212447524, Test return: 1.7292655342810492%\nEpoch: 450, Train loss: 0.0012042010203003883, Train return: -1.2151847686009216%, Val loss: 0.0011975915404036641, Val return: 0.25629969750515025%, Test loss: 0.0011904087150469422, Test return: 1.8934503981942545%\nEpoch: 500, Train loss: 0.001114390091970563, Train return: -1.1251058745955451%, Val loss: 0.0011073605855926871, Val return: 0.33678902087002544%, Test loss: 0.0011025480926036835, Test return: 2.0790731807204055%\nEpoch: 550, Train loss: 0.001038982649333775, Train return: -1.2088458380533333%, Val loss: 0.001031686319038272, Val return: 0.23401715747399157%, Test loss: 0.0010288925841450691, Test return: 2.0352166681604973%\nEpoch: 600, Train loss: 0.0009746382129378617, Train return: -0.9897961106189058%, Val loss: 0.0009672141750343144, Val return: -0.15032638246811375%, Test loss: 0.0009660659125074744, Test return: 2.195687589313614%\nEpoch: 650, Train loss: 0.0009190088021568954, Train return: -1.097642474236114%, Val loss: 0.0009115498978644609, Val return: -0.5450072985626729%, Test loss: 0.000911739538423717, Test return: 2.103731293198434%\nEpoch: 700, Train loss: 0.0008703664061613381, Train return: -1.0521794370667554%, Val loss: 0.00086293212370947, Val return: -0.5957306356766519%, Test loss: 0.0008642214233987033, Test return: 2.12058089036914%\nEpoch: 750, Train loss: 0.0008274155552498996, Train return: -1.1068124819001044%, Val loss: 0.0008200693409889936, Val return: -0.4294292386814497%, Test loss: 0.0008222663309425116, Test return: 2.1578365195128164%\nEpoch: 800, Train loss: 0.00078918959479779, Train return: -1.0965176187763739%, Val loss: 0.0007819752208888531, Val return: -0.6391057884430096%, Test loss: 0.0007849091198295355, Test return: 2.054082360043668%\n"
],
[
"# model = Autoencoder_model()\n# model.load_state_dict(torch.load(model_path))\n# model.eval()",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6c7f6808059a8a3058c9fb7633bc238508290a | 24,117 | ipynb | Jupyter Notebook | experiments/Get model runtimes.ipynb | derEitel/patch_individual_filter_layer | ecd7b3ace759e10ceda8c39ebe1190a7bc27f223 | [
"BSD-3-Clause"
]
| 2 | 2021-12-29T12:04:08.000Z | 2022-01-20T05:11:00.000Z | experiments/Get model runtimes.ipynb | derEitel/patch_individual_filter_layer | ecd7b3ace759e10ceda8c39ebe1190a7bc27f223 | [
"BSD-3-Clause"
]
| null | null | null | experiments/Get model runtimes.ipynb | derEitel/patch_individual_filter_layer | ecd7b3ace759e10ceda8c39ebe1190a7bc27f223 | [
"BSD-3-Clause"
]
| null | null | null | 47.381139 | 1,929 | 0.561554 | [
[
[
"from scipy.stats import ranksums, sem\nimport numpy as np\nfrom statannot import add_stat_annotation\nimport copy\nimport os",
"_____no_output_____"
],
[
"import matplotlib.pyplot as plt\nimport matplotlib",
"_____no_output_____"
],
[
"save_dir = os.path.join(\"/analysis/fabiane/documents/publications/patch_individual_filter_layers/MIA_revision\")",
"_____no_output_____"
],
[
"plt.style.use('ggplot')\nmatplotlib.use(\"pgf\")\nmatplotlib.rcParams.update({\n \"pgf.texsystem\": \"pdflatex\",\n 'font.family': 'serif',\n 'font.size':8,\n 'text.usetex': True,\n 'pgf.rcfonts': False,\n})",
"_____no_output_____"
],
[
"def get_runtime(filename):\n all_runtime_lines = ! grep \"Total time elapsed:\" $filename\n all_iter_lines = ! grep \"output_dir = \" $filename\n times = []\n iterations = []\n \n for runtime_line in all_runtime_lines:\n time = 0 \n # convert runtime\n for idx, inner_line in enumerate(runtime_line.split(\":\")[1:4]):\n inner_line = inner_line.strip().split(\"\\\\\")[0]\n if idx == 0:\n # remove time symbol and convert to seconds\n time += int(inner_line.split(\"h\")[0]) * 3600\n elif idx == 1:\n # remove time symbol and convert to seconds\n time += int(inner_line.split(\"m\")[0]) * 60\n elif idx == 2:\n # remove time symbol\n time += int(inner_line.split(\"s\")[0])\n times.append(time)\n \n # UKB baseline full set didn't finish reporting for the last of the 10 runs\n # it finished running but did not print out its running time.\n # Therefore, we ran the model again in a separate file for that run.\n if len(times) == 9:\n failed_time = 5 * 3600 + 42 * 60 + 49 # taken from individual run of final iteration\n times.append(failed_time)\n\n # convert iterations\n assert(len(all_iter_lines) == 1)\n iter_line = all_iter_lines[0].split(\"\\\"\")[2]\n all_checkpoints = !ls -l $iter_line\n for checkpoint in all_checkpoints:\n if checkpoint.endswith(\"FINAL.h5\"):\n iterations.append(int(checkpoint.split(\"_\")[-2]))\n\n #assert(len(times) == 50 or len(times) == 10)\n return times, iterations",
"_____no_output_____"
],
[
"# cleanup script for old runs\n#!destination=\"/ritter/share/projects/Methods/Eitel_local_filter/experiments_submission/models/MS/full_set/10xrandom_splits/experiment_r3/backup\" find \"/ritter/share/projects/Methods/Eitel_local_filter/experiments_submission/models/MS/full_set/10xrandom_splits/experiment_r3/\" -type f -newermt \"2021-01-01 00:00\" -not -newermt \"2021-01-22 15:55\" -exec bash -c ' dirname=$(dirname {}); mkdir -p \"${destination}/${dirname}\"; echo ! mv {} ${destination}/${dirname}/' \\;;",
"_____no_output_____"
],
[
"times, iterations = get_runtime(\"ADNI_experiment-20_percent-10xrandom_sampling-random_search-Copy1.ipynb\")",
"_____no_output_____"
],
[
"filename_list = {\n \"ADNI_small\" : [\n \"ADNI_baseline-20_percent-10xrandom_sampling-random_search.ipynb\",\n \"ADNI_LiuPatches-20_percent-10xrandom_sampling_random_search.ipynb\",\n \"ADNI_experiment-20_percent-10xrandom_sampling-random_search-Copy1.ipynb\"\n \n ],\n \"UKB_small\" : [\n \"UKB_sex_baseline-20_percent-10xrandom_sampling_random_search-Copy1.ipynb\",\n \"UKB_sex_LiuPatches-20_percent-10xrandom_sampling_random_search.ipynb\",\n \"UKB_sex_experiment-20_percent-10xrandom_sampling-random_search-Copy1.ipynb\"\n ],\n \"MS_small\" : [\n \"MS_baseline-full_set-10xrandom_splits-random_search-Copy2.ipynb\",\n \"MS_LiuPatches-full_set-10xrandom_splits.ipynb\",\n \"MS_experiment-full_set-10xrandom_splits-random_search-Copy1.ipynb\"\n ],\n \"ADNI_big\" : [\n \"ADNI_baseline-full_set-10xrandom_sampling-random_search.ipynb\",\n \"ADNI_LiuPatches-full_set-10xrandom_sampling.ipynb\",\n \"ADNI_experiment-full_set-10xrandom_sampling-random_search.ipynb\"\n ],\n \n \"UKB_big\" : [\n \"UKB_sex_baseline-full_set-10xrandom_sampling-random_search-Copy1.ipynb\",\n \"UKB_sex_LiuPatches-full_set-10xrandom_sampling_random_search.ipynb\",\n \"UKB_sex_experiment-full_set-10xrandom_sampling-random_search-Copy1.ipynb\"\n ],\n \n}",
"_____no_output_____"
],
[
"\"\"\"fig = plt.Figure()\naxs = []\nfor i, experiment in enumerate(filename_list):\n print(experiment)\n time_base, iter_base = get_runtime(filename_list[experiment][0])\n time_pif, iter_pif = get_runtime(filename_list[experiment][1])\n # run statistical test\n test_time = ranksums(time_base, time_pif)\n test_iter = ranksums(iter_base, iter_pif)\n print(f\"Avg time baseline in seconds: {np.mean(time_base)}\")\n print(f\"Avg time PIF in seconds: {np.mean(time_pif)}\")\n print(test_time)\n print(f\"Avg number of iterations baseline: {np.mean(iter_base)}\")\n print(f\"Avg number of iterations PIF: {np.mean(iter_pif)}\")\n print(test_iter)\n \n # plot results\n i *= 3\n ax = plt.bar([i, i+1],\n [np.mean(time_base), np.mean(time_pif)],\n color=[\"tab:blue\", \"tab:orange\"],\n label=[\"Baseline\", \"PIF\"])\n axs.append(ax)\n plt.errorbar(x=[i, i+1], \n y=[np.mean(time_base), np.mean(time_pif)], \n yerr=[sem(time_base), sem(time_pif)], \n color=\"black\",\n ls=\"none\",\n label=\"_Errorbar\")\n \n x1, x2 = i, i+1\n y, h, col = np.max(time_base) + 70, 2, 'k'\n #plt.plot([x1, x1, x2, x2], [y, y+h, y+h, y], lw=1.5, c=col)\n if test_time.pvalue < 0.05:\n plt.text((x1+x2)*.5, y+h, \"*\", ha='center', va='bottom', color=col)\n #else:\n # plt.text((x1+x2)*.5, y+h, \"ns\", ha='center', va='bottom', color=col)\n\nleg = plt.legend(axs, [\"Baseline\", \"PIF\"])\nleg.legendHandles[0].set_color('tab:blue')\nleg.legendHandles[1].set_color('tab:orange')\nplt.xticks(np.arange(0.5, 13, step=3), [\"ADNI small\", \"ADNI big\", \"UKB small\", \"UKB big\", \"VIMS\"])\nplt.ylabel(\"Seconds\")\nplt.title(\"Runtime in seconds\")\nplt.show()\"\"\"",
"_____no_output_____"
],
[
"fig, axes = plt.subplots(1, 2, figsize=(12, 6))\nfig.set_size_inches(w=6.1, h=3.1)\n\ndef inc_y(y):\n if y > 1000:\n y += 2500\n else:\n y += 23\n return y\n\ndef sub_plot(i, ax, base_data, patch_data, pif_data, test_base_patch, test_base_pif, test_patch_pif):\n i *= 4\n ax.bar([i, i+1, i+2],\n [np.mean(base_data), np.mean(patch_data), np.mean(pif_data)],\n color=[\"tab:gray\", \"tab:blue\", \"tab:orange\"],\n ) #label=[\"Baseline\", \"PIF\"])\n\n ax.errorbar(x=[i, i+1, i+2], \n y=[np.mean(base_data), np.mean(patch_data), np.mean(pif_data)], \n yerr=[sem(base_data), sem(patch_data), sem(pif_data)], \n color=\"black\",\n ls=\"none\")\n \n # define coords for significance labels\n y, col = np.mean(patch_data), 'k'\n if y > 360:\n y += 800\n h = 500\n else:\n y += 5\n h = 2\n \n # test between baseline and patch based\n x1, x2 = i, i+1\n if test_base_patch.pvalue < 0.001:\n ax.text((x1+x2)*.5, y+h/2, \"**\", ha='center', va='bottom', color=col)\n ax.plot([x1, x1, x2, x2], [y, y+h, y+h, y], lw=1.5, c=col)\n elif test_base_patch.pvalue < 0.01:\n ax.text((x1+x2)*.5, y+h/2, \"*\", ha='center', va='bottom', color=col)\n ax.plot([x1, x1, x2, x2], [y, y+h, y+h, y], lw=1.5, c=col)\n \n # test between baseline and PIF\n x1, x2 = i, i+2\n if test_base_pif.pvalue < 0.001:\n y = inc_y(y)\n ax.text((x1+x2)*.5, y+h/2, \"**\", ha='center', va='bottom', color=col)\n ax.plot([x1, x1, x2, x2], [y, y+h, y+h, y], lw=1.5, c=col)\n elif test_base_pif.pvalue < 0.01:\n y = inc_y(y)\n ax.text((x1+x2)*.5, y+h/2, \"*\", ha='center', va='bottom', color=col)\n ax.plot([x1, x1, x2, x2], [y, y+h, y+h, y], lw=1.5, c=col)\n \n # test between patch-based and PIF\n x1, x2 = i+1, i+2\n if test_patch_pif.pvalue < 0.001:\n y = inc_y(y)\n ax.text((x1+x2)*.5, y+h/2, \"**\", ha='center', va='bottom', color=col)\n ax.plot([x1, x1, x2, x2], [y, y+h, y+h, y], lw=1.5, c=col)\n elif test_patch_pif.pvalue < 0.05:\n y = inc_y(y)\n ax.text((x1+x2)*.5, y+h/2, \"*\", ha='center', va='bottom', color=col)\n ax.plot([x1, x1, x2, x2], [y, y+h, y+h, y], lw=1.5, c=col)\n \n\nfor i, experiment in enumerate(filename_list):\n print(experiment)\n time_base, iter_base = get_runtime(filename_list[experiment][0])\n time_patch, iter_patch = get_runtime(filename_list[experiment][1])\n time_pif, iter_pif = get_runtime(filename_list[experiment][2])\n # run statistical test\n test_time_base_pif = ranksums(time_base, time_pif)\n test_time_base_patch = ranksums(time_base, time_patch)\n test_time_patch_pif = ranksums(time_patch, time_pif)\n test_iter_base_pif = ranksums(iter_base, iter_pif)\n test_iter_base_patch = ranksums(iter_base, iter_patch)\n test_iter_patch_pif = ranksums(iter_patch, iter_pif)\n print(f\"Avg time baseline in seconds: {np.mean(time_base)}\")\n print(f\"Avg time patch-based in seconds: {np.mean(time_patch)}\")\n print(f\"Avg time PIF in seconds: {np.mean(time_pif)}\")\n print(\"Test time base vs patch \", test_time_base_patch)\n print(\"Test time base vs pif \", test_time_base_pif)\n print(\"Test time patch vs pif \", test_time_patch_pif)\n print(f\"Avg number of iterations baseline: {np.mean(iter_base)}\")\n print(f\"Avg number of iterations patch-based: {np.mean(iter_patch)}\")\n print(f\"Avg number of iterations PIF: {np.mean(iter_pif)}\")\n print(\"Test iter base vs patch \", test_iter_base_patch)\n print(\"Test iter base vs pif \", test_iter_base_pif)\n print(\"Test iter patch vs pif \", test_iter_patch_pif)\n \n # plot run time results\n sub_plot(i, axes[0], time_base, time_patch, time_pif, test_time_base_patch, test_time_base_pif, test_time_patch_pif)\n \n # plot training iters results\n sub_plot(i, axes[1], iter_base, iter_patch, iter_pif, test_iter_base_patch, test_iter_base_pif, test_iter_patch_pif)\n \n \n for ax_idx, ax in enumerate(axes):\n ax.set_xticks(np.arange(1, 20, step=4))\n #ax.set_xticklabels([\"ADNI small\", \"ADNI big\", \"UKB small\", \"UKB big\", \"VIMS\"], rotation=45)\n ax.set_xticklabels([\"ADNI\", \"UKB\", \"VIMS\", \"ADNI\", \"UKB\"], rotation=45)\n ax.annotate('Small', (0.22,0), (0, -42), color=\"gray\", xycoords='axes fraction', textcoords='offset points', va='top') \n ax.annotate('Big', (0.74,0), (0, -42), color=\"gray\", xycoords='axes fraction', textcoords='offset points', va='top') \n trans = ax.get_xaxis_transform()\n \n #ax.annotate('Big', (0.7,0), (0, -30), xycoords=trans, textcoords='offset points', ha='center', va='top') \n #ax.annotate('Neonatal', xy=(1, -.1), xycoords=trans, ha=\"center\", va=\"top\")\n ax.plot([-.4,-.4,10,10],[-.20,-.20-0.03,-.20-0.03,-.20], color=\"gray\", transform=trans, clip_on=False) # line small\n ax.plot([12,12,19,19],[-.20,-.20-0.03,-.20-0.03,-.20], color=\"gray\", transform=trans, clip_on=False) # line big\n if ax_idx == 0:\n ax.set_ylabel(\"Seconds\")\n ax.set_title(\"Run time in seconds\")\n handles, labels = ax.get_legend_handles_labels()\n leg = ax.legend([\"Baseline\", \"Patch-based\", \"PIF\"])\n leg.legendHandles[0] = matplotlib.patches.Rectangle(xy=(-0, -0), width=20, height=7, angle=0)\n leg.legendHandles[0].set_color('tab:gray')\n leg.legendHandles[1] = matplotlib.patches.Rectangle(xy=(-0, -0), width=20, height=7, angle=0)\n leg.legendHandles[1].set_color('tab:blue')\n leg.legendHandles[2] = matplotlib.patches.Rectangle(xy=(-0, -0), width=20, height=7, angle=0)\n leg.legendHandles[2].set_color('tab:orange')\n ax.legend(leg.legendHandles, [\"Baseline\", \"Patch-based\", \"PIF\"], loc=\"upper left\") \n else:\n ax.set_ylabel(\"Iterations\")\n ax.set_title(\"Number of iterations\")\n \n \n#leg = plt.legend(axes, [\"Baseline\", \"PIF\"])\n\n#plt.show()\n\nfig.savefig(os.path.join(save_dir, \"Training_speed_comparison.pgf\"), bbox_inches='tight', dpi=250)\n#fig.show()",
"ADNI_small\nAvg time baseline in seconds: 511.42\nAvg time patch-based in seconds: 554.28\nAvg time PIF in seconds: 369.16\nTest time base vs patch RanksumsResult(statistic=-1.5304280123514791, pvalue=0.12591081960766878)\nTest time base vs pif RanksumsResult(statistic=4.2879559625343244, pvalue=1.8032483134953376e-05)\nTest time patch vs pif RanksumsResult(statistic=6.8938198754571127, pvalue=5.4313789912691996e-12)\nAvg number of iterations baseline: 100.16\nAvg number of iterations patch-based: 175.74\nAvg number of iterations PIF: 78.76\nTest iter base vs patch RanksumsResult(statistic=-7.8658484778965656, pvalue=3.6660406342101307e-15)\nTest iter base vs pif RanksumsResult(statistic=2.9298734470692729, pvalue=0.003391000757993385)\nTest iter patch vs pif RanksumsResult(statistic=8.1105790834752938, pvalue=5.0379086455673431e-16)\nUKB_small\nAvg time baseline in seconds: 5397.66\nAvg time patch-based in seconds: 8297.1\nAvg time PIF in seconds: 4103.74\nTest time base vs patch RanksumsResult(statistic=-8.0864507139111925, pvalue=6.142855827671919e-16)\nTest time base vs pif RanksumsResult(statistic=3.4400161178530992, pvalue=0.00058167954468781014)\nTest time patch vs pif RanksumsResult(statistic=8.410460248057678, pvalue=4.0840496460057363e-17)\nAvg number of iterations baseline: 138.94\nAvg number of iterations patch-based: 186.54\nAvg number of iterations PIF: 108.12\nTest iter base vs patch RanksumsResult(statistic=-5.6081224686843614, pvalue=2.0453328069596184e-08)\nTest iter base vs pif RanksumsResult(statistic=3.2159669719007433, pvalue=0.0013000579336389243)\nTest iter patch vs pif RanksumsResult(statistic=6.5250005121201573, pvalue=6.8001301817872665e-11)\nMS_small\nAvg time baseline in seconds: 260.9\nAvg time patch-based in seconds: 360.76\nAvg time PIF in seconds: 226.54\nTest time base vs patch RanksumsResult(statistic=-5.7115297668162182, pvalue=1.1196510781442768e-08)\nTest time base vs pif RanksumsResult(statistic=1.6200476707324216, pvalue=0.1052220370513733)\nTest time patch vs pif RanksumsResult(statistic=7.3315774375486393, pvalue=2.2745932918706556e-13)\nAvg number of iterations baseline: 86.74\nAvg number of iterations patch-based: 162.765625\nAvg number of iterations PIF: 74.54\nTest iter base vs patch RanksumsResult(statistic=-7.6662152316681578, pvalue=1.7714583541820794e-14)\nTest iter base vs pif RanksumsResult(statistic=1.2270999378313661, pvalue=0.21978503123823834)\nTest iter patch vs pif RanksumsResult(statistic=8.5170651903411976, pvalue=1.6364739171655795e-17)\nADNI_big\nAvg time baseline in seconds: 633.14\nAvg time patch-based in seconds: 1952.12\nAvg time PIF in seconds: 487.28\nTest time base vs patch RanksumsResult(statistic=-8.6172748443213916, pvalue=6.8566414474756441e-18)\nTest time base vs pif RanksumsResult(statistic=4.4671952792962095, pvalue=7.9251781021334182e-06)\nTest time patch vs pif RanksumsResult(statistic=8.6172748443213916, pvalue=6.8566414474756441e-18)\nAvg number of iterations baseline: 48.9\nAvg number of iterations patch-based: 180.20560747663552\nAvg number of iterations PIF: 32.16\nTest iter base vs patch RanksumsResult(statistic=-10.078803425060569, pvalue=6.855588242296088e-24)\nTest iter base vs pif RanksumsResult(statistic=5.5702064593693468, pvalue=2.544376505573105e-08)\nTest iter patch vs pif RanksumsResult(statistic=10.078803425060569, pvalue=6.855588242296088e-24)\nUKB_big\nAvg time baseline in seconds: 20557.2\nAvg time patch-based in seconds: 19034.4\nAvg time PIF in seconds: 15331.8\nTest time base vs patch RanksumsResult(statistic=0.60474315681476354, pvalue=0.54534966801112361)\nTest time base vs pif RanksumsResult(statistic=1.360672102833218, pvalue=0.17361733442494354)\nTest time patch vs pif RanksumsResult(statistic=2.1166010488516727, pvalue=0.034293721036492766)\nAvg number of iterations baseline: 114.0\nAvg number of iterations patch-based: 155.6\nAvg number of iterations PIF: 86.7\nTest iter base vs patch RanksumsResult(statistic=-2.4945655218609, pvalue=0.012611144099313947)\nTest iter base vs pif RanksumsResult(statistic=1.2094863136295271, pvalue=0.22647606604348625)\nTest iter patch vs pif RanksumsResult(statistic=3.2504944678793541, pvalue=0.0011520450981421845)\n"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6c8c870038a5dfc9d8832c0a77213f5f381e0b | 1,484 | ipynb | Jupyter Notebook | mnt/airflow/dags/notebooks/input.ipynb | dataength/automating-your-data-pipeline-with-apache-airflow | 19b7fe4a41874708c5927b7c32f9840f4285090c | [
"MIT"
]
| 30 | 2020-07-09T17:37:47.000Z | 2022-01-19T04:17:02.000Z | mnt/airflow/dags/notebooks/input.ipynb | mizzony/automating-your-data-pipeline-with-apache-airflow | 90a1351de6de78c0f0a6fb2e778e2ba3b7c78f5e | [
"MIT"
]
| 38 | 2021-08-12T08:01:47.000Z | 2022-03-29T22:29:27.000Z | mnt/airflow/dags/notebooks/input.ipynb | mizzony/automating-your-data-pipeline-with-apache-airflow | 90a1351de6de78c0f0a6fb2e778e2ba3b7c78f5e | [
"MIT"
]
| 22 | 2020-07-10T02:41:39.000Z | 2022-03-23T22:08:52.000Z | 15.458333 | 36 | 0.448113 | [
[
[
"name = 'Kan'\nx = 10\ny = 5",
"_____no_output_____"
],
[
"print(name)",
"Kan\n"
],
[
"def add(x, y):\n return x + y",
"_____no_output_____"
],
[
"add(x, y)",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code"
]
]
|
cb6c8e9a562370bfa4b372ecbe596c6fa2669efe | 39,606 | ipynb | Jupyter Notebook | covid_plotting.ipynb | ajtrexler/covid19 | c698476883239cb149b9477b12e318dfe22ceca7 | [
"MIT"
]
| null | null | null | covid_plotting.ipynb | ajtrexler/covid19 | c698476883239cb149b9477b12e318dfe22ceca7 | [
"MIT"
]
| null | null | null | covid_plotting.ipynb | ajtrexler/covid19 | c698476883239cb149b9477b12e318dfe22ceca7 | [
"MIT"
]
| null | null | null | 31.383518 | 8,944 | 0.381281 | [
[
[
"import pandas as pd\nimport matplotlib.pyplot as plt\nimport numpy as np\n%matplotlib inline\nimport ipywidgets as widgets\nfrom ipywidgets import interact, interactive, fixed, interact_manual\nimport plotly.express as px\n\nimport datetime as dt",
"_____no_output_____"
],
[
"covid_tracker_states_daily = \"http://covidtracking.com/api/states/daily.csv\"",
"_____no_output_____"
],
[
"data = pd.read_csv(covid_tracker_states_daily)",
"_____no_output_____"
],
[
"data[\"date\"] = pd.to_datetime(data[\"dateChecked\"])\ndata[\"doy\"] = data[\"date\"].apply(lambda x: x.timetuple().tm_yday)\ndata[\"logPos\"] = np.log10(data[\"positive\"].replace(0,1))\ndata.sort_values(by=\"date\",inplace=True)",
"_____no_output_____"
],
[
"foo = widgets.SelectMultiple(options=sorted(data[\"state\"].unique()),\n value=['MD'],\n #rows=10,\n description='US State')\n@interact\ndef plot_cases(states=foo,\n scalex=[\"linear\",\"log\"]):\n plt.figure(figsize=[12.5,7.5])\n for x in states:\n tmp = data.loc[data[\"state\"] == x]\n plt.plot(tmp[\"date\"].values,tmp[\"positive\"].values,label=x,marker=\"o\") \n plt.yscale(scalex)\n plt.xticks(rotation=45)\n plt.yticks(size=15)\n plt.legend(fontsize=\"large\")\n plt.ylabel(\"number of cases\",size=20)\n\n ",
"_____no_output_____"
],
[
"mostrecent = sorted(data[\"date\"],reverse=True)[0]\n\ntmp = data.loc[data[\"date\"] == mostrecent][[\"state\",\"positive\"]].dropna()\ntmp[\"state\"].values\n\npx.choropleth(locations=tmp[\"state\"].values,\n locationmode=\"USA-states\",\n color=np.log10(tmp[\"positive\"].replace(0,1)).values,\n scope=\"usa\")",
"_____no_output_____"
],
[
"np.polyfit(np.arange(0,len(data.loc[data[\"state\"] == \"NY\"][\"positive\"].values)),\n np.log(data.loc[data[\"state\"] == \"NY\"][\"positive\"].values),\n 1)",
"_____no_output_____"
],
[
"np.exp(3*2)",
"_____no_output_____"
],
[
"np.exp(0.379)",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6c92ce55a88b0d0a866cb15dc8adbff084e672 | 750,155 | ipynb | Jupyter Notebook | notebooks/1_data/transform.ipynb | john-james-ai/DeepCVR | d8c2f98ee4febf7b0a7131d1cf198cee02fcdb2e | [
"BSD-3-Clause"
]
| null | null | null | notebooks/1_data/transform.ipynb | john-james-ai/DeepCVR | d8c2f98ee4febf7b0a7131d1cf198cee02fcdb2e | [
"BSD-3-Clause"
]
| null | null | null | notebooks/1_data/transform.ipynb | john-james-ai/DeepCVR | d8c2f98ee4febf7b0a7131d1cf198cee02fcdb2e | [
"BSD-3-Clause"
]
| null | null | null | 33.477106 | 1,772 | 0.580729 | [
[
[
"# Transform\n## Profile \nObjective of this notebook is to determine the optimal number of partitions vis-a-vis dataset size, number of cores, and spark memory requirements",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport pandas as pd\nfrom datetime import datetime\nfrom deepcvr.data.transform import CommonFeatureTransformer, CoreFeatureTransformer",
"_____no_output_____"
],
[
"n_partitions = np.linspace(18,3000,20)\ncores = 18\ntask_ids = np.arange(1,len(n_partitions)+1)\ntask_name = \"CommonFeatureTransform\"\nfilepath = \"tests/data/preprocessed/train/cvr_common_features_train.csv\"\n",
"_____no_output_____"
],
[
"df = pd.read_csv(filepath)\ndf.head()",
"_____no_output_____"
],
[
"def profile(task_id, task_name, cores, n_partitions):\n start = datetime.now()\n params = {'cores': cores, 'n_partitions': n_partitions}\n x4m = CommonFeatureTransformer(task_id, task_name, params)\n x4m.execute(df)\n end = datetime.now()\n duration = end - start\n duration = duration.total_seconds()\n d = {'task_id': task_id, 'n_partitions': n_partitions, 'partition_size': df.shape[0]/ n_partitions, 'elapsed': duration}\n profile = pd.DataFrame(data=d, index=[0])\n return profile",
"_____no_output_____"
],
[
"profiles = pd.DataFrame()\nfor i in range(20):\n p = profile(task_id=i, task_name=task_name, cores=cores, n_partitions=n_partitions[i])\n profiles = pd.concat([profiles,p], axis=0)\nprofiles\n",
"INFO:operator:CommonFeatureTransformer.execute called with dict_values([0, 'CommonFeatureTransform', {'cores': 18, 'n_partitions': 18.0}, 18])\nDEBUG:deepcvr.data.transform:\tCreate Spark context\nSetting default log level to \"WARN\".\nTo adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).\nDEBUG:py4j.java_gateway:GatewayClient.address is deprecated and will be removed in version 1.0. Use GatewayParameters instead.\nDEBUG:py4j.clientserver:Command to send: A\ndbd00688f8a55f42d0b153c587d720dc4decde06405e5a35ce2b047820ca0a95\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.SparkConf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.api.java.*\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.api.python.*\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.ml.python.*\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.mllib.api.python.*\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.resource.*\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.sql.*\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.sql.api.python.*\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\norg.apache.spark.sql.hive.*\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: j\ni\nrj\nscala.Tuple2\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: r\nu\nSparkConf\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.SparkConf\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.SparkConf\nbTrue\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro0\nDEBUG:py4j.clientserver:Command to send: c\no0\nset\nsspark.master\nslocal[18]\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro1\nDEBUG:py4j.clientserver:Command to send: c\no0\nset\nsspark.app.name\nsDeepCVR Core Features ETL\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro2\nDEBUG:py4j.clientserver:Command to send: c\no0\ncontains\nsspark.serializer.objectStreamReset\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: c\no0\nset\nsspark.serializer.objectStreamReset\ns100\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro3\nDEBUG:py4j.clientserver:Command to send: c\no0\ncontains\nsspark.rdd.compress\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: c\no0\nset\nsspark.rdd.compress\nsTrue\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro4\nDEBUG:py4j.clientserver:Command to send: c\no0\ncontains\nsspark.master\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\no0\ncontains\nsspark.app.name\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\no0\ncontains\nsspark.master\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\no0\nget\nsspark.master\ne\n\nDEBUG:py4j.clientserver:Answer received: !yslocal[18]\nDEBUG:py4j.clientserver:Command to send: c\no0\ncontains\nsspark.app.name\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\no0\nget\nsspark.app.name\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysDeepCVR Core Features ETL\nDEBUG:py4j.clientserver:Command to send: c\no0\ncontains\nsspark.home\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: c\no0\ngetAll\ne\n\nDEBUG:py4j.clientserver:Answer received: !yto5\nDEBUG:py4j.clientserver:Command to send: a\ne\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi7\nDEBUG:py4j.clientserver:Command to send: a\ng\no5\ni0\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro6\nDEBUG:py4j.clientserver:Command to send: c\no6\n_1\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysspark.rdd.compress\nDEBUG:py4j.clientserver:Command to send: c\no6\n_2\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysTrue\nDEBUG:py4j.clientserver:Command to send: a\ne\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi7\nDEBUG:py4j.clientserver:Command to send: a\ng\no5\ni1\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro7\nDEBUG:py4j.clientserver:Command to send: c\no7\n_1\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysspark.serializer.objectStreamReset\nDEBUG:py4j.clientserver:Command to send: c\no7\n_2\ne\n\nDEBUG:py4j.clientserver:Answer received: !ys100\nDEBUG:py4j.clientserver:Command to send: a\ne\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi7\nDEBUG:py4j.clientserver:Command to send: a\ng\no5\ni2\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro8\nDEBUG:py4j.clientserver:Command to send: c\no8\n_1\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysspark.master\nDEBUG:py4j.clientserver:Command to send: c\no8\n_2\ne\n\nDEBUG:py4j.clientserver:Answer received: !yslocal[18]\nDEBUG:py4j.clientserver:Command to send: a\ne\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi7\nDEBUG:py4j.clientserver:Command to send: a\ng\no5\ni3\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro9\nDEBUG:py4j.clientserver:Command to send: c\no9\n_1\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysspark.submit.pyFiles\nDEBUG:py4j.clientserver:Command to send: c\no9\n_2\ne\n\nDEBUG:py4j.clientserver:Answer received: !ys\nDEBUG:py4j.clientserver:Command to send: a\ne\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi7\nDEBUG:py4j.clientserver:Command to send: a\ng\no5\ni4\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro10\nDEBUG:py4j.clientserver:Command to send: c\no10\n_1\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysspark.submit.deployMode\nDEBUG:py4j.clientserver:Command to send: c\no10\n_2\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysclient\nDEBUG:py4j.clientserver:Command to send: a\ne\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi7\nDEBUG:py4j.clientserver:Command to send: a\ng\no5\ni5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro11\nDEBUG:py4j.clientserver:Command to send: c\no11\n_1\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysspark.ui.showConsoleProgress\nDEBUG:py4j.clientserver:Command to send: c\no11\n_2\ne\n\nDEBUG:py4j.clientserver:Answer received: !ystrue\nDEBUG:py4j.clientserver:Command to send: a\ne\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi7\nDEBUG:py4j.clientserver:Command to send: a\ng\no5\ni6\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro12\nDEBUG:py4j.clientserver:Command to send: c\no12\n_1\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysspark.app.name\nDEBUG:py4j.clientserver:Command to send: c\no12\n_2\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysDeepCVR Core Features ETL\nDEBUG:py4j.clientserver:Command to send: a\ne\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi7\nDEBUG:py4j.clientserver:Command to send: r\nu\nJavaSparkContext\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.java.JavaSparkContext\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.api.java.JavaSparkContext\nro0\ne\n\nDEBUG:py4j.clientserver:Command to send: A\ndbd00688f8a55f42d0b153c587d720dc4decde06405e5a35ce2b047820ca0a95\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no1\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no2\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no3\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no4\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no6\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no7\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no5\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Answer received: !yro13\nDEBUG:py4j.clientserver:Command to send: c\no13\nsc\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro14\nDEBUG:py4j.clientserver:Command to send: c\no14\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro15\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonAccumulatorV2\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonAccumulatorV2\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.api.python.PythonAccumulatorV2\ns127.0.0.1\ni41995\nsdbd00688f8a55f42d0b153c587d720dc4decde06405e5a35ce2b047820ca0a95\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro16\nDEBUG:py4j.clientserver:Command to send: c\no13\nsc\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro17\nDEBUG:py4j.clientserver:Command to send: c\no17\nregister\nro16\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonUtils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonUtils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonUtils\nisEncryptionEnabled\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonUtils\nisEncryptionEnabled\nro13\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonUtils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonUtils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonUtils\ngetPythonAuthSocketTimeout\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonUtils\ngetPythonAuthSocketTimeout\nro13\ne\n\nDEBUG:py4j.clientserver:Answer received: !yL15\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonUtils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonUtils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonUtils\ngetSparkBufferSize\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonUtils\ngetSparkBufferSize\nro13\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi65536\nDEBUG:py4j.clientserver:Command to send: r\nu\norg\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.SparkFiles\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.SparkFiles\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.SparkFiles\ngetRootDirectory\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.SparkFiles\ngetRootDirectory\ne\n\nDEBUG:py4j.clientserver:Answer received: !ys/tmp/spark-727f684b-8757-47d1-8217-a9b34302dffe/userFiles-4d1c916e-1f06-4413-b080-0871d4b5f181\nDEBUG:py4j.clientserver:Command to send: c\no15\nget\nsspark.submit.pyFiles\ns\ne\n\nDEBUG:py4j.clientserver:Answer received: !ys\nDEBUG:py4j.clientserver:Command to send: r\nu\norg\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.util\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.util.Utils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.util.Utils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.util.Utils\ngetLocalDir\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\no13\nsc\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro18\nDEBUG:py4j.clientserver:Command to send: c\no18\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro19\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.util.Utils\ngetLocalDir\nro19\ne\n\nDEBUG:py4j.clientserver:Answer received: !ys/tmp/spark-727f684b-8757-47d1-8217-a9b34302dffe\nDEBUG:py4j.clientserver:Command to send: r\nu\norg\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.util\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.util.Utils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.util.Utils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.util.Utils\ncreateTempDir\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.util.Utils\ncreateTempDir\ns/tmp/spark-727f684b-8757-47d1-8217-a9b34302dffe\nspyspark\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro20\nDEBUG:py4j.clientserver:Command to send: c\no20\ngetAbsolutePath\ne\n\nDEBUG:py4j.clientserver:Answer received: !ys/tmp/spark-727f684b-8757-47d1-8217-a9b34302dffe/pyspark-e05d030f-e41b-44f0-95a7-637857b3b952\nDEBUG:py4j.clientserver:Command to send: c\no15\nget\nsspark.python.profile\nsfalse\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysfalse\nDEBUG:py4j.clientserver:Command to send: r\nu\nSparkSession\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.sql.SparkSession\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.sql.SparkSession\ngetDefaultSession\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.sql.SparkSession\ngetDefaultSession\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro21\nDEBUG:py4j.clientserver:Command to send: c\no21\nisDefined\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: r\nu\nSparkSession\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.sql.SparkSession\nDEBUG:py4j.clientserver:Command to send: c\no13\nsc\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro22\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.sql.SparkSession\nro22\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro23\nDEBUG:py4j.clientserver:Command to send: c\no23\nsqlContext\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro24\nDEBUG:py4j.clientserver:Command to send: r\nu\nSparkSession\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.sql.SparkSession\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.sql.SparkSession\nsetDefaultSession\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.sql.SparkSession\nsetDefaultSession\nro23\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: r\nu\nSparkSession\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.sql.SparkSession\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.sql.SparkSession\nsetActiveSession\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.sql.SparkSession\nsetActiveSession\nro23\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro25\nDEBUG:py4j.clientserver:Command to send: c\no25\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro26\nDEBUG:py4j.clientserver:Command to send: c\no26\nsetConfString\nsspark.master\nslocal[18]\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro27\nDEBUG:py4j.clientserver:Command to send: c\no27\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro28\nDEBUG:py4j.clientserver:Command to send: c\no28\nsetConfString\nsspark.app.name\nsDeepCVR Core Features ETL\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no13\nsetLogLevel\nsERROR\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:deepcvr.data.transform:\tCreate Spark dataframe\nDEBUG:py4j.clientserver:Command to send: r\nu\nSparkSession\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.sql.SparkSession\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.sql.SparkSession\nsetActiveSession\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.sql.SparkSession\nsetActiveSession\nro23\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro29\nDEBUG:py4j.clientserver:Command to send: c\no29\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro30\nDEBUG:py4j.clientserver:Command to send: c\no30\nsessionLocalTimeZone\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysAmerica/New_York\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro31\nDEBUG:py4j.clientserver:Command to send: c\no31\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro32\nDEBUG:py4j.clientserver:Command to send: c\no32\narrowPySparkEnabled\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: c\no13\nsc\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro33\nDEBUG:py4j.clientserver:Command to send: c\no33\ndefaultParallelism\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi18\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonRDD\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonRDD\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonRDD\nreadRDDFromFile\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonRDD\nreadRDDFromFile\nro13\ns/tmp/spark-727f684b-8757-47d1-8217-a9b34302dffe/pyspark-e05d030f-e41b-44f0-95a7-637857b3b952/tmppw20o3vv\ni18\ne\n\nDEBUG:py4j.clientserver:Command to send: m\nd\no9\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no10\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no11\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no12\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no14\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no17\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no18\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no19\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no20\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no21\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no22\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no25\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no26\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no27\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no28\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no29\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no30\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no31\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no32\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Answer received: !yro34\nDEBUG:py4j.clientserver:Command to send: c\no34\nid\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi0\nDEBUG:py4j.clientserver:Command to send: r\nu\nSerDeUtil\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.SerDeUtil\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.SerDeUtil\ntoJavaArray\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\no34\nrdd\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro35\nDEBUG:py4j.clientserver:Command to send: c\no35\nisBarrier\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: r\nu\nSerDeUtil\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.SerDeUtil\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.SerDeUtil\npythonToJava\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonUtils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonUtils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonUtils\ngetBroadcastThreshold\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonUtils\ngetBroadcastThreshold\nro13\ne\n\nDEBUG:py4j.clientserver:Answer received: !yL1048576\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonFunction\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonFunction\nDEBUG:py4j.clientserver:Command to send: i\njava.util.HashMap\ne\n\nDEBUG:py4j.clientserver:Answer received: !yao36\nDEBUG:py4j.clientserver:Command to send: c\no36\nput\nsPYTHONHASHSEED\ns0\ne\n\nDEBUG:py4j.clientserver:Answer received: !yn\nDEBUG:py4j.clientserver:Command to send: i\njava.util.ArrayList\ne\n\nDEBUG:py4j.clientserver:Answer received: !ylo37\nDEBUG:py4j.clientserver:Command to send: i\njava.util.ArrayList\ne\n\nDEBUG:py4j.clientserver:Answer received: !ylo38\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.api.python.PythonFunction\njgAWV6gMAAAAAAAAojB9weXNwYXJrLmNsb3VkcGlja2xlLmNsb3VkcGlja2xllIwNX2J1aWx0aW5fdHlwZZSTlIwKTGFtYmRhVHlwZZSFlFKUKGgCjAhDb2RlVHlwZZSFlFKUKEsCSwBLAEsCSwNLE0MOdAB0AYgAgwF8AYMCUwCUToWUjANtYXCUjBVmYWlsX29uX3N0b3BpdGVyYXRpb26UhpSMAV+UjAhpdGVyYXRvcpSGlIxML2hvbWUvam9obi9hbmFjb25kYTMvZW52cy9kZWVwY3ZyL2xpYi9weXRob24zLjgvc2l0ZS1wYWNrYWdlcy9weXNwYXJrL3JkZC5weZSMBGZ1bmOUTYABQwIAAZSMAWaUhZQpdJRSlH2UKIwLX19wYWNrYWdlX1+UjAdweXNwYXJrlIwIX19uYW1lX1+UjAtweXNwYXJrLnJkZJSMCF9fZmlsZV9flGgRdU5OaACMEF9tYWtlX2VtcHR5X2NlbGyUk5QpUpSFlHSUUpSMJHB5c3BhcmsuY2xvdWRwaWNrbGUuY2xvdWRwaWNrbGVfZmFzdJSMEl9mdW5jdGlvbl9zZXRzdGF0ZZSTlGgjfZR9lChoG2gSjAxfX3F1YWxuYW1lX1+UjBVSREQubWFwLjxsb2NhbHM+LmZ1bmOUjA9fX2Fubm90YXRpb25zX1+UfZSMDl9fa3dkZWZhdWx0c19flE6MDF9fZGVmYXVsdHNfX5ROjApfX21vZHVsZV9flGgcjAdfX2RvY19flE6MC19fY2xvc3VyZV9flGgAjApfbWFrZV9jZWxslJOUaAUoaAgoSwFLAEsASwFLAUtTQwR8AFMAlGgKKYwBeJSFlGgRjAg8bGFtYmRhPpRNvAJDAJQpKXSUUpRoGE5OTnSUUpRoJmg8fZR9lChoG2g3aCmMIlJERC5fcmVzZXJpYWxpemUuPGxvY2Fscz4uPGxhbWJkYT6UaCt9lGgtTmguTmgvaBxoME5oMU6MF19jbG91ZHBpY2tsZV9zdWJtb2R1bGVzlF2UjAtfX2dsb2JhbHNfX5R9lHWGlIZSMIWUUpSFlGhBXZRoQ32UaAyMDHB5c3BhcmsudXRpbJRoDJOUc3WGlIZSME6ME3B5c3Bhcmsuc2VyaWFsaXplcnOUjBFCYXRjaGVkU2VyaWFsaXplcpSTlCmBlH2UKIwKc2VyaWFsaXplcpRoTowQUGlja2xlU2VyaWFsaXplcpSTlCmBlIwJYmF0Y2hTaXpllEsodWJoTowVQXV0b0JhdGNoZWRTZXJpYWxpemVylJOUKYGUfZQoaFNoVSmBlGhXSwCMCGJlc3RTaXpllEoAAAEAdWJ0lC4=\nro36\nro37\nspython3\ns3.8\nro38\nro16\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro39\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonRDD\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonRDD\nDEBUG:py4j.clientserver:Command to send: c\no34\nrdd\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro40\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.api.python.PythonRDD\nro40\nro39\nbTrue\nbFalse\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro41\nDEBUG:py4j.clientserver:Command to send: c\no41\nasJavaRDD\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro42\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.SerDeUtil\npythonToJava\nro42\nbTrue\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro43\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.SerDeUtil\ntoJavaArray\nro43\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro44\nDEBUG:py4j.clientserver:Command to send: c\no44\nrdd\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro45\nDEBUG:py4j.clientserver:Command to send: c\no23\napplySchemaToPythonRDD\nro45\ns{\"fields\":[{\"metadata\":{},\"name\":\"common_features_index\",\"nullable\":true,\"type\":\"string\"},{\"metadata\":{},\"name\":\"num_features\",\"nullable\":true,\"type\":\"long\"},{\"metadata\":{},\"name\":\"features_list\",\"nullable\":true,\"type\":\"string\"},{\"metadata\":{},\"name\":\"partition\",\"nullable\":true,\"type\":\"double\"}],\"type\":\"struct\"}\ne\n\nDEBUG:py4j.clientserver:Command to send: m\nd\no36\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no37\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no38\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no33\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no35\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no39\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no40\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no41\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Answer received: !yro46\nDEBUG:deepcvr.data.transform:\tDataFrame created\nDEBUG:py4j.clientserver:Command to send: r\nu\nfunctions\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.sql.functions\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.sql.functions\ncol\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.sql.functions\ncol\nspartition\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro47\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonUtils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonUtils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonUtils\ntoSeq\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: i\njava.util.ArrayList\ne\n\nDEBUG:py4j.clientserver:Answer received: !ylo48\nDEBUG:py4j.clientserver:Command to send: c\no48\nadd\nro47\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonUtils\ntoSeq\nro48\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro49\nDEBUG:py4j.clientserver:Command to send: c\no46\ngroupBy\nro49\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro50\n/home/john/anaconda3/envs/deepcvr/lib/python3.8/site-packages/pyspark/sql/pandas/group_ops.py:81: UserWarning: It is preferred to use 'applyInPandas' over this API. This API will be deprecated in the future releases. See SPARK-28264 for more details.\n warnings.warn(\nDEBUG:py4j.clientserver:Command to send: c\no46\napply\nscommon_features_index\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro51\nDEBUG:py4j.clientserver:Command to send: c\no46\napply\nsnum_features\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro52\nDEBUG:py4j.clientserver:Command to send: c\no46\napply\nsfeatures_list\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro53\nDEBUG:py4j.clientserver:Command to send: c\no46\napply\nspartition\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro54\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro55\nDEBUG:py4j.clientserver:Command to send: c\no55\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro56\nDEBUG:py4j.clientserver:Command to send: c\no56\nsetConfString\nsspark.master\nslocal[18]\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro57\nDEBUG:py4j.clientserver:Command to send: c\no57\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro58\nDEBUG:py4j.clientserver:Command to send: c\no58\nsetConfString\nsspark.app.name\nsDeepCVR Core Features ETL\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonUtils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonUtils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonUtils\ngetBroadcastThreshold\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonUtils\ngetBroadcastThreshold\nro13\ne\n\nDEBUG:py4j.clientserver:Answer received: !yL1048576\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonFunction\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonFunction\nDEBUG:py4j.clientserver:Command to send: i\njava.util.HashMap\ne\n\nDEBUG:py4j.clientserver:Answer received: !yao59\nDEBUG:py4j.clientserver:Command to send: c\no59\nput\nsPYTHONHASHSEED\ns0\ne\n\nDEBUG:py4j.clientserver:Answer received: !yn\nDEBUG:py4j.clientserver:Command to send: i\njava.util.ArrayList\ne\n\nDEBUG:py4j.clientserver:Answer received: !ylo60\nDEBUG:py4j.clientserver:Command to send: i\njava.util.ArrayList\ne\n\nDEBUG:py4j.clientserver:Answer received: !ylo61\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.api.python.PythonFunction\njgAWVGwUAAAAAAACMH3B5c3BhcmsuY2xvdWRwaWNrbGUuY2xvdWRwaWNrbGWUjA1fYnVpbHRpbl90eXBllJOUjApMYW1iZGFUeXBllIWUUpQoaAKMCENvZGVUeXBllIWUUpQoSwFLAEsASwhLB0tDQ1x0AKABoQB9AXwAoAKhAEQAXUZcAn0CfQN8A2QBGQB9BHQDfANkAhkAgwF9BXwDZAMZAH0GdARkBHwEfAV8BmQFjQR9B3QAagV8AXwHZwJkAWQGjQJ9AXEQfAFTAJQoTksASwFLAowVY29tbW9uX2ZlYXR1cmVzX2luZGV4lCiMB2lkX25hbWWUjAhpZF92YWx1ZZSMDG51bV9mZWF0dXJlc5SMDmZlYXR1cmVfc3RyaW5nlHSUjARheGlzlIWUdJQojAJwZJSMCURhdGFGcmFtZZSMCGl0ZXJyb3dzlIwDaW50lIwUcGFyc2VfZmVhdHVyZV9zdHJpbmeUjAZjb25jYXSUdJQojAlwYXJ0aXRpb26UjAZvdXRwdXSUjAFflIwDcm93lGgKaA1oDowCZGaUdJSMNS9ob21lL2pvaG4vcHJvamVjdHMvRGVlcENWUi9kZWVwY3ZyL2RhdGEvdHJhbnNmb3JtLnB5lIwPY29tbW9uX2ZlYXR1cmVzlEviQxoAAwgCEAEIAQwBCAICAQIBAgECAQL8BgcUApQpKXSUUpR9lCiMC19fcGFja2FnZV9flIwMZGVlcGN2ci5kYXRhlIwIX19uYW1lX1+UjBZkZWVwY3ZyLmRhdGEudHJhbnNmb3JtlIwIX19maWxlX1+UjDUvaG9tZS9qb2huL3Byb2plY3RzL0RlZXBDVlIvZGVlcGN2ci9kYXRhL3RyYW5zZm9ybS5weZR1Tk5OdJRSlIwkcHlzcGFyay5jbG91ZHBpY2tsZS5jbG91ZHBpY2tsZV9mYXN0lIwSX2Z1bmN0aW9uX3NldHN0YXRllJOUaC19lH2UKGgoaCGMDF9fcXVhbG5hbWVfX5RoIYwPX19hbm5vdGF0aW9uc19flH2UjA5fX2t3ZGVmYXVsdHNfX5ROjAxfX2RlZmF1bHRzX1+UTowKX19tb2R1bGVfX5RoKYwHX19kb2NfX5ROjAtfX2Nsb3N1cmVfX5ROjBdfY2xvdWRwaWNrbGVfc3VibW9kdWxlc5RdlIwLX19nbG9iYWxzX1+UfZQoaBNoAIwJc3ViaW1wb3J0lJOUjAZwYW5kYXOUhZRSlGgXaCloF5OUdXWGlIZSMIwRcHlzcGFyay5zcWwudHlwZXOUjApTdHJ1Y3RUeXBllJOUKYGUfZQojAZmaWVsZHOUXZQoaEaMC1N0cnVjdEZpZWxklJOUKYGUfZQojARuYW1llGgKjAhkYXRhVHlwZZRoRowKU3RyaW5nVHlwZZSTlCmBlIwIbnVsbGFibGWUiYwIbWV0YWRhdGGUfZR1YmhOKYGUfZQoaFGMDGZlYXR1cmVfbmFtZZRoUmhVaFaJaFd9lHViaE4pgZR9lChoUYwKZmVhdHVyZV9pZJRoUmhGjAhMb25nVHlwZZSTlCmBlGhWiWhXfZR1YmhOKYGUfZQoaFGMDWZlYXR1cmVfdmFsdWWUaFJoRowKRG91YmxlVHlwZZSTlCmBlGhWiWhXfZR1YmWMBW5hbWVzlF2UKGgKaFtoX2hmZYwPX25lZWRDb252ZXJzaW9ulF2UKImJiYlljBZfbmVlZFNlcmlhbGl6ZUFueUZpZWxklIl1YoaULg==\nro59\nro60\nspython3\ns3.8\nro61\nro16\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro62\nDEBUG:py4j.clientserver:Command to send: c\no23\nparseDataType\ns{\"fields\":[{\"metadata\":{},\"name\":\"common_features_index\",\"nullable\":false,\"type\":\"string\"},{\"metadata\":{},\"name\":\"feature_name\",\"nullable\":false,\"type\":\"string\"},{\"metadata\":{},\"name\":\"feature_id\",\"nullable\":false,\"type\":\"long\"},{\"metadata\":{},\"name\":\"feature_value\",\"nullable\":false,\"type\":\"double\"}],\"type\":\"struct\"}\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro63\nDEBUG:py4j.clientserver:Command to send: r\nu\norg\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.sql\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.sql.execution\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.sql.execution.python\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !yp\nDEBUG:py4j.clientserver:Command to send: r\nu\norg.apache.spark.sql.execution.python.UserDefinedPythonFunction\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.sql.execution.python.UserDefinedPythonFunction\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.sql.execution.python.UserDefinedPythonFunction\nscommon_features\nro62\nro63\ni201\nbTrue\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro64\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonUtils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonUtils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonUtils\ntoSeq\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: i\njava.util.ArrayList\ne\n\nDEBUG:py4j.clientserver:Answer received: !ylo65\nDEBUG:py4j.clientserver:Command to send: c\no65\nadd\nro51\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\no65\nadd\nro52\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\no65\nadd\nro53\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\no65\nadd\nro54\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybtrue\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonUtils\ntoSeq\nro65\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro66\nDEBUG:py4j.clientserver:Command to send: c\no64\napply\nro66\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro67\nDEBUG:py4j.clientserver:Command to send: c\no67\nexpr\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro68\nDEBUG:py4j.clientserver:Command to send: c\no50\nflatMapGroupsInPandas\nro68\ne\n\nDEBUG:py4j.clientserver:Command to send: m\nd\no48\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no59\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no60\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no61\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no65\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Answer received: !yro69\nDEBUG:deepcvr.data.transform:\tResults Produced\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro70\nDEBUG:py4j.clientserver:Command to send: c\no70\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro71\nDEBUG:py4j.clientserver:Command to send: c\no71\nsessionLocalTimeZone\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysAmerica/New_York\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro72\nDEBUG:py4j.clientserver:Command to send: c\no72\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro73\nDEBUG:py4j.clientserver:Command to send: c\no73\narrowPySparkEnabled\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: c\no13\nsetCallSite\nstoPandas at /home/john/projects/DeepCVR/deepcvr/data/transform.py:207\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no69\ncollectToPython\ne\n\nDEBUG:py4j.clientserver:Answer received: !yto74 \nDEBUG:py4j.clientserver:Command to send: c\no13\nsetCallSite\nn\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: a\ne\no74\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi3\nDEBUG:py4j.clientserver:Command to send: a\ng\no74\ni0\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi36349\nDEBUG:py4j.clientserver:Command to send: a\ne\no74\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi3\nDEBUG:py4j.clientserver:Command to send: a\ng\no74\ni1\ne\n\nDEBUG:py4j.clientserver:Answer received: !ys6f4301ce4f11f36c5da503f80383bec9afd38ba121d06e761c6f4d9ce828fdd5\nDEBUG:py4j.clientserver:Command to send: m\nd\no43\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no44\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no45\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no47\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no49\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no50\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no51\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no52\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no53\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no54\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no55\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no56\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no57\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no58\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no62\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no63\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no64\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no66\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no67\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no68\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no70\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no71\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no72\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no73\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no8\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no0\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no42\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: m\nd\no34\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no69\nschema\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro75\nDEBUG:py4j.clientserver:Command to send: c\no75\njson\ne\n\nDEBUG:py4j.clientserver:Answer received: !ys{\"type\":\"struct\",\"fields\":[{\"name\":\"common_features_index\",\"type\":\"string\",\"nullable\":false,\"metadata\":{}},{\"name\":\"feature_name\",\"type\":\"string\",\"nullable\":false,\"metadata\":{}},{\"name\":\"feature_id\",\"type\":\"long\",\"nullable\":false,\"metadata\":{}},{\"name\":\"feature_value\",\"type\":\"double\",\"nullable\":false,\"metadata\":{}}]}\nDEBUG:py4j.clientserver:Command to send: m\nd\no74\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:deepcvr.data.transform:\tConverted to Pandas\nINFO:operator:CommonFeatureTransformer.execute called with dict_values([1, 'CommonFeatureTransform', {'cores': 18, 'n_partitions': 174.94736842105263}, 18])\nDEBUG:deepcvr.data.transform:\tCreate Spark context\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro76\nDEBUG:py4j.clientserver:Command to send: c\no76\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro77\nDEBUG:py4j.clientserver:Command to send: c\no77\nsetConfString\nsspark.master\nslocal[18]\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro78\nDEBUG:py4j.clientserver:Command to send: c\no78\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro79\nDEBUG:py4j.clientserver:Command to send: c\no79\nsetConfString\nsspark.app.name\nsDeepCVR Core Features ETL\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no13\nsetLogLevel\nsERROR\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:deepcvr.data.transform:\tCreate Spark dataframe\nDEBUG:py4j.clientserver:Command to send: r\nu\nSparkSession\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.sql.SparkSession\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.sql.SparkSession\nsetActiveSession\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.sql.SparkSession\nsetActiveSession\nro23\ne\n\nDEBUG:py4j.clientserver:Answer received: !yv\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro80\nDEBUG:py4j.clientserver:Command to send: c\no80\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro81\nDEBUG:py4j.clientserver:Command to send: c\no81\nsessionLocalTimeZone\ne\n\nDEBUG:py4j.clientserver:Answer received: !ysAmerica/New_York\nDEBUG:py4j.clientserver:Command to send: c\no23\nsessionState\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro82\nDEBUG:py4j.clientserver:Command to send: c\no82\nconf\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro83\nDEBUG:py4j.clientserver:Command to send: c\no83\narrowPySparkEnabled\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: c\no13\nsc\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro84\nDEBUG:py4j.clientserver:Command to send: c\no84\ndefaultParallelism\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi18\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonRDD\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonRDD\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonRDD\nreadRDDFromFile\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonRDD\nreadRDDFromFile\nro13\ns/tmp/spark-727f684b-8757-47d1-8217-a9b34302dffe/pyspark-e05d030f-e41b-44f0-95a7-637857b3b952/tmpr7nbtekf\ni18\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro85\nDEBUG:py4j.clientserver:Command to send: c\no85\nid\ne\n\nDEBUG:py4j.clientserver:Answer received: !yi11\nDEBUG:py4j.clientserver:Command to send: r\nu\nSerDeUtil\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.SerDeUtil\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.SerDeUtil\ntoJavaArray\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\no85\nrdd\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro86\nDEBUG:py4j.clientserver:Command to send: c\no86\nisBarrier\ne\n\nDEBUG:py4j.clientserver:Answer received: !ybfalse\nDEBUG:py4j.clientserver:Command to send: r\nu\nSerDeUtil\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.SerDeUtil\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.SerDeUtil\npythonToJava\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonUtils\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonUtils\nDEBUG:py4j.clientserver:Command to send: r\nm\norg.apache.spark.api.python.PythonUtils\ngetBroadcastThreshold\ne\n\nDEBUG:py4j.clientserver:Answer received: !ym\nDEBUG:py4j.clientserver:Command to send: c\nz:org.apache.spark.api.python.PythonUtils\ngetBroadcastThreshold\nro13\ne\n\nDEBUG:py4j.clientserver:Answer received: !yL1048576\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonFunction\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonFunction\nDEBUG:py4j.clientserver:Command to send: i\njava.util.HashMap\ne\n\nDEBUG:py4j.clientserver:Answer received: !yao87\nDEBUG:py4j.clientserver:Command to send: c\no87\nput\nsPYTHONHASHSEED\ns0\ne\n\nDEBUG:py4j.clientserver:Answer received: !yn\nDEBUG:py4j.clientserver:Command to send: i\njava.util.ArrayList\ne\n\nDEBUG:py4j.clientserver:Answer received: !ylo88\nDEBUG:py4j.clientserver:Command to send: i\njava.util.ArrayList\ne\n\nDEBUG:py4j.clientserver:Answer received: !ylo89\nDEBUG:py4j.clientserver:Command to send: i\norg.apache.spark.api.python.PythonFunction\njgAWV6gMAAAAAAAAojB9weXNwYXJrLmNsb3VkcGlja2xlLmNsb3VkcGlja2xllIwNX2J1aWx0aW5fdHlwZZSTlIwKTGFtYmRhVHlwZZSFlFKUKGgCjAhDb2RlVHlwZZSFlFKUKEsCSwBLAEsCSwNLE0MOdAB0AYgAgwF8AYMCUwCUToWUjANtYXCUjBVmYWlsX29uX3N0b3BpdGVyYXRpb26UhpSMAV+UjAhpdGVyYXRvcpSGlIxML2hvbWUvam9obi9hbmFjb25kYTMvZW52cy9kZWVwY3ZyL2xpYi9weXRob24zLjgvc2l0ZS1wYWNrYWdlcy9weXNwYXJrL3JkZC5weZSMBGZ1bmOUTYABQwIAAZSMAWaUhZQpdJRSlH2UKIwLX19wYWNrYWdlX1+UjAdweXNwYXJrlIwIX19uYW1lX1+UjAtweXNwYXJrLnJkZJSMCF9fZmlsZV9flGgRdU5OaACMEF9tYWtlX2VtcHR5X2NlbGyUk5QpUpSFlHSUUpSMJHB5c3BhcmsuY2xvdWRwaWNrbGUuY2xvdWRwaWNrbGVfZmFzdJSMEl9mdW5jdGlvbl9zZXRzdGF0ZZSTlGgjfZR9lChoG2gSjAxfX3F1YWxuYW1lX1+UjBVSREQubWFwLjxsb2NhbHM+LmZ1bmOUjA9fX2Fubm90YXRpb25zX1+UfZSMDl9fa3dkZWZhdWx0c19flE6MDF9fZGVmYXVsdHNfX5ROjApfX21vZHVsZV9flGgcjAdfX2RvY19flE6MC19fY2xvc3VyZV9flGgAjApfbWFrZV9jZWxslJOUaAUoaAgoSwFLAEsASwFLAUtTQwR8AFMAlGgKKYwBeJSFlGgRjAg8bGFtYmRhPpRNvAJDAJQpKXSUUpRoGE5OTnSUUpRoJmg8fZR9lChoG2g3aCmMIlJERC5fcmVzZXJpYWxpemUuPGxvY2Fscz4uPGxhbWJkYT6UaCt9lGgtTmguTmgvaBxoME5oMU6MF19jbG91ZHBpY2tsZV9zdWJtb2R1bGVzlF2UjAtfX2dsb2JhbHNfX5R9lHWGlIZSMIWUUpSFlGhBXZRoQ32UaAyMDHB5c3BhcmsudXRpbJRoDJOUc3WGlIZSME6ME3B5c3Bhcmsuc2VyaWFsaXplcnOUjBFCYXRjaGVkU2VyaWFsaXplcpSTlCmBlH2UKIwKc2VyaWFsaXplcpRoTowQUGlja2xlU2VyaWFsaXplcpSTlCmBlIwJYmF0Y2hTaXpllEsodWJoTowVQXV0b0JhdGNoZWRTZXJpYWxpemVylJOUKYGUfZQoaFNoVSmBlGhXSwCMCGJlc3RTaXpllEoAAAEAdWJ0lC4=\nro87\nro88\nspython3\ns3.8\nro89\nro16\ne\n\nDEBUG:py4j.clientserver:Answer received: !yro90\nDEBUG:py4j.clientserver:Command to send: r\nu\nPythonRDD\nrj\ne\n\nDEBUG:py4j.clientserver:Answer received: !ycorg.apache.spark.api.python.PythonRDD\nDEBUG:py4j.clientserver:Command to send: c\no85\nrdd\ne\n\n"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6c95aad052c03c89fc5c4a4fe7b4c274cf99b4 | 50,518 | ipynb | Jupyter Notebook | Forecast Calculations.ipynb | jdw686/Tax-Forecast | 729f1316ac622757abe2e81b31397a26b18e42d2 | [
"MIT"
]
| null | null | null | Forecast Calculations.ipynb | jdw686/Tax-Forecast | 729f1316ac622757abe2e81b31397a26b18e42d2 | [
"MIT"
]
| null | null | null | Forecast Calculations.ipynb | jdw686/Tax-Forecast | 729f1316ac622757abe2e81b31397a26b18e42d2 | [
"MIT"
]
| null | null | null | 52.787879 | 18,332 | 0.604735 | [
[
[
"import forecasting as fc\nimport pandas as pd\nimport numpy as np\nimport warnings\nwarnings.simplefilter('ignore')\n\nrevenues = pd.read_csv('Final Tables by Tax Source/final_data_revenue.csv')\nrevenues['Date'] = pd.to_datetime(revenues['Date'])\nrevenues = revenues.iloc[:, 1:]",
"_____no_output_____"
]
],
[
[
"1. Create forecasts DataFrame, containing all forecasts on a rolling monthly basis for each tax source.",
"_____no_output_____"
]
],
[
[
"forecasts = pd.DataFrame()\nfor i in revenues.Category.unique():\n df = revenues[revenues['Category'] == i].set_index('Date')\n df['Rolling Total'] = df['Monthly Total'].rolling(12).sum()\n result = fc.forecast(df, steps = 24)\n forecasts = pd.concat([result, forecasts])",
"_____no_output_____"
],
[
"len(list(revenues.Category.unique()))",
"_____no_output_____"
],
[
"forecasts.index = list(forecasts.reset_index()['index'][:24])*22\nforecasts['Date'] = forecasts.index\nforecasts['Year'] = forecasts['Date'].dt.year\nforecasts['Month'] = forecasts['Date'].dt.month",
"_____no_output_____"
]
],
[
[
"2. Create 2020 Revenue Budget, creating separate DataFrame showing all entries for December 2020.",
"_____no_output_____"
]
],
[
[
"forecast_2020 = forecasts[(forecasts['Year'] == 2020) & (forecasts['Month'] == 12)].sort_values(by = 'Category')",
"_____no_output_____"
],
[
"forecast_2020['Percentage Method'] = forecast_2020['Percentage Method'].fillna(forecast_2020['Difference Method'])",
"_____no_output_____"
],
[
"forecast_2020['Difference Method'] = forecast_2020['Difference Method'].astype(int)\nforecast_2020['Percentage Method'] = forecast_2020['Percentage Method'].astype(int)",
"_____no_output_____"
]
],
[
[
"2.1. Selects the lower estimate of the two methods. Other determinations can be made, it is ultimately up to professional judgement based on the algorithm results.",
"_____no_output_____"
]
],
[
[
"result_2020 = np.where(forecast_2020['Difference Method'].ge(forecast_2020['Percentage Method']) == True, forecast_2020['Percentage Method'], forecast_2020['Difference Method'])",
"_____no_output_____"
],
[
"forecast_2020['Final Result'] = result_2020",
"_____no_output_____"
],
[
"forecast_2020",
"_____no_output_____"
]
],
[
[
"2.2 Apply Final Forecast column to entire forecasts DataFrame",
"_____no_output_____"
]
],
[
[
"result_series = np.where(forecasts['Difference Method'].ge(forecasts['Percentage Method']) == True, forecasts['Percentage Method'], forecasts['Difference Method'])",
"_____no_output_____"
],
[
"forecasts['Final Result'] = result_series",
"_____no_output_____"
],
[
"forecasts['Percentage Method'] = forecasts['Percentage Method'].fillna(forecasts['Difference Method'])",
"_____no_output_____"
],
[
"forecasts.columns = ['Category', 'Difference Method', 'Percentage Method', 'Date', 'Year',\n 'Month', 'Rolling Total']",
"_____no_output_____"
],
[
"forecasts.to_csv('forecast.csv')",
"_____no_output_____"
]
],
[
[
"3. Add rolling values for prior years",
"_____no_output_____"
]
],
[
[
"rolling_total = pd.DataFrame()\nfor i in revenues.Category.unique():\n df = revenues[revenues['Category'] == i].set_index('Date')\n df['Rolling Total'] = df['Monthly Total'].rolling(12).sum()\n rolling_total = pd.concat([df, rolling_total])",
"_____no_output_____"
],
[
"forecasting = pd.concat([rolling_total, forecasts])",
"_____no_output_____"
],
[
"forecasting['Date'] = forecasting.index",
"_____no_output_____"
],
[
"forecasting.tail(15)",
"_____no_output_____"
]
],
[
[
"3.2 Create a plot for a total for all net federal revenues (more plots and dashboarding to come)",
"_____no_output_____"
]
],
[
[
"forecast_plot = forecasting.groupby(['Date'])['Rolling Total'].sum().reset_index()",
"_____no_output_____"
],
[
"import seaborn as sns\nsns.lineplot(x = forecast_plot['Date'][12:], y = forecast_plot['Rolling Total'])",
"_____no_output_____"
],
[
"forecasting.to_csv('forecasting.csv')",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
]
|
cb6c975ed5d4c3bcf62b30dcae4a685f2afe1cc2 | 18,440 | ipynb | Jupyter Notebook | Teleportation/Teleportation.ipynb | kant/QuantumKatas | 1ce273d5871ac4f1c88680766597f3f47cafa6b0 | [
"MIT"
]
| 1 | 2020-10-23T10:11:56.000Z | 2020-10-23T10:11:56.000Z | Teleportation/Teleportation.ipynb | kant/QuantumKatas | 1ce273d5871ac4f1c88680766597f3f47cafa6b0 | [
"MIT"
]
| null | null | null | Teleportation/Teleportation.ipynb | kant/QuantumKatas | 1ce273d5871ac4f1c88680766597f3f47cafa6b0 | [
"MIT"
]
| null | null | null | 38.099174 | 483 | 0.613774 | [
[
[
"empty"
]
]
]
| [
"empty"
]
| [
[
"empty"
]
]
|
cb6cac1614c314333c894cd5d072ab178f90679d | 3,491 | ipynb | Jupyter Notebook | gsarti_notes/lesson_15 - Iterative Methods pt.2.ipynb | gsarti/P1.4_seed | e09dc4381c5da0c5781e185d7bce69679b8fca66 | [
"CC-BY-4.0"
]
| 1 | 2018-11-08T07:53:28.000Z | 2018-11-08T07:53:28.000Z | gsarti_notes/lesson_15 - Iterative Methods pt.2.ipynb | gsarti/P1.4_seed | e09dc4381c5da0c5781e185d7bce69679b8fca66 | [
"CC-BY-4.0"
]
| null | null | null | gsarti_notes/lesson_15 - Iterative Methods pt.2.ipynb | gsarti/P1.4_seed | e09dc4381c5da0c5781e185d7bce69679b8fca66 | [
"CC-BY-4.0"
]
| 1 | 2019-01-26T11:41:55.000Z | 2019-01-26T11:41:55.000Z | 37.138298 | 284 | 0.61501 | [
[
[
"# Richardson method\n\n$$P(x^{(k+1)}-x^{(k)} = \\alpha_kr^{(k)}, k \\geq 0$$\n\nThere are two version of the Richardson method:\n\n\n* the **Stationary case**, where $\\alpha_k$ is equal to a constant.\n\n\n* the **Dynamic case**, where $\\alpha_k$ is updated for each iteration.\n\nThe matrix $P$ is the preconditioner. It should be a triangular or a diagonal matrix, in order to make the resulting matrix easy to compute.\n\nFrom the original formula of the Richardson method, we obtain that\n\n$$X^{k+1} = X^k (I-\\alpha_KP^{-1}A)+\\alpha_KP^{-1}b$$\n\nIn this formula, $I-\\alpha_KP^{-1}A$ represents $B = R_\\alpha$\n\nWe can find the set of eigenvalues of this matrix as follows\n\n$$\\tilde{\\lambda}(R_\\alpha) = 1 - \\alpha\\lambda_i$$\n\nsince 1 is the eigenvalue of I and $\\alpha\\lambda_i$ are the eigenvalues of $\\alpha_KP^{-1}A$. We compute the spectral radius as\n\n$$\\rho(\\hat{x}) = max|1 - \\alpha\\lambda_i|$$\n\nAs shown in slide 19, this leads to the proof that the optimal value for $\\alpha = \\frac{2}{\\lambda_{min}+\\lambda_{max}}$",
"_____no_output_____"
],
[
"## Conjugate Gradient Method\n\nThe conjugate gradient method is a very efficient method used to solve linear systems for $A$ and $P$ which are **symmetric positive definite**.\n\nGradient methods are also known as descent method because it approximates the solutions of the linear system by moving step by step towards the solution.\n\nEven though it was conceived as a gradient method, it is truly a one-shot method since to obtain the solution one should simply iterate a fixed number of times (that is, the size of the matrix A).\n\nThe difference between the gradient and the conjugate gradient is given by the fact that in the latter you can reach the minimum faster thanks to an additional degree of freedom, which allows a movement towards the minimum which is not constrained by mandatory orthogonality.\n\n**This method converges more rapidly than Gauss-Seidel and Jacobi ones for s.p.d. linear systems.**\n\n\n## Some observations on iterative methods\n\n* If error and residual values are very different from each other, the matrix is probably heavily ill-conditioned and something is going wrong.\n\n* The number of operations and memory used by conjugate gradient are way smaller than those used by a Cholesky factorization method if the size of the matrix is large.\n\n* We can use factorization in order to obtain a pr",
"_____no_output_____"
]
]
]
| [
"markdown"
]
| [
[
"markdown",
"markdown"
]
]
|
cb6cb5092a1bb4aeb98b999c50510274441b6121 | 261,471 | ipynb | Jupyter Notebook | Python_APIs/day-03/02/day-03_02.ipynb | EricNg314/Code-Drills | 086c177149e58ed7d0714242dc67d36a9b5208d0 | [
"MIT"
]
| 2 | 2018-08-23T19:06:42.000Z | 2018-10-13T05:59:35.000Z | Python_APIs/day-03/02/day-03_02.ipynb | EricNg314/Code-Drills | 086c177149e58ed7d0714242dc67d36a9b5208d0 | [
"MIT"
]
| null | null | null | Python_APIs/day-03/02/day-03_02.ipynb | EricNg314/Code-Drills | 086c177149e58ed7d0714242dc67d36a9b5208d0 | [
"MIT"
]
| null | null | null | 38.048749 | 482 | 0.442745 | [
[
[
"# Import dependencies pandas,\n # requests, gmaps, census, and finally config's census_key and google_key\n\n",
"_____no_output_____"
],
[
"# Declare a variable \"c\" and set it to the census with census_key.\n # https://github.com/datamade/census\n # We're going to use the default year 2016, however feel free to use another year.\n",
"_____no_output_____"
],
[
"# Run a census search to retrieve data on estimate of male, female, population, and unemployment count for each zip code.\n # https://api.census.gov/data/2013/acs5/variables.html\n\n\n# Show the output of census_data\n\n",
"_____no_output_____"
],
[
"# Create a variable census_pd and set it to a dataframe made with the census_data's list of dictionaries\n\n\n# Rename census_pd with appropriate columns \"Male\", \"Female\", \"Population\", \"Unemployment Count\", and \"Zipcode\"\n\n\n\n\n# Show the first 5 rows of census_pd\n",
"_____no_output_____"
],
[
"# Create a new variable calc_census_pd and set it to census_pd\n\n\n# Calculate the % of male to female ratio and add them as new columns Male % and Female %.\n\n\n\n# Calculate the unemployment rate based on population\n\n\n# Show the first 5 rows of calc_census_pd\n",
"_____no_output_____"
],
[
"# Get the correlation coefficients of calc_census_pd\n",
"_____no_output_____"
]
],
[
[
"### Critical Thinking: From the above correlation table. What does the unemployment rate tell you about its correlation with the number of males or females?",
"_____no_output_____"
],
[
"#### ANSWER: \n",
"_____no_output_____"
]
],
[
[
"# Use the describe function to get a quick glance at calc_census_pd.\n",
"_____no_output_____"
]
],
[
[
"### Do you see anything strange about male % or female % in the describe above?",
"_____no_output_____"
],
[
"#### ANSWER: \n",
"_____no_output_____"
]
],
[
[
"# Create two variables called \"male_zipcode_outliers\" and \"female_zipcode_outliers\"\n # Set them to queries where male or female is are the outliers based on the described data from previous task.\n # Example: anything greater than 0.95 is an outlier\n\n\n# Show all rows for either \"male_zipcode_outliers\" and \"female_zipcode_outliers\"\n",
"_____no_output_____"
]
],
[
[
"### What is a possible cause of some outliers with larger populations?",
"_____no_output_____"
],
[
"Hint: Look up the zipcode for larger population of either male or female outliers. \nWhat information do these zipcodes have in common?\n\n### ANSWER: \n",
"_____no_output_____"
],
[
"# Heatmap of population",
"_____no_output_____"
]
],
[
[
"# Create a variable \"zip_lng_lat_data\" and using pandas import the zip_codes_states.csv from Resources folder.\n # https://www.gaslampmedia.com/download-zip-code-latitude-longitude-city-state-county-csv/\n \n # HINT: When loading zipcodes they may turn into integers and lose their 0's. \n # To correct this check out dtype in the documentation:\n # https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html\n\n\n# Show the first 5 rows of zip_lng_lat_data\n",
"_____no_output_____"
],
[
"# Get the longitude and latitude based calc_census_pd by merging them on their zip code columns.\n\n\n# Show the first 5 rows of merged_table\n",
"_____no_output_____"
],
[
"# Configure gmaps with API key\n",
"_____no_output_____"
],
[
"# Define locations as a dataframe of latitude and longitude from merged_table.\n # HINT: You'll need to drop the NaN before storing into locations or population\n\n\n# Define population as the population from merged_table\n # HINT: You'll need to drop the NaN before storing into locations or population\n\n",
"_____no_output_____"
],
[
"# Create a population Heatmap layer\n # Note you may need to run the following in your terminal to show the gmaps figure.\n # jupyter nbextension enable --py --sys-prefix widgetsnbextension\n # jupyter nbextension enable --py --sys-prefix gmaps\n\n\n# Recommended settings for heatmap layer: max_intensity=2000000 and point radius = 1\n\n\n\n# Adjust heat_layer setting to help with heatmap dissipating on zoom\n\n\n\n\n",
"_____no_output_____"
]
],
[
[
"### What is a downfall of using zip codes for mapping?",
"_____no_output_____"
],
[
"### ANSWER: \n https://gis.stackexchange.com/questions/5114/obtaining-up-to-date-list-of-us-zip-codes-with-latitude-and-longitude-geocodes\n ZIP codes are a habitually abused geography. It's understandable that people want to use them because they are so visible and well-known but they aren't well suited to any use outside the USPS. ZIP codes aren't associated with polygons, they are associated with carrier routes and the USPS doesn't like to share those. Some ZIP codes are points e.g. a ZIP code may be associated with a post office, a university or a large corporate complex. They are used to deliver mail.\n\n The Census Bureau creates ZIP Code Tabulation Areas (ZCTA) based on their address database. If it's appropriate to your work you could try taking the centroid of the ZCTAs. ZCTA Geography from the 2010 Census is available on the Census Bureau website.\n\n",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
]
]
|
cb6cc2aebf609250435bcda93f40954f2dfc7e23 | 854,703 | ipynb | Jupyter Notebook | study_roadmaps/2_transfer_learning_roadmap/5_exploring_model_families/4_resnet/1.1) Intro to resnet18-v1 network - mxnet backend.ipynb | arijitgupta42/monk_v1 | bc7c57ad342f96fc779ac8db530d6ee614d093c0 | [
"Apache-2.0"
]
| null | null | null | study_roadmaps/2_transfer_learning_roadmap/5_exploring_model_families/4_resnet/1.1) Intro to resnet18-v1 network - mxnet backend.ipynb | arijitgupta42/monk_v1 | bc7c57ad342f96fc779ac8db530d6ee614d093c0 | [
"Apache-2.0"
]
| null | null | null | study_roadmaps/2_transfer_learning_roadmap/5_exploring_model_families/4_resnet/1.1) Intro to resnet18-v1 network - mxnet backend.ipynb | arijitgupta42/monk_v1 | bc7c57ad342f96fc779ac8db530d6ee614d093c0 | [
"Apache-2.0"
]
| null | null | null | 600.634575 | 695,024 | 0.948091 | [
[
[
"# Goals\n\n\n### Train a classifier using resnet18 on natural-images dataset\n\n### Understand what lies inside resnet18 network",
"_____no_output_____"
],
[
"# What is resnet\n\n## Readings on resnet\n\n 1) Points from https://towardsdatascience.com/an-overview-of-resnet-and-its-variants-5281e2f56035\n - The core idea of ResNet is introducing a so-called “identity shortcut connection” that skips one or more layers\n - The deeper model should not produce a training error higher than its shallower counterparts.\n - solves the problem of vanishing gradiens as network depth increased - https://medium.com/@anishsingh20/the-vanishing-gradient-problem-48ae7f501257\n \n \n \n 2) Points from https://medium.com/@14prakash/understanding-and-implementing-architectures-of-resnet-and-resnext-for-state-of-the-art-image-cf51669e1624\n - Won 1st place in the ILSVRC 2015 classification competition with top-5 error rate of 3.57% (An ensemble model)\n - Efficiently trained networks with 100 layers and 1000 layers also.\n - Replacing VGG-16 layers in Faster R-CNN with ResNet-101. They observed a relative improvements of 28%\n \n\n 3) Read more here\n - https://arxiv.org/abs/1512.03385\n - https://d2l.ai/chapter_convolutional-modern/resnet.html\n - https://cv-tricks.com/keras/understand-implement-resnets/\n - https://mc.ai/resnet-architecture-explained/\n",
"_____no_output_____"
],
[
"# Table of Contents\n\n\n## [0. Install](#0)\n\n\n## [1. Load experiment with resnet base architecture](#1)\n\n\n## [2. Visualize resnet](#2)\n\n\n## [3. Train the classifier](#3)\n\n\n## [4. Run inference on trained classifier](#5)",
"_____no_output_____"
],
[
"<a id='0'></a>\n# Install Monk\n \n - git clone https://github.com/Tessellate-Imaging/monk_v1.git\n \n - cd monk_v1/installation/Linux && pip install -r requirements_cu9.txt\n - (Select the requirements file as per OS and CUDA version)",
"_____no_output_____"
]
],
[
[
"!git clone https://github.com/Tessellate-Imaging/monk_v1.git",
"Cloning into 'monk_v1'...\nremote: Enumerating objects: 207, done.\u001b[K\nremote: Counting objects: 100% (207/207), done.\u001b[K\nremote: Compressing objects: 100% (149/149), done.\u001b[K\nremote: Total 2112 (delta 115), reused 121 (delta 57), pack-reused 1905\u001b[K\nReceiving objects: 100% (2112/2112), 73.72 MiB | 4.33 MiB/s, done.\nResolving deltas: 100% (1135/1135), done.\n"
],
[
"# Select the requirements file as per OS and CUDA version\n!cd monk_v1/installation/Linux/ && pip install -r requirements_cu9.txt",
"_____no_output_____"
]
],
[
[
"## Dataset - Natural Images Classification\n - https://www.kaggle.com/prasunroy/natural-images",
"_____no_output_____"
]
],
[
[
"! wget --load-cookies /tmp/cookies.txt \"https://docs.google.com/uc?export=download&confirm=$(wget --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1sbQ_KaEDd7kRrTvna-4odLqxM2G0QT0Z' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\\1\\n/p')&id=1sbQ_KaEDd7kRrTvna-4odLqxM2G0QT0Z\" -O natural-images.zip && rm -rf /tmp/cookies.txt",
"_____no_output_____"
],
[
"! unzip -qq natural-images.zip",
"_____no_output_____"
]
],
[
[
"# Imports",
"_____no_output_____"
]
],
[
[
"# Monk\nimport os\nimport sys\nsys.path.append(\"monk_v1/monk/\");",
"_____no_output_____"
],
[
"#Using mxnet-gluon backend \nfrom gluon_prototype import prototype",
"_____no_output_____"
]
],
[
[
"<a id='1'></a>\n# Load experiment with resnet base architecture",
"_____no_output_____"
],
[
"## Creating and managing experiments\n - Provide project name\n - Provide experiment name\n - For a specific data create a single project\n - Inside each project multiple experiments can be created\n - Every experiment can be have diferent hyper-parameters attached to it",
"_____no_output_____"
]
],
[
[
"gtf = prototype(verbose=1);\ngtf.Prototype(\"Project\", \"resnet-intro\");",
"Mxnet Version: 1.5.0\n\nExperiment Details\n Project: Project\n Experiment: resnet-intro\n Dir: /home/abhi/Desktop/Work/tess_tool/gui/v0.3/finetune_models/Organization/development/v5.0_blocks/study_roadmap/change_post_num_layers/6_transfer_learning_model_params/1_exploring_model_families/3_resnet/workspace/Project/resnet-intro/\n\n"
]
],
[
[
"### This creates files and directories as per the following structure\n \n \n workspace\n |\n |--------Project\n |\n |\n |-----resnet-intro\n |\n |-----experiment-state.json\n |\n |-----output\n |\n |------logs (All training logs and graphs saved here)\n |\n |------models (all trained models saved here)",
"_____no_output_____"
],
[
"## Set dataset and select the model",
"_____no_output_____"
],
[
"## Quick mode training\n\n - Using Default Function\n - dataset_path\n - model_name\n - freeze_base_network\n - num_epochs\n \n \n## Sample Dataset folder structure\n\n natural-images\n |\n |-----train\n |------aeroplane\n |\n |------img1.jpg\n |------img2.jpg\n |------.... (and so on)\n |------car\n |\n |------img1.jpg\n |------img2.jpg\n |------.... (and so on) \n |------.... (and so on)\n |\n |\n |-----val\n |------aeroplane\n |\n |------img1.jpg\n |------img2.jpg\n |------.... (and so on)\n |------car\n |\n |------img1.jpg\n |------img2.jpg\n |------.... (and so on) \n |------.... (and so on)",
"_____no_output_____"
]
],
[
[
"gtf.Default(dataset_path=\"natural-images/train\", \n model_name=\"resnet18_v1\", \n freeze_base_network=False,\n num_epochs=5);",
"Dataset Details\n Train path: natural-images/train\n Val path: None\n CSV train path: None\n CSV val path: None\n\nDataset Params\n Input Size: 224\n Batch Size: 4\n Data Shuffle: True\n Processors: 4\n Train-val split: 0.7\n\nPre-Composed Train Transforms\n[{'RandomHorizontalFlip': {'p': 0.8}}, {'Normalize': {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}}, {'RandomHorizontalFlip': {'p': 0.8}}, {'Normalize': {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}}]\n\nPre-Composed Val Transforms\n[{'RandomHorizontalFlip': {'p': 0.8}}, {'Normalize': {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}}, {'RandomHorizontalFlip': {'p': 0.8}}, {'Normalize': {'mean': [0.485, 0.456, 0.406], 'std': [0.229, 0.224, 0.225]}}]\n\nDataset Numbers\n Num train images: 4829\n Num val images: 2070\n Num classes: 8\n\nModel Params\n Model name: resnet18_v1\n Use Gpu: True\n Use pretrained: True\n Freeze base network: False\n\nModel Details\n Loading pretrained model\n Model Loaded on device\n Model name: resnet18_v1\n Num of potentially trainable layers: 41\n Num of actual trainable layers: 41\n\nOptimizer\n Name: sgd\n Learning rate: 0.01\n Params: {'lr': 0.01, 'momentum': 0, 'weight_decay': 0, 'momentum_dampening_rate': 0, 'clipnorm': 0.0, 'clipvalue': 0.0}\n\n\n\nLearning rate scheduler\n Name: steplr\n Params: {'step_size': 1, 'gamma': 0.98, 'last_epoch': -1}\n\nLoss\n Name: softmaxcrossentropy\n Params: {'weight': None, 'batch_axis': 0, 'axis_to_sum_over': -1, 'label_as_categories': True, 'label_smoothing': False}\n\nTraining params\n Num Epochs: 5\n\nDisplay params\n Display progress: True\n Display progress realtime: True\n Save Training logs: True\n Save Intermediate models: True\n Intermediate model prefix: intermediate_model_\n\n"
]
],
[
[
"## From the summary above\n\n - Model Params\n Model name: resnet18\n Num of potentially trainable layers: 41\n Num of actual trainable layers: 41",
"_____no_output_____"
],
[
"<a id='2'></a>\n# Visualize resnet",
"_____no_output_____"
]
],
[
[
"gtf.Visualize_With_Netron(data_shape=(3, 224, 224), port=8082);",
"Using Netron To Visualize\nNot compatible on kaggle\nCompatible only for Jupyter Notebooks\nServing 'model-symbol.json' at http://localhost:8082\n"
]
],
[
[
"## resnet block - 1\n \n - Creating network and blocks using monk from scratch will be dealt in different roadmap series",
"_____no_output_____"
]
],
[
[
"from IPython.display import Image\nImage(filename='imgs/resnet18_v1_block1_mxnet.png') ",
"_____no_output_____"
]
],
[
[
"## Properties\n\n - This block has 2 branches\n - First branch is the identity branch, it takes the input and pushes it as the output, the Residual\n - Second branch has these layers\n - conv_3x3 -> batchnorm -> relu -> conv_3x3 -> batchnorm\n \n - The branches are added elementwise, so both the branches need to have same sized output\n \n - The final layer to this block is relu",
"_____no_output_____"
],
[
"## resnet block - 2\n \n - Creating network and blocks using monk from scratch will be dealt in different roadmap series",
"_____no_output_____"
]
],
[
[
"from IPython.display import Image\nImage(filename='imgs/resnet18_v1_block2_mxnet.png') ",
"_____no_output_____"
]
],
[
[
"## Properties\n\n - This block has 2 branches\n - First branch has these layers\n - conv_1x1 ->batchnorm\n - Second branch has these layers\n - conv_3x3 -> batchnorm -> relu -> conv_3x3 -> batchnorm\n \n - The branches are added elementwise, so both the branches need to have same sized output\n \n - The final layer to this block is relu",
"_____no_output_____"
],
[
"## resnet fully connected chain",
"_____no_output_____"
]
],
[
[
"from IPython.display import Image\nImage(filename='imgs/resnet18_v1_block_fc_mxnet.png') ",
"_____no_output_____"
]
],
[
[
"## resnet Network\n\n - Creating network and blocks using monk from scratch will be dealt in different roadmap series",
"_____no_output_____"
]
],
[
[
"from IPython.display import Image\nImage(filename='imgs/resnet18_v1_mxnet.png') ",
"_____no_output_____"
]
],
[
[
"## Properties\n\n - This network \n - has 5 type-1 blocks\n - has 3 type-2 blocks\n - post these blocks the type-3 (fc) block exists\n",
"_____no_output_____"
],
[
"<a id='3'></a>\n# Train the classifier",
"_____no_output_____"
]
],
[
[
"#Start Training\ngtf.Train();\n\n#Read the training summary generated once you run the cell and training is completed",
"Training Start\n Epoch 1/5\n ----------\n"
]
],
[
[
"<a id='4'></a>\n# Run inference on trained classifier",
"_____no_output_____"
]
],
[
[
"gtf = prototype(verbose=1);\ngtf.Prototype(\"Project\", \"resnet-intro\", eval_infer=True);",
"Mxnet Version: 1.5.0\n\nModel Details\n Loading model - workspace/Project/resnet-intro/output/models/final-symbol.json\n Model loaded!\n\nExperiment Details\n Project: Project\n Experiment: resnet-intro\n Dir: /home/abhi/Desktop/Work/tess_tool/gui/v0.3/finetune_models/Organization/development/v5.0_blocks/study_roadmap/change_post_num_layers/6_transfer_learning_model_params/1_exploring_model_families/3_resnet/workspace/Project/resnet-intro/\n\n"
],
[
"output = gtf.Infer(img_name = \"natural-images/test/test1.jpg\");\nfrom IPython.display import Image\nImage(filename='natural-images/test/test1.jpg') ",
"Prediction\n Image name: natural-images/test/test1.jpg\n Predicted class: airplane\n Predicted score: 13.71891975402832\n\n"
],
[
"output = gtf.Infer(img_name = \"natural-images/test/test2.jpg\");\nfrom IPython.display import Image\nImage(filename='natural-images/test/test2.jpg') ",
"Prediction\n Image name: natural-images/test/test2.jpg\n Predicted class: cat\n Predicted score: 12.55334758758545\n\n"
],
[
"output = gtf.Infer(img_name = \"natural-images/test/test3.jpg\");\nfrom IPython.display import Image\nImage(filename='natural-images/test/test3.jpg') ",
"Prediction\n Image name: natural-images/test/test3.jpg\n Predicted class: fruit\n Predicted score: 16.153820037841797\n\n"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
]
]
|
cb6cc41e3a90d19a10ef84e80ebe2c6dc6f000ea | 12,992 | ipynb | Jupyter Notebook | Speech Identity Inference.ipynb | douglas125/SpeechIdentity | d967b8c7abb8fc5419545cdbbb92bf5ddd7273db | [
"MIT"
]
| 2 | 2021-08-13T03:39:27.000Z | 2022-01-24T17:55:09.000Z | Speech Identity Inference.ipynb | douglas125/SpeechIdentity | d967b8c7abb8fc5419545cdbbb92bf5ddd7273db | [
"MIT"
]
| null | null | null | Speech Identity Inference.ipynb | douglas125/SpeechIdentity | d967b8c7abb8fc5419545cdbbb92bf5ddd7273db | [
"MIT"
]
| 2 | 2022-01-26T04:36:44.000Z | 2022-03-19T20:37:25.000Z | 26.193548 | 186 | 0.541641 | [
[
[
"# Speech Identity Inference\n\nLet's check if the pretrained model can really identify speakers.",
"_____no_output_____"
]
],
[
[
"import os\nimport numpy as np\nimport pandas as pd\nfrom sklearn import metrics\n\nfrom tqdm.notebook import tqdm\nfrom IPython.display import Audio\nfrom matplotlib import pyplot as plt\n%matplotlib inline\n\nimport tensorflow as tf\nimport tensorflow_io as tfio\nimport tensorflow_addons as tfa\n\nfrom train_speech_id_model import BaseSpeechEmbeddingModel\nfrom create_audio_tfrecords import AudioTarReader, PersonIdAudio\n\nsr = 48000",
"_____no_output_____"
],
[
"m = BaseSpeechEmbeddingModel()\nm.summary()",
"_____no_output_____"
],
[
"# 90.cpkt: auc = 0.9525\n# 110.cpkt: auc = 0.9533\nchkpt = 'temp/cp-0110.ckpt'\nm.load_weights(chkpt)\nm.compile(\n optimizer=tf.keras.optimizers.Adam(0.0006),\n loss=tfa.losses.TripletSemiHardLoss()\n)\n# m.save('speech-id-model-110')",
"_____no_output_____"
],
[
"# changing the corpus to other languages allows evaluating how the model transfers between languages\ndev_dataset = tfrecords_audio_dataset = tf.data.TFRecordDataset(\n 'data/cv-corpus-7.0-2021-07-21-en.tar.gz_dev.tfrecords.gzip', compression_type='GZIP',\n# 'data/cv-corpus-7.0-2021-07-21-en.tar.gz_test.tfrecords.gzip', compression_type='GZIP',\n num_parallel_reads=4\n).map(PersonIdAudio.deserialize_from_tfrecords)",
"_____no_output_____"
],
[
"samples = [x for x in dev_dataset.take(2500)]\n# decode audio\nsamples = [(tfio.audio.decode_mp3(x[0])[:, 0], x[1]) for x in samples]",
"_____no_output_____"
],
[
"# is the audio decoded correctly?\nAudio(samples[10][0], rate=sr)",
"_____no_output_____"
],
[
"# compute the embeddings\nembeddings = []\nfor audio_data, person_id in tqdm(samples):\n cur_emb = m.predict(\n tf.expand_dims(audio_data, axis=0)\n )[0]\n embeddings.append(cur_emb)",
"_____no_output_____"
]
],
[
[
"## Check embedding quality\n\nIdeally, embeddings from the same person should look the same.",
"_____no_output_____"
]
],
[
[
"n_speakers = len(set([x[1].numpy() for x in samples]))\nprint(f'Loaded {n_speakers} different speakers')",
"_____no_output_____"
],
[
"pairwise_diff = {'same': [], 'different': []}\nfor p in tqdm(range(len(samples))):\n for q in range(p + 1, len(samples)):\n id_1 = samples[p][1]\n id_2 = samples[q][1]\n dist = np.linalg.norm(embeddings[p] - embeddings[q])\n if id_1 == id_2:\n pairwise_diff['same'].append(dist)\n else:\n pairwise_diff['different'].append(dist)",
"_____no_output_____"
],
[
"plt.figure(figsize=(12, 8))\nplt.boxplot([pairwise_diff[x] for x in pairwise_diff])\nplt.xticks([k + 1 for k in range(len(pairwise_diff))], [x for x in pairwise_diff])\nplt.ylabel('Embedding distance')\nplt.title('Boxplot of speaker identifiability')",
"_____no_output_____"
],
[
"# what do we care about?\n# given that 2 samples are different, we don't want to predict `same`\n# secondarily, given that 2 samples are the same, we want to predict `same`\n\n# threshold - alpha from 0 (median of same) to 1 (median of different)\nalpha = 0.2\n\n# if using the validation set, we can calibrate t\nt = np.median(pairwise_diff['same']) + alpha * (np.median(pairwise_diff['different']) - np.median(pairwise_diff['same']))\n\nspecificity = np.sum(np.array(pairwise_diff['different']) > t) / len(pairwise_diff['different'])\nsensitivity = np.sum(np.array(pairwise_diff['same']) < t) / len(pairwise_diff['same'])\n\nprint('Sensitivity, specificity = ', sensitivity, specificity)\n\nsame_lbl = [0] * len(pairwise_diff['same'])\ndiff_lbl = [1] * len(pairwise_diff['different'])\nscores = pairwise_diff['same'] + pairwise_diff['different']\n\n# scale scores to range [0,1] and chande threshold accordingly\nscores = np.array(scores) * 0.5\nt = t * 0.5\n\nlabels = same_lbl + diff_lbl\nlen(scores), len(labels)",
"_____no_output_____"
],
[
"fpr, tpr, thresholds = metrics.roc_curve(labels, scores, pos_label=1)",
"_____no_output_____"
],
[
"plt.figure(figsize=(12, 8))\nroc_auc = metrics.roc_auc_score(labels, scores)\n\nplt.title(f'ROC curve: AUC = {np.round(roc_auc, 4)} {chkpt}')\nplt.xlabel('False Positive Rate')\nplt.ylabel('True Positive Rate')\n\nplt.plot(fpr, tpr)\nplt.plot([0, 1], [0, 1])",
"_____no_output_____"
],
[
"plt.figure(figsize=(12, 8))\nplt.title('Point of operation')\nplt.plot(thresholds, 1 - fpr, label='Specificity')\nplt.plot(thresholds, tpr, label='Sensitivity')\nplt.plot([t, t], [0, 1], label='Threshold')\nplt.xlabel('Threshold level')\nplt.xlim([0, 1])\nplt.legend()",
"_____no_output_____"
]
],
[
[
"## Select best model on validation\n\nStrategy: compute loss but don't sort validation set, so there are multiple voice repeats in a batch. Also makes the evaluation consistent. Batch size should be as big as possible.",
"_____no_output_____"
]
],
[
[
"triplet_loss = tfa.losses.TripletSemiHardLoss()",
"_____no_output_____"
],
[
"# compute all predictions\ndef mp3_decode_fn(audio_bytes, audio_class):\n audio_data = tfio.audio.decode_mp3(audio_bytes)[:, 0]\n return audio_data, audio_class",
"_____no_output_____"
],
[
"all_preds = []\nall_labels = []\nfor x in tqdm(dev_dataset.take(1300).map(mp3_decode_fn)):\n s = x[0]\n all_preds.append(m.predict(\n tf.expand_dims(x[0], axis=0)\n )[0])\n all_labels.append(x[1].numpy())",
"_____no_output_____"
],
[
"len(all_preds)",
"_____no_output_____"
],
[
"batch_size = 128\nn_batches = len(all_preds) // batch_size\nvec_size = len(all_preds[0])\n\nnp_preds = np.reshape(all_preds[0:batch_size * n_batches], (n_batches, batch_size, vec_size))\nnp_labls = np.reshape(all_labels[0:batch_size * n_batches], (n_batches, batch_size))",
"_____no_output_____"
],
[
"total_loss = 0\nfor lbl, pred in zip(np_labls, np_preds):\n total_loss += triplet_loss(lbl, pred).numpy()\ntotal_loss = total_loss / len(lbl)\nprint(f'Total loss: {total_loss}')",
"_____no_output_____"
],
[
"all_checkpoints = [x.split('.')[0] + '.ckpt' for x in os.listdir('temp') if 'ckpt.index' in x]\nall_results = []\nfor checkpoint in tqdm(all_checkpoints):\n m.load_weights(os.path.join('temp', checkpoint))\n\n all_preds = []\n all_labels = []\n n_items = 4600\n for x in tqdm(dev_dataset.take(n_items).map(mp3_decode_fn),\n total=n_items, leave=False):\n # for x in tqdm(dev_dataset.map(mp3_decode_fn),\n # leave=False):\n s = x[0]\n all_preds.append(m.predict(\n tf.expand_dims(x[0], axis=0)\n )[0])\n all_labels.append(x[1].numpy())\n\n batch_size = 128\n n_batches = len(all_preds) // batch_size\n vec_size = len(all_preds[0])\n\n np_preds = np.reshape(all_preds[0:batch_size * n_batches], (n_batches, batch_size, vec_size))\n np_labls = np.reshape(all_labels[0:batch_size * n_batches], (n_batches, batch_size))\n\n total_loss = 0\n for lbl, pred in zip(np_labls, np_preds):\n total_loss += triplet_loss(lbl, pred).numpy()\n total_loss = total_loss / len(lbl)\n cur_result = {\n 'checkpoint': checkpoint,\n 'val_loss': total_loss\n }\n print(cur_result)\n all_results.append(cur_result)",
"_____no_output_____"
],
[
"df_val = pd.DataFrame(all_results)\ndf_val['idx'] = df_val.checkpoint.apply(lambda z: int(z.split('.')[0].split('-')[1]))\ndf_val = df_val.set_index('idx')",
"_____no_output_____"
],
[
"df_val.to_csv('val_triplet_loss.csv')",
"_____no_output_____"
],
[
"# df_val",
"_____no_output_____"
],
[
"df_val.plot()",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6ccf14b14646ad9a8b3436b6777e8343dff6e3 | 60,608 | ipynb | Jupyter Notebook | Projects/CS_VQE/jupyter_notebooks/CS-VQE notes.ipynb | AlexisRalli/VQE-code | 4112d2bba4c327360e95dfd7cb6120b2ce67bf29 | [
"MIT"
]
| 1 | 2021-04-01T14:01:46.000Z | 2021-04-01T14:01:46.000Z | Projects/CS_VQE/jupyter_notebooks/CS-VQE notes.ipynb | AlexisRalli/VQE-code | 4112d2bba4c327360e95dfd7cb6120b2ce67bf29 | [
"MIT"
]
| 5 | 2019-11-13T16:23:54.000Z | 2021-04-07T11:03:06.000Z | Projects/CS_VQE/jupyter_notebooks/CS-VQE notes.ipynb | AlexisRalli/VQE-code | 4112d2bba4c327360e95dfd7cb6120b2ce67bf29 | [
"MIT"
]
| null | null | null | 28.792399 | 1,343 | 0.508794 | [
[
[
"import numpy as np\nimport cs_vqe as c\nimport ast\nimport os\n\nfrom openfermion import qubit_operator_sparse\nimport conversion_scripts as conv_scr\nimport scipy as sp",
"_____no_output_____"
],
[
"from openfermion import qubit_operator_sparse\nimport conversion_scripts as conv_scr\nfrom openfermion.ops import QubitOperator",
"_____no_output_____"
],
[
"# with open(\"hamiltonians.txt\", 'r') as input_file:\n# hamiltonians = ast.literal_eval(input_file.read())\n \nworking_dir = os.getcwd()\ndata_dir = os.path.join(working_dir, 'data')\ndata_hamiltonians_file = os.path.join(data_dir, 'hamiltonians.txt')\n\n\nwith open(data_hamiltonians_file, 'r') as input_file:\n hamiltonians = ast.literal_eval(input_file.read())",
"_____no_output_____"
],
[
"for key in hamiltonians.keys():\n print(f\"{key: <25} n_qubits: {hamiltonians[key][1]:<5.0f}\")",
"H2-S1_STO-3G_singlet n_qubits: 18 \nC1-O1_STO-3G_singlet n_qubits: 16 \nH1-Cl1_STO-3G_singlet n_qubits: 16 \nH1-Na1_STO-3G_singlet n_qubits: 16 \nH2-Mg1_STO-3G_singlet n_qubits: 17 \nH1-F1_3-21G_singlet n_qubits: 18 \nH1-Li1_3-21G_singlet n_qubits: 18 \nBe1_STO-3G_singlet n_qubits: 5 \nH1-F1_STO-3G_singlet n_qubits: 8 \nH1-Li1_STO-3G_singlet n_qubits: 8 \nAr1_STO-3G_singlet n_qubits: 13 \nF2_STO-3G_singlet n_qubits: 15 \nH1-O1_STO-3G_singlet n_qubits: 8 \nH2-Be1_STO-3G_singlet n_qubits: 9 \nH2-O1_STO-3G_singlet n_qubits: 10 \nH2_3-21G_singlet n_qubits: 5 \nH2_6-31G_singlet n_qubits: 5 \nH3-N1_STO-3G_singlet n_qubits: 13 \nH4-C1_STO-3G_singlet n_qubits: 14 \nMg1_STO-3G_singlet n_qubits: 13 \nN2_STO-3G_singlet n_qubits: 15 \nNe1_STO-3G_singlet n_qubits: 5 \nO2_STO-3G_singlet n_qubits: 15 \nH1-Li1-O1_STO-3G_singlet n_qubits: 18 \nH1-He1_STO-3G_singlet n_qubits: 2 \nH3_STO-3G_singlet_1+ n_qubits: 3 \nH1-He1_3-21G_singlet_1+ n_qubits: 6 \nH3_3-21G_singlet_1+ n_qubits: 9 \nH4-N1_STO-3G_singlet_1+ n_qubits: 14 \n"
],
[
"mol_key = 'H2_6-31G_singlet' \n# mol_key ='H2-O1_STO-3G_singlet'\n\n\n# currently index 2 is contextual part\n# ''''''''''''''''3 is NON contextual part\n\n# join together for full Hamiltonian:\nham = hamiltonians[mol_key][2]\nham.update(hamiltonians[mol_key][3]) # full H \nham",
"_____no_output_____"
],
[
"print(f\"n_qubits: {hamiltonians[mol_key][1]}\")",
"n_qubits: 5\n"
]
],
[
[
"# Get non-contextual H",
"_____no_output_____"
]
],
[
[
"nonH_guesses = c.greedy_dfs(ham, 10, criterion='weight')\n\nnonH = max(nonH_guesses, key=lambda x:len(x)) # largest nonCon part found by dfs alg",
"_____no_output_____"
]
],
[
[
"Split into:\n\n$$H = H_{c} + H_{nc}$$",
"_____no_output_____"
]
],
[
[
"nonCon_H = {}\nCon_H = {}\n\nfor P in ham:\n if P in nonH:\n nonCon_H[P]=ham[P]\n else:\n Con_H[P]=ham[P]\n ",
"_____no_output_____"
]
],
[
[
"## Testing contextuality",
"_____no_output_____"
]
],
[
[
"print('Is NONcontextual correct:', not c.contextualQ_ham(nonCon_H))\nprint('Is contextual correct:',c.contextualQ_ham(Con_H))",
"Is NONcontextual correct: True\nIs contextual correct: True\n"
]
],
[
[
"# Classical part of problem!",
"_____no_output_____"
],
[
"Take $H_{nc}$ and split into:\n- $Z$ = operators that completely comute with all operators in $S$\n- $T$ = remaining operators in $S$\n - where $S = Z \\cup T$ and $S$ is set of Pauli operators in $H_{nc}$\n \n \n- We then split the set $T$ into cliques $C_{1}, C_{2}, ... , C_{|T|}$\n - all ops in a clique commute\n - ops between cliques anti-commute!",
"_____no_output_____"
]
],
[
[
"bool_flag, Z_list, T_list = c.contextualQ(list(nonCon_H.keys()), verbose=True)",
"_____no_output_____"
],
[
"Z_list",
"_____no_output_____"
],
[
"T_list",
"_____no_output_____"
]
],
[
[
"## Get quasi model\n\nFirst we define\n\n- $C_{i1}$ = first Pauli in each $C_{i}$ set\n- $A_{ij} = C_{ij}C_{1i}$\n\n\n- $G^{prime} = \\{1 P_{i} \\;| \\; i=1,2,...,|Z| \\}$\n - aka all the completely commuting terms with coefficients set to +1!\n\n- We define G to be an independent set of $G^{prime}$\n - where $G \\subseteq G^{prime}$\n",
"_____no_output_____"
]
],
[
[
"G_list, Ci1_list, all_mappings = c.quasi_model(nonCon_H)",
"_____no_output_____"
],
[
"print('non-independent Z list:', Z_list)\nprint('G (independent) Z list:', G_list)",
"non-independent Z list: ['IIIII', 'IIIIZ', 'IIZII', 'IIZIZ', 'IZIII', 'IZIIZ', 'IZZII', 'ZIIII', 'ZIIIZ', 'ZIZII', 'ZZIII', 'ZZIIZ', 'ZZZII', 'ZZZIZ']\nG (independent) Z list: ['ZIIII', 'IZIII', 'IIZII', 'IIIIZ']\n"
],
[
"print('all Ci1 terms:', Ci1_list)",
"all Ci1 terms: ['IIIZI', 'IIZXZ']\n"
]
],
[
[
"$$R = G \\cup \\{ C_{i1} \\;| \\; i=1,2,...,N \\}$$",
"_____no_output_____"
]
],
[
[
"# Assemble all the mappings from terms in the Hamiltonian to their products in R:\nall_mappings",
"_____no_output_____"
]
],
[
[
"Overall $R$ is basically reduced non-contextual set\n- where everything in original non-contextual set can be found by **inference!**",
"_____no_output_____"
],
[
"# Function form\n\n$$R = G \\cup \\{ C_{i1} \\;| \\; i=1,2,...,N \\}$$\n\n- note q to do with $G$\n- note r to do with $C_{i1}$",
"_____no_output_____"
]
],
[
[
"model = [G_list, Ci1_list, all_mappings]\n\nfn_form = c.energy_function_form(nonCon_H, model)\n\n# returns [\n# denstion of q,\n# dimension of r,\n# [coeff, indices of q's, indices of r's, term in Hamiltonian]\n# ]\n",
"_____no_output_____"
],
[
"fn_form",
"_____no_output_____"
],
[
"Energy_function = c.energy_function(fn_form)",
"_____no_output_____"
],
[
"import random\n\n### now for the q terms we only have +1 or -1 assignment!\nq_variables = [random.choice([1,-1]) for _ in range(fn_form[0])]\n\n\n### r variables is anything that makes up unit vector!\nr_variables = c.angular(np.arange(0,2*np.pi, fn_form[1]))\nr_variables",
"_____no_output_____"
],
[
" Energy_function(*q_variables,*r_variables)",
"_____no_output_____"
]
],
[
[
"find_gs_nonconfunction optimizes above steps by:\n1. brute forcing all choices of ```q_variables```\n - ```itertools.product([1,-1],repeat=fn_form[0])```\n2. optimizing over ```r_variables``` (in code ```x```)\n - using SciPy optimizer!",
"_____no_output_____"
]
],
[
[
"model = [G_list, Ci1_list, all_mappings]\n\nlowest_eigenvalue, ground_state_params, model_copy, fn_form_copy, = c.find_gs_noncon(nonCon_H,\n method = 'differential_evolution',\n model=model,\n fn_form=fn_form) # returns: best + [model, fn_form]\n\nprint(lowest_eigenvalue)\nprint(ground_state_params)",
"-1.8517678403392313\n[[1, 1, 1, -1], [-1.0, -4.388077644981462e-11]]\n"
],
[
"## check\nEnergy_function(*ground_state_params[0],*ground_state_params[1]) == lowest_eigenvalue",
"_____no_output_____"
]
],
[
[
"# Now need to rotate Hamiltonian!",
"_____no_output_____"
],
[
"We now have non contextual ground state: $(\\vec{q}, \\vec{r})$",
"_____no_output_____"
]
],
[
[
"ground_state_params",
"_____no_output_____"
]
],
[
[
"We can use this result - ground state of $H_{nc}$ - as a classical estiamte of our ground state of the full Hamiltonian ($H = H_{c} + H_{nc}$)\n\nHowever we can also obtain a quantum correction using $H_{c}$\n\nBy minimizing theenergy of the remaining terms in the Hamiltonian over the quantum states that are **consistent with the noncon-textual ground state**.",
"_____no_output_____"
],
[
"To do this we first rotate each $G_{j}$ and $\\mathcal{A} = \\sum_{i=1}^{N} r_{i}A_{i}$:",
"_____no_output_____"
]
],
[
[
"model = [G_list, Ci1_list, all_mappings]\n\nprint(G_list) # G_j terms!\nprint(Ci1_list) # mathcal(A)",
"['ZIIII', 'IZIII', 'IIZII', 'IIIIZ']\n['IIIZI', 'IIZXZ']\n"
]
],
[
[
"to SINGLE QUBIT pauli Z operators!\n\n- to map the operators in $G$ to single qubit Pauli operators, we use $\\frac{\\pi}{2}$ rotations!\n\n- note $\\mathcal{A}$ is an anti-commuting set... therefore we can use $N-1$ rotations as in unitary partitioning's sequence of rotations to do this!\n - $R^{\\dagger}\\mathcal{A} R = \\text{single Pauli op}$",
"_____no_output_____"
],
[
"# Rotate full Hamiltonian to basis with diagonal noncontextual generators!",
"_____no_output_____"
],
[
"function ```diagonalize_epistemic```:\n1. first if else statement:\n - if cliques present:\n - first maps A to single Pauli operator (if cliques present)\n - then rotates to diagonlize G union with single Pauli opator of A (hence GuA name!)\n - else if NO cliques present:\n - gets rotations to diagonlize G\n \n - these rotations make up GuA term in code!\n2. NEXT code loops over terms in GuA (denoted as g in code)\n - if g is not a single qubit $Z$:\n - code generates code to rotate operator to make g diagonal (rotations)\n - then constructs map of g to single Z (J rotation)\n - Note R is applied to GuA\n \n \n#########\n- Note rotations are given in Appendix A of https://arxiv.org/pdf/2011.10027.pdf\n - First code checks if g op in GuA is diagonal\n - if so then needs to apply \"K\" rotation (involving $Y$ and $I$ operators (see pg 11 top) to make it NOT diagononal\n - now operator will be diagnoal!\n - next generate \"J\" rotation\n - turns non-diagonal operator into a single qubit $Z$ operator!",
"_____no_output_____"
]
],
[
[
"# Get sequence of rotations requried to diagonalize the generators for the noncontextual ground state!\n\nRotations_list, diagonalized_generators_GuA, eigen_vals_nonC_ground_state_GuA_ops = c.diagonalize_epistemic(model,\n fn_form,\n ground_state_params)",
"_____no_output_____"
],
[
"# rotations to map A to single Pauli operator!\nRotations_list",
"_____no_output_____"
],
[
"# rotations to diagonlize G\ndiagonalized_generators_GuA",
"_____no_output_____"
],
[
"eigen_vals_nonC_ground_state_GuA_ops",
"_____no_output_____"
]
],
[
[
"# NEW LCU method",
"_____no_output_____"
]
],
[
[
"N_index=0\ncheck_reduction=True\nN_Qubits= hamiltonians[mol_key][1]\nR_LCU, Rotations_list, diagonalized_generators_GuA, eigen_vals_nonC_ground_state_GuA_ops= c.diagonalize_epistemic_LCU(\n model,\n fn_form,\n ground_state_params,\n N_Qubits,\n N_index,\n check_reduction=check_reduction)",
"_____no_output_____"
],
[
"R_LCU",
"_____no_output_____"
],
[
"order = list(range(hamiltonians[mol_key][1]))\nN_index=0\ncheck_reduction=True\nN_Qubits= hamiltonians[mol_key][1]\n\nreduced_H = c.get_reduced_hamiltonians_LCU(Con_H,\n model,\n fn_form,\n ground_state_params,\n order, \n N_Qubits,\n N_index, \n check_reduction=check_reduction)",
"_____no_output_____"
],
[
"len(reduced_H[-1])",
"_____no_output_____"
],
[
"reduced_H[3]",
"_____no_output_____"
],
[
"H = conv_scr.Get_Openfermion_Hamiltonian(reduced_H[-1])\nsparseH = qubit_operator_sparse(H, n_qubits=hamiltonians[mol_key][1])\nsp.sparse.linalg.eigsh(sparseH, which='SA', k=1)[0][0]",
"_____no_output_____"
],
[
"## old way\n# Get sequence of rotations requried to diagonalize the generators for the noncontextual ground state!\n\nRotations_list, diagonalized_generators_GuA, eigen_vals_nonC_ground_state_GuA_ops = c.diagonalize_epistemic(model,\n fn_form,\n ground_state_params)\nlen(diagonalized_generators_GuA)\nRotations_list",
"_____no_output_____"
],
[
"### old way\norder = list(range(hamiltonians[mol_key][1]))\nred_H = c.get_reduced_hamiltonians(ham,\n model,\n fn_form,\n ground_state_params,\n order)\nlen(red_H[0])",
"_____no_output_____"
],
[
"len(red_H[0])\nred_H[0]",
"_____no_output_____"
],
[
"H = conv_scr.Get_Openfermion_Hamiltonian(red_H[-1])\nsparseH = qubit_operator_sparse(H, n_qubits=hamiltonians[mol_key][1])\nsp.sparse.linalg.eigsh(sparseH, which='SA', k=1)[0][0]",
"_____no_output_____"
],
[
"from scipy.sparse.linalg import expm\nfrom Misc_functions import sparse_allclose\n\nR_LCU_QubitOp = QubitOperator()\nfor P in R_LCU: R_LCU_QubitOp+=P\nR_LCU_mat = qubit_operator_sparse(R_LCU_QubitOp, n_qubits=hamiltonians[mol_key][1])\n\n\n\nR_SeqRot_QubitOp= conv_scr.convert_op_str(Rotations_list[0][1], 1)\nR_SeqRot_mat = qubit_operator_sparse(R_SeqRot_QubitOp, n_qubits=hamiltonians[mol_key][1])\n\ntheta_sk=Rotations_list[0][0]\nexp_rot = expm(R_SeqRot_mat * theta_sk)# / 2)\n\nsparse_allclose(exp_rot, R_LCU_mat)",
"_____no_output_____"
]
],
[
[
"# Restricting the Hamiltonian to a contextualsubspace",
"_____no_output_____"
],
[
"(Section B of https://arxiv.org/pdf/2011.10027.pdf)\n\nIn the rotated basis the Hamiltonian is restricted to the subspace stabilized by the noncontextual generators $G_{j}'$",
"_____no_output_____"
]
],
[
[
"print(diagonalized_generators_GuA) # G_j' terms!",
"_____no_output_____"
]
],
[
[
"The quantum correction is then obtained by minimizing the expectation value of this resticted Hamiltonian!\n\n(over +1 eigenvectors of the remaining non-contextual generators $\\mathcal{A}'$)",
"_____no_output_____"
]
],
[
[
"print(Ci1_list) # mathcal(A)",
"_____no_output_____"
]
],
[
[
"- $\\mathcal{H}_{1}$ denotes Hilbert space of $n_{1}$ qubits acted on by by the single qubit $G_{j}'$ terms\n- $\\mathcal{H}_{2}$ denotes Hilbert space of remaining $n_{2}$\n\nOverall full Hilbert space is: $\\mathcal{H}=\\mathcal{H}_{1} \\otimes \\mathcal{H}_{2}$\n\nThe **contextual Hamiltonian** in this rotated basis is:\n\n$$H_{c}'=\\sum_{P \\in \\mathcal{S_{c}'}} h_{P}P$$\n\nThe set of Pauli terms in $H_{c}'$ is $\\mathcal{S_{c}'}$, where terms in $\\mathcal{S_{c}'}$ act on both $\\mathcal{H}_{1}$ and $\\mathcal{H}_{2}$ subspaces in general!\n\nWe can write $P$ terms as:\n\n$$P=P_{1}^{\\mathcal{H}_{1}} \\otimes P_{2}^{\\mathcal{H}_{2}}$$\n\n$P$ commutes with an element of $G'$ if and only if $P_{1} \\otimes \\mathcal{I}^{\\mathcal{H}_{2}}$ does\n\nAs the generators $G'$ act only on $\\mathcal{H}_{1}$",
"_____no_output_____"
],
[
"If $P$ anticommutes with any element of $G'$ then its expection value in the noncontextual state is zero\n\nThus any $P$ must commute with all elements of $G'$ and so $P_{1} \\otimes \\mathcal{I}^{\\mathcal{H}_{2}}$ too\n\nAs the elements of $G'$ are single-qubit Pauli $Z$ operators acting in $\\mathcal{H}_{1}$:",
"_____no_output_____"
]
],
[
[
"print(diagonalized_generators_GuA) # G_j' terms!",
"_____no_output_____"
]
],
[
[
"$P_{1}$ must be a product of such operators!\n\n**As the exepcation value of $P_{1}$ is some $p_{1}= \\pm 1$ DETERMINED BY THE NONCONTEXTUAL GROUND STATE**",
"_____no_output_____"
]
],
[
[
"eigen_vals_nonC_ground_state_GuA_ops",
"_____no_output_____"
]
],
[
[
"Let $|\\psi_{(\\vec{q}, \\vec{r})} \\rangle$ be any quantum state consistent with the nonconxtual ground state $(\\vec{q}, \\vec{r})$... aka gives correct expection values of:",
"_____no_output_____"
]
],
[
[
"print(diagonalized_generators_GuA)\nprint(eigen_vals_nonC_ground_state_GuA_ops)",
"_____no_output_____"
]
],
[
[
"Then the action of any $P$ which allows our contextual correction has the form:\n\n$$P |\\psi_{(\\vec{q}, \\vec{r})} \\rangle = \\big( P_{1}^{\\mathcal{H}_{1}} \\otimes P_{2}^{\\mathcal{H}_{2}} \\big) |\\psi_{(\\vec{q}, \\vec{r})} \\rangle$$\n\n$$ = p_{1}\\big( \\mathcal{I}^{\\mathcal{H}_{1}} \\otimes P_{2}^{\\mathcal{H}_{2}} \\big) |\\psi_{(\\vec{q}, \\vec{r})} \\rangle$$\n\n- repeating above, but $p_{1}$ is the expectation value of $P_{1}$ determiend by the noncontextual ground state!",
"_____no_output_____"
],
[
"Thus we can denote $H_{c}' |_{(\\vec{q}, \\vec{r})}$ as the restriction of $H_{c}'$ on its action on the noncontextual ground state $(\\vec{q}, \\vec{r})$:\n\n$$H_{c}' |_{(\\vec{q}, \\vec{r})} =\\sum_{\\substack{P \\in \\mathcal{S_{c}'} \\\\ \\text{s.t.} [P, G_{i}']=0 \\\\ \\forall G'_{i} \\in G'}} p_{1}h_{P}\\big( \\mathcal{I}^{\\mathcal{H}_{1}} \\otimes P_{2}^{\\mathcal{H}_{2}} \\big) $$\n\n$$=\\mathcal{I}_{\\mathcal{H}_{1}} \\otimes H_{c}'|_{\\mathcal{H}_{2}} $$\n\n\nwhere we can write:\n$$H_{c}'|_{\\mathcal{H}_{2}} = \\sum_{\\substack{P \\in \\mathcal{S_{c}'} \\\\ \\text{s.t.} [P, G_{i}']=0 \\\\ \\forall G'_{i} \\in G'}} p_{1}h_{P}P_{2}^{\\mathcal{H}_{2}}$$\n\n\n\nCleary this Hamiltonian on $n_{2}$ qubits is given by:\n\n$$n_{2} = n - |G|$$\n\n- $|G|=$ number of noncontextual generators $G_{j}$",
"_____no_output_____"
]
],
[
[
"from copy import deepcopy\nimport pprint ",
"_____no_output_____"
]
],
[
[
"```quantum_correction``` function",
"_____no_output_____"
]
],
[
[
"n_q = len(diagonalized_generators_GuA[0])\n\nrotated_H = deepcopy(ham) ##<-- full Hamiltonian\n\n# iteratively perform R rotation over all terms in orginal Hamiltonian\nfor R in Rotations_list:\n newly_rotated_H={}\n for P in rotated_H.keys():\n lin_comb_Rot_P = c.apply_rotation(R,P) # linear combination of Paulis from R rotation on P\n \n for P_rot in lin_comb_Rot_P:\n \n if P_rot in newly_rotated_H.keys():\n newly_rotated_H[P_rot]+=lin_comb_Rot_P[P_rot]*rotated_H[P] # already in it hence +=\n else:\n newly_rotated_H[P_rot]=lin_comb_Rot_P[P_rot]*rotated_H[P]\n \n rotated_H = deepcopy(newly_rotated_H) ##<-- perform next R rotation on this H\n \nrotated_H ",
"_____no_output_____"
]
],
[
[
"next find where Z indices in $G'$",
"_____no_output_____"
]
],
[
[
"z_indices = []\nfor d in diagonalized_generators_GuA:\n for i in range(n_q):\n if d[i] == 'Z':\n z_indices.append(i)\n \nprint(diagonalized_generators_GuA)\nprint(z_indices)",
"_____no_output_____"
]
],
[
[
"**The exepcation value of $P_{1}$ terms are $p_{1}= \\pm 1$ DETERMINED BY THE NONCONTEXTUAL GROUND STATE**",
"_____no_output_____"
]
],
[
[
"print(diagonalized_generators_GuA)\nprint(eigen_vals_nonC_ground_state_GuA_ops)",
"_____no_output_____"
]
],
[
[
"We need to ENFORCE the diagnal geneators assigned values in the diagonal basis to these expectation values above^^^",
"_____no_output_____"
]
],
[
[
"ham_red = {}\n \nfor P in rotated_H.keys():\n sgn = 1\n for j, z_index in enumerate(z_indices): # enforce diagonal generator's assigned values in diagonal basis\n if P[z_index] == 'Z':\n sgn = sgn*eigen_vals_nonC_ground_state_GuA_ops[j] #<- eigenvalue of nonC ground state!\n elif P[z_index] != 'I':\n sgn = 0\n\n if sgn != 0:\n # construct term in reduced Hilbert space\n P_red = ''\n for i in range(n_q):\n if not i in z_indices:\n P_red = P_red + P[i]\n if P_red in ham_red.keys():\n ham_red[P_red] = ham_red[P_red] + rotated_H[P]*sgn\n else:\n ham_red[P_red] = rotated_H[P]*sgn\n \nham_red",
"_____no_output_____"
],
[
"c.quantum_correction(ham, #<- full Ham\n model,\n fn_form,\n ground_state_params)",
"_____no_output_____"
],
[
"c.quantum_correction(nonCon_H,model,fn_form,ground_state_params)",
"_____no_output_____"
],
[
"c.get_reduced_hamiltonians(ham,\n model,\n fn_form,\n ground_state_params,\n list(range(hamiltonians[mol_key][1])))[-1] == rotated_H ### aka when considering all qubit problem it is equal to rotated H!",
"_____no_output_____"
]
],
[
[
"For some reason it seems that when considering full Hamiltonian there is no reduction in the number of terms!\n\nQ. Do you expect any term reduction when doing CS-VQE?",
"_____no_output_____"
]
],
[
[
"n2 = hamiltonians[mol_key][1]-len(diagonalized_generators_GuA)\nn2",
"_____no_output_____"
],
[
"ham_red",
"_____no_output_____"
],
[
"ham==Con_H",
"_____no_output_____"
],
[
"n_q = len(diagonalized_generators_GuA[0])\nrotated_Hcon = deepcopy(Con_H)\n\n# iteratively perform R rotation over all terms in orginal Hamiltonian\nfor R in Rotations_list:\n newly_rotated_H={}\n for P in rotated_Hcon.keys():\n lin_comb_Rot_P = c.apply_rotation(R,P) # linear combination of Paulis from R rotation on P\n \n for P_rot in lin_comb_Rot_P:\n \n if P_rot in newly_rotated_H.keys():\n newly_rotated_H[P_rot]+=lin_comb_Rot_P[P_rot]*rotated_Hcon[P] # already in it hence +=\n else:\n newly_rotated_H[P_rot]=lin_comb_Rot_P[P_rot]*rotated_Hcon[P]\n \n rotated_Hcon = deepcopy(newly_rotated_H) ##<-- perform next R rotation on this H\n \nrotated_Hcon",
"_____no_output_____"
],
[
"print(diagonalized_generators_GuA)\nprint(eigen_vals_nonC_ground_state_GuA_ops)\n\np1_dict = {Gener.index('Z'): p1 for Gener, p1 in zip(diagonalized_generators_GuA, eigen_vals_nonC_ground_state_GuA_ops)}\np1_dict",
"_____no_output_____"
],
[
"new={}\nfor P1_P2 in rotated_Hcon.keys():\n Z_indices = [i for i, sigma in enumerate(P1_P2) if sigma=='Z']\n \n I1_P2=list(deepcopy(P1_P2))\n sign=1\n for ind in Z_indices:\n sign*=p1_dict[ind]\n I1_P2[ind]='I'\n I1_P2=''.join(I1_P2)\n \n new[I1_P2]=rotated_Hcon[P1_P2]*sign\n \nnew ",
"_____no_output_____"
],
[
"len(rotated_Hcon)-len(diagonalized_generators_GuA)\n# len(new)",
"_____no_output_____"
],
[
"H = conv_scr.Get_Operfermion_Hamiltonian(new)\nsparseH = qubit_operator_sparse(H, n_qubits=hamiltonians[mol_key][1])\nsp.sparse.linalg.eigsh(sparseH, which='SA', k=1)[0][0]",
"_____no_output_____"
],
[
"H_reduced_subspace={}\nfor P in rotated_H.keys():\n \n sign=1\n for P_known, eigen_val in zip(diagonalized_generators_GuA, eigen_vals_nonC_ground_state_GuA_ops):\n Z_index = P_known.index('Z') # Find single qubit Z in generator!\n \n if P[Z_index]== 'Z': # compare location in genertor to P of rotated H\n \n sign*=eigen_val #<- eigenvalue of nonC ground state!\n \n elif P[Z_index]!= 'I': \n sign=0 # MUST anti-commute!\n \n # build reduced Hilbert Space\n if sign!=0:\n P_new = list(deepcopy(P))\n P_new[Z_index]='I'\n P_new= ''.join(P_new)\n \n if P_new in H_reduced_subspace.keys():\n H_reduced_subspace[P_new] = H_reduced_subspace[P_new] + rotated_H[P]*sign\n else:\n H_reduced_subspace[P_new] = rotated_H[P]*sign\n \n# else:\n# H_reduced_subspace[P]=rotated_H[P]",
"_____no_output_____"
],
[
"print(len(rotated_H))\nprint(len(H_reduced_subspace))",
"_____no_output_____"
],
[
"# H_reduced_subspace",
"_____no_output_____"
],
[
"lowest_eigenvalue",
"_____no_output_____"
],
[
"from openfermion import qubit_operator_sparse\nimport conversion_scripts as conv_scr\nimport scipy as sp\nH = conv_scr.Get_Operfermion_Hamiltonian(H_reduced_subspace)\nsparseH = qubit_operator_sparse(H, n_qubits=hamiltonians[mol_key][1])\nsp.sparse.linalg.eigsh(sparseH, which='SA', k=1)[0][0]",
"_____no_output_____"
],
[
"c.quantum_correction(ham, #<- full Ham\n model,\n fn_form,\n ground_state_params)",
"_____no_output_____"
],
[
"lowest_eigenvalue",
"_____no_output_____"
],
[
"Hfull = conv_scr.Get_Operfermion_Hamiltonian(ham)\nsparseHfull = qubit_operator_sparse(Hfull, n_qubits=hamiltonians[mol_key][1])\nFCI = sp.sparse.linalg.eigsh(sparseHfull, which='SA', k=1)[0][0]\nprint('FCI=', FCI)",
"_____no_output_____"
],
[
"sp.sparse.linalg.eigsh(sparseH, which='SA', k=1)[0][0]",
"_____no_output_____"
],
[
"print(diagonalized_generators_GuA)\nprint(eigen_vals_nonC_ground_state_GuA_ops)\n\np1_dict = {Gener.index('Z'): p1 for Gener, p1 in zip(diagonalized_generators_GuA, eigen_vals_nonC_ground_state_GuA_ops)}\np1_dict",
"_____no_output_____"
],
[
"H_reduced_subspace={}\nfor P in rotated_Hcon.keys():\n \n new_sign=1\n P_new = list(P)\n for index, sigma in enumerate(P):\n if sigma == 'Z':\n new_sign*=p1_dict[index]\n P_new[index]='I'\n \n P_new = ''.join(P_new)\n H_reduced_subspace[P_new] = rotated_Hcon[P]*new_sign",
"_____no_output_____"
],
[
"H_reduced_subspace\n\nH_con_subspace = conv_scr.Get_Operfermion_Hamiltonian(H_reduced_subspace)\nsparseH_con_subspace = qubit_operator_sparse(H_con_subspace, n_qubits=hamiltonians[mol_key][1])\nsp.sparse.linalg.eigsh(sparseH_con_subspace, which='SA', k=1)[0][0]",
"_____no_output_____"
],
[
"# H_reduced_subspace={}\n# for P in rotated_Hcon.keys():\n \n# p1=1\n# for P_known, eigen_val in zip(diagonalized_generators_GuA, eigen_vals_nonC_ground_state_GuA_ops):\n# Z_index = P_known.index('Z') # Find single qubit Z in generator!\n \n# if P[Z_index]== 'Z': # compare location in genertor to P of rotated H\n# p1*=eigen_val #<- eigenvalue of nonC ground state!\n \n# P1_P2 = list(deepcopy(P))\n# P1_P2[Z_index]='I'\n# I1_P2= ''.join(P1_P2)\n \n# if I1_P2 in H_reduced_subspace.keys():\n# H_reduced_subspace[I1_P2] += rotated_Hcon[P]*p1\n# else:\n# H_reduced_subspace[I1_P2] = rotated_Hcon[P]*p1\n \n# elif P[Z_index]== 'I':\n# H_reduced_subspace[P] = rotated_Hcon[P]\n \n# elif P[Z_index]!= 'I': \n# sign=0 # MUST anti-commute!\n# H_reduced_subspace[P]=0\n \n# # # build reduced Hilbert Space\n# # if sign!=0:\n# # if P_new in H_reduced_subspace.keys():\n# # H_reduced_subspace[P_new] = H_reduced_subspace[P_new] + rotated_Hcon[P]*sign\n# # else:\n# # H_reduced_subspace[P_new] = rotated_Hcon[P_new]*sign\n \n# # # else:\n# # # H_reduced_subspace[P]=rotated_H[P]",
"_____no_output_____"
],
[
"H_reduced_subspace",
"_____no_output_____"
],
[
"nonCon_Energy = lowest_eigenvalue\n\nH_con_subspace = conv_scr.Get_Operfermion_Hamiltonian(H_reduced_subspace)\nsparseH_con_subspace = qubit_operator_sparse(H_con_subspace, n_qubits=hamiltonians[mol_key][1])\nCon_Energy = sp.sparse.linalg.eigsh(sparseH_con_subspace, which='SA', k=1)[0][0]\n\nCon_Energy+nonCon_Energy",
"_____no_output_____"
],
[
"FCI",
"_____no_output_____"
],
[
"c.quantum_correction(ham, #<- full Ham\n model,\n fn_form,\n ground_state_params)",
"_____no_output_____"
],
[
"FCI-lowest_eigenvalue",
"_____no_output_____"
],
[
"Con_Energy",
"_____no_output_____"
],
[
"c.commute(P_gen, P)",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6cde26d1665f3bcd07593633cf7b534573d5ad | 20,249 | ipynb | Jupyter Notebook | notebooks/Tutorial 1 - Python.ipynb | jmniederle/mlcourse | abf017e5c6713162518fa1add27621f83923f9a4 | [
"MIT"
]
| null | null | null | notebooks/Tutorial 1 - Python.ipynb | jmniederle/mlcourse | abf017e5c6713162518fa1add27621f83923f9a4 | [
"MIT"
]
| null | null | null | notebooks/Tutorial 1 - Python.ipynb | jmniederle/mlcourse | abf017e5c6713162518fa1add27621f83923f9a4 | [
"MIT"
]
| null | null | null | 21.843581 | 480 | 0.484715 | [
[
[
"# Python for data analysis\nFor those who are new to using Python for scientific work, we first provide a short introduction to Python and the most useful packages for data analysis.",
"_____no_output_____"
],
[
"## Python\nDisclaimer: We can only cover some of the basics here. If you are completely new to Python, we recommend to take an introductory online course, such as the [Definite Guide to Python](https://www.programiz.com/python-programming), or the [Whirlwind Tour of Python](https://github.com/jakevdp/WhirlwindTourOfPython). If you like a step-by-step approach, try the [DataCamp Intro to Python for Data Science](https://www.datacamp.com/courses/intro-to-python-for-data-science).\n\nTo practice your skills, try the [Hackerrank challenges](https://www.hackerrank.com/domains/python).",
"_____no_output_____"
],
[
"### Hello world\n* Printing is done with the print() function. \n* Everything after # is considered a comment. \n* You don't need to end commands with ';'. ",
"_____no_output_____"
]
],
[
[
"# This is a comment\nprint(\"Hello world\")\nprint(5 / 8)\n5/8 # This only prints in IPython notebooks and shells.",
"Hello world\n0.625\n"
]
],
[
[
"_Note: In these notebooks we'll use Python interactively to avoid having to type print() every time._",
"_____no_output_____"
],
[
"### Basic data types\nPython has all the [basic data types and operations](https://docs.python.org/3/library/stdtypes.htm): int, float, str, bool, None. \nVariables are __dynamically typed__: you need to give them a value upon creation, and they will have the data type of that value. If you redeclare the same variable, if will have the data type of the new value. \nYou can use type() to get a variable's type. ",
"_____no_output_____"
]
],
[
[
"s = 5\ntype(s)\ns > 3 # Booleans: True or False\ns = \"The answer is \"\ntype(s)",
"_____no_output_____"
]
],
[
[
"Python is also __strongly typed__: it won't implicitly change a data type, but throw a TypeError instead. You will have to convert data types explictly, e.g. using str() or int(). \nException: Arithmetic operations will convert to the _most general_ type.",
"_____no_output_____"
]
],
[
[
"1.0 + 2 # float + int -> float\ns + str(42) # string + string\n# s + 42 # Bad: string + int",
"_____no_output_____"
]
],
[
[
"### Complex types\nThe main complex data types are lists, tuples, sets, and dictionaries (dicts).",
"_____no_output_____"
]
],
[
[
"l = [1,2,3,4,5,6] # list\nt = (1,2,3,4,5,6) # tuple: like a list, but immutable\ns = set((1,2,3,4,5,6)) # set: unordered, you need to use add() to add new elements \nd = {2: \"a\", # dict: has key - value pairs\n 3: \"b\",\n \"foo\": \"c\",\n \"bar\": \"d\"}\n\nl # Note how each of these is printed\nt\ns \nd",
"_____no_output_____"
]
],
[
[
"You can use indices to return a value (except for sets, they are unordered)",
"_____no_output_____"
]
],
[
[
"l\nl[2]\nt\nt[2]\nd\nd[2]\nd[\"foo\"]",
"_____no_output_____"
]
],
[
[
"You can assign new values to elements, except for tuples",
"_____no_output_____"
]
],
[
[
"l\nl[2] = 7 # Lists are mutable\nl\n# t[2] = 7 # Tuples are not -> TypeError",
"_____no_output_____"
]
],
[
[
"Python allows convenient tuple packing / unpacking",
"_____no_output_____"
]
],
[
[
"b = (\"Bob\", 19, \"CS\") # tuple packing\n(name, age, studies) = b # tuple unpacking\nname\nage\nstudies",
"_____no_output_____"
]
],
[
[
"### Strings\nStrings are [quite powerful](https://www.tutorialspoint.com/python/python_strings.htm). \nThey can be used as lists, e.g. retrieve a character by index. \nThey can be formatted with the format operator (%), e.g. %s for strings, %d for decimal integers, %f for floats.",
"_____no_output_____"
]
],
[
[
"s = \"The %s is %d\" % ('answer', 42)\ns\ns[0]\ns[4:10]\n'%.2f' % (3.14159265) # defines number of decimal places in a float",
"_____no_output_____"
]
],
[
[
"They also have a format() function for [more complex formatting](https://pyformat.info/)",
"_____no_output_____"
]
],
[
[
"l = [1,2,3,4,5,6]\n\"{}\".format(l) \n\"%s\" % l # This is identical\n\"{first} {last}\".format(**{'first': 'Hodor', \n 'last': 'Hodor!'}) ",
"_____no_output_____"
]
],
[
[
"### For loops, If statements\nFor-loops and if-then-else statements are written like this. \nIndentation defines the scope, not brackets.",
"_____no_output_____"
]
],
[
[
"l = [1,2,3]\nd = {\"foo\": \"c\", \"bar\": \"d\"}\n\nfor i in l:\n print(i)\n \nfor k, v in d.items(): # Note how key-value pairs are extracted\n print(\"%s : %s\" % (k,v))\n \nif len(l) > 3:\n print('Long list')\nelse:\n print('Short list')",
"1\n2\n3\nfoo : c\nbar : d\nShort list\n"
]
],
[
[
"### Functions\nFunctions are defined and called like this:",
"_____no_output_____"
]
],
[
[
"def myfunc(a, b):\n return a + b\n\nmyfunc(2, 3)",
"_____no_output_____"
]
],
[
[
"Function arguments (parameters) can be:\n* variable-length (indicated with \\*)\n* a dictionary of keyword arguments (indicated with \\*\\*). \n* given a default value, in which case they are not required (but have to come last)",
"_____no_output_____"
]
],
[
[
"def func(*argv, **kwarg):\n print(\"func argv: %s\" % str(argv))\n print(\"func kwarg: %s\" % str(kwarg))\n \nfunc(2, 3, a=4, b=5)\n\ndef func(a=2):\n print(a * a)\n\nfunc(3)\nfunc()",
"func argv: (2, 3)\nfunc kwarg: {'a': 4, 'b': 5}\n9\n4\n"
]
],
[
[
"Functions can have any number of outputs.",
"_____no_output_____"
]
],
[
[
"def func(*argv):\n return sum(argv[0:2]), sum(argv[2:4])\n\nsum1, sum2 = func(2, 3, 4, 5)\nsum1, sum2\n\ndef squares(limit):\n r = 0\n ret = []\n \n while r < limit:\n ret.append(r**2)\n r += 1\n \n return ret\n\nfor i in squares(4):\n print(i)",
"0\n1\n4\n9\n"
]
],
[
[
"Functions can be passed as arguments to other functions",
"_____no_output_____"
]
],
[
[
"def greet(name):\n return \"Hello \" + name \n\ndef call_func(func):\n other_name = \"John\"\n return func(other_name) \n\ncall_func(greet)",
"_____no_output_____"
]
],
[
[
"Functions can return other functions",
"_____no_output_____"
]
],
[
[
"def compose_greet_func():\n def get_message():\n return \"Hello there!\"\n\n return get_message\n\ngreet = compose_greet_func()\ngreet()",
"_____no_output_____"
]
],
[
[
"### Classes\nClasses are defined like this",
"_____no_output_____"
]
],
[
[
"class TestClass(object): # TestClass inherits from object.\n myvar = \"\"\n \n def __init__(self, myString): # optional constructor, returns nothing\n self.myvar = myString # 'self' is used to store instance properties\n \n def say(self, what): # you need to add self as the first argument \n return self.myvar + str(what)\n\na = TestClass(\"The new answer is \")\na.myvar # You can retrieve all properties of self\na.say(42)",
"_____no_output_____"
]
],
[
[
"Static functions need the @staticmethod decorator",
"_____no_output_____"
]
],
[
[
"class TestClass(object):\n myvar = \"\"\n \n def __init__(self, myString): \n self.myvar = myString\n \n def say(self, what): # you need to add self as the first argument \n return self.myvar + str(what)\n \n @staticmethod\n def sayStatic(what): # or declare the function static \n return \"The answer is \" + str(what)\n\na = TestClass(\"The new answer is \")\na.say(42)\na.sayStatic(42)",
"_____no_output_____"
]
],
[
[
"### Functional Python\nYou can write complex procedures in a few elegant lines of code using [built-in functions](https://docs.python.org/2/library/functions.html#map) and libraries such as functools, itertools, operator.",
"_____no_output_____"
]
],
[
[
"def square(num):\n return num ** 2\n\n# map(function, iterable) applies a given function to every element of a list\nlist(map(square, [1,2,3,4]))\n\n# a lambda function is an anonymous function created on the fly\nlist(map(lambda x: x**2, [1,2,3,4])) \nmydata = list(map(lambda x: x if x>2 else 0, [1,2,3,4])) \nmydata\n\n# reduce(function, iterable ) applies a function with two arguments cumulatively to every element of a list\nfrom functools import reduce\nreduce(lambda x,y: x+y, [1,2,3,4]) \nmydata",
"_____no_output_____"
],
[
"# filter(function, iterable)) extracts every element for which the function returns true\nlist(filter(lambda x: x>2, [1,2,3,4]))\n\n# zip([iterable,...]) returns tuples of corresponding elements of multiple lists\nlist(zip([1,2,3,4],[5,6,7,8,9]))",
"_____no_output_____"
]
],
[
[
"__list comprehensions__ can create lists as follows: \n\n [statement for var in iterable if condition] \n \n__generators__ do the same, but are lazy: they don't create the list until it is needed: \n\n (statement for var in list if condition)",
"_____no_output_____"
]
],
[
[
"a = [2, 3, 4, 5]\n\nlc = [ x for x in a if x >= 4 ] # List comprehension. Square brackets\nlg = ( x for x in a if x >= 4 ) # Generator. Round brackets\n\na.extend([6,7,8,9])\n\nfor i in lc:\n print(\"%i \" % i, end=\"\") # end tells the print function not to end with a newline\nprint(\"\\n\")\nfor i in lg:\n print(\"%i \" % i, end=\"\")",
"4 5 \n\n4 5 6 7 8 9 "
]
],
[
[
"__dict comprehensions__ are possible in Python 3: \n\n {key:value for (key,value) in dict.items() if condition} ",
"_____no_output_____"
]
],
[
[
"# Quick dictionary creation\n\nnumbers = range(10)\n{n:n**2 for n in numbers if n%2 == 0}",
"_____no_output_____"
],
[
"# Powerful alternative to replace lambda functions\n# Convert Fahrenheit to Celsius\nfahrenheit = {'t1': -30,'t2': 0,'t3': 32,'t4': 100}\n{k:(float(5)/9)*(v-32) for (k,v) in fahrenheit.items()}",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
]
|
cb6cef1443109b538e5a516b0ba93a3f5e94ce2e | 2,295 | ipynb | Jupyter Notebook | notebooks/play/loop_test.ipynb | sytelus/longview | 686e43cf187eaf55df18949359fd63d57dc337b2 | [
"MIT"
]
| null | null | null | notebooks/play/loop_test.ipynb | sytelus/longview | 686e43cf187eaf55df18949359fd63d57dc337b2 | [
"MIT"
]
| null | null | null | notebooks/play/loop_test.ipynb | sytelus/longview | 686e43cf187eaf55df18949359fd63d57dc337b2 | [
"MIT"
]
| null | null | null | 27 | 712 | 0.527669 | [
[
[
"import time\nfor i in range(100):\n print(i)\n time.sleep(10)",
"0\n1\n2\n3\n4\n5\n6\n7\n"
],
[
"import time\nfor i in range(100):\n print(i)\n time.sleep(5)",
"_____no_output_____"
],
[
"print('s')",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code"
]
]
|
cb6cf4fddd06a507aa15a879359152ad6a9db60f | 288,488 | ipynb | Jupyter Notebook | TP3_27.ipynb | sragons2/jupyter | c5fe903aec7d0c7e70f95bfcd01f0457bdb6b755 | [
"MIT"
]
| null | null | null | TP3_27.ipynb | sragons2/jupyter | c5fe903aec7d0c7e70f95bfcd01f0457bdb6b755 | [
"MIT"
]
| null | null | null | TP3_27.ipynb | sragons2/jupyter | c5fe903aec7d0c7e70f95bfcd01f0457bdb6b755 | [
"MIT"
]
| null | null | null | 342.622328 | 79,068 | 0.922198 | [
[
[
"%matplotlib inline\nimport numpy as np\nimport matplotlib.pylab as plt\nimport scipy\nimport scipy.stats\nimport scipy.integrate",
"_____no_output_____"
]
],
[
[
"# Thème 3 : Analyse Bayésienne",
"_____no_output_____"
],
[
"## Jeu du pile ou face\n\nOn souhaite estimer, à partir d'un série de N mesures au jeu de pile ou face, la probabilité $p$ d'obtenir pile.\nPour cela, dans le cadre de l'analyse bayésienne on va considérer $p$ comme une variable aléatoire et on va construire sa fonction densité de probabilité à l'aide du théorème de Bayes~(on suppose que l'on a observé n piles parmi les N mesures):\n\n$$ f_N(p|n) \\propto P_N(n|p) \\times \\pi (p) $$\n\noù $f_N(p|n)$ est la fonction de distribution associée à $p$, $P_N(n|p)$ est la probabilité d'observer $n$ piles\nparmi $N$ mesures pour un $p$ donné (fonction de vraisemblance) et $\\pi(p)$ est la fonction densité de\nprobabilité associée à $p$ à priori (ce que l'on appelle le prior).\n\n1. Donner la forme de $P_N(n|p)$.\n",
"_____no_output_____"
],
[
" La probabilité d'avoir n piles sachant la valeur de p est donné par une loi binomiale.\n \n $P_N(n|p) = \\prod_{i = 1}^{x} P_N(n|p_{i}) = \\prod_{i = 1}^{x}{n \\choose k} p_{i}^k (1-p_{i})^{n-k}$\n \n $P_N(n|p) = {n \\choose k} p^k (1-p)^{n-k}$",
"_____no_output_____"
],
[
"2. Simuler une série de $128$ mesures effectuées avec $p=.8$ et stocker les résultats dans un vecteur.\n",
"_____no_output_____"
]
],
[
[
"#Là on simule PN(n|p) car on a N = 128 lancés, et on connaît p=0.8. \n\nr = np.random.random(128)<=0.8\nn = np.sum(r)\nprint('Nombre de piles =',n)\n\nprint(scipy.special.binom(4,2))\n\nx = np.linspace(0,3,100)\ny = x\n\nprint(scipy.integrate.simps(y, x))\n ",
"Nombre de piles = 96\n6.0\n4.5\n"
]
],
[
[
"\nDans la suite, on prend comme prior $\\pi (p) = 1$ (toutes les valeurs de $p$ sont équiprobables).\n\n3. Représenter $f_{N}(p|n)$ pour N = 1, 2, 4, 8, 16, 32, 64, 128. On prendra soin de normaliser la fonction densité\nde probabilité (on peut utiliser la méthode `scipy.integrate.simps` pour intégrer numériquement\nune fonction entre $a$ et $b$). \n",
"_____no_output_____"
]
],
[
[
"# On crée un vecteur avec 128 lancés, dont les piles représenteront tous les nombres aléatoires en dessous de 0.8.\n\n\n# On fait fluctuer le nombre de lancés, et donc le nombre de piles (n)\n# Et après on prend un p, une probabilité continue, (donc plus fixée à 0.8)\n# Et on la rend continue, et y nous donne la probabilité d'avoir un certain nombre de pile, \n# à partir d'une probabilité '' moyenne '' déjà définie qui ici est 0.8.\n\nfor N in [2**i for i in range(8)]:\n r = np.random.random(128)<=0.8\n p = np.linspace(0, 1, 1000)\n #On fait la somme des true sur les N premières composantes de r qui viennent d'être générées.\n n = np.sum(r[:N])\n # Loi binomiale donne la probabilité d'avoir n succès ... il manque quand même (n parmis N):\n # Comme p est continu, on calcule plus de y puisqu'il y a pleinn de p ?\n # J'ai rajouté le coefficient binomial ..\n y = scipy.special.binom(N,n)*p**n*(1-p)**(N-n)\n #print(p[np.argmax(y)])\n #print('\\n', np.var(p))\n # Là il intègre juste l'aire en dessous de la courbe.\n norm = scipy.integrate.simps(y, p)\n plt.plot(p, y/norm, label=f'N={N}', lw = 3) \n plt.legend()\n \n\nclass color:\n PURPLE = '\\033[95m'\n BOLD = '\\033[1m'\n END = '\\033[0m'\n\nprint(color.PURPLE + color.BOLD +'\\nfN(p|n), c est la probabilité d avoir p, sachant que l on a obtenu n piles pour N lancés.'+ color.END)\n\n\nplt.xlabel('p', fontsize =18, color = 'b')\nplt.ylabel('fN(p|n)', fontsize =18, color = 'b')\nplt.title('Distribution de probabilité que p sachant n et N\\n', fontsize = 18, color='darkorange')\nplt.show()\n",
"\u001b[95m\u001b[1m\nfN(p|n), c est la probabilité d avoir p, sachant que l on a obtenu n piles pour N lancés.\u001b[0m\n"
]
],
[
[
"\n4. Pour chaque cas, en déduire la valeur la plus probable de $p$ : $p_{MV}$ (on peut utiliser la fonction `np.argmax`), comparer à la valeur théorique. Calculer la variance $\\sigma^2$ de $p$.\n",
"_____no_output_____"
]
],
[
[
"def gaussian(x, mu, sig):\n return 1./(np.sqrt(2.*np.pi)*sig)*np.exp(-np.power((x - mu)/sig, 2.)/2)\n\nfor N in [2**i for i in range(8)]:\n \n r = np.random.random(1000)<=0.8\n p = np.linspace(0, 1, 10000)\n n = np.sum(r[:N])\n \n y = scipy.special.binom(N,n)*p**n*(1-p)**(N-n)\n norm = scipy.integrate.simps(y, p)\n popt,pcov = scipy.optimize.curve_fit(gaussian,p, y/norm)\n\n print('\\nNombre de lancés :', N)\n print('Valeur la plus probable de p :',np.round(p[np.argmax(y/norm)],4))\n print('Variance de la distribution de p :', np.round(popt[1]**2,4))\n print('Ecart à la valeur théorique de p :', np.round(abs(0.8-p[np.argmax(y/norm)]),4))\n \nprint('\\nPlus N est grand, plus on tend vers pmv = 0.8, qui est la valeur théorique, et plus la variance diminue, ce qui indique'\n ' que la distribution de p est d autant plus piquée autour de cette valeur.')\nprint('\\nfN(p|n), c est la probabilité d avoir p, sachant que l on a obtenu n piles pour N lancés')\n",
"\nNombre de lancés : 1\nValeur la plus probable de p : 1.0\nVariance de la distribution de p : 0.0659\nEcart à la valeur théorique de p : 0.2\n\nNombre de lancés : 2\nValeur la plus probable de p : 1.0\nVariance de la distribution de p : 0.0327\nEcart à la valeur théorique de p : 0.2\n\nNombre de lancés : 4\nValeur la plus probable de p : 1.0\nVariance de la distribution de p : 0.0125\nEcart à la valeur théorique de p : 0.2\n\nNombre de lancés : 8\nValeur la plus probable de p : 0.75\nVariance de la distribution de p : 0.0202\nEcart à la valeur théorique de p : 0.05\n\nNombre de lancés : 16\nValeur la plus probable de p : 0.75\nVariance de la distribution de p : 0.0107\nEcart à la valeur théorique de p : 0.05\n\nNombre de lancés : 32\nValeur la plus probable de p : 0.75\nVariance de la distribution de p : 0.0056\nEcart à la valeur théorique de p : 0.05\n\nNombre de lancés : 64\nValeur la plus probable de p : 0.8125\nVariance de la distribution de p : 0.0023\nEcart à la valeur théorique de p : 0.0125\n\nNombre de lancés : 128\nValeur la plus probable de p : 0.7266\nVariance de la distribution de p : 0.0015\nEcart à la valeur théorique de p : 0.0734\n\nPlus N est grand, plus on tend vers pmv = 0.8, qui est la valeur théorique, et plus la variance diminue, ce qui indique que la distribution de p est d autant plus piquée autour de cette valeur.\n\nfN(p|n), c est la probabilité d avoir p, sachant que l on a obtenu n piles pour N lancés\n"
]
],
[
[
"5. En déduire le niveau de confiance associé à l'intervalle $[ p_{MV}-\\sigma, p_{MV}+\\sigma ]$.",
"_____no_output_____"
]
],
[
[
"#Demander à Mr Derome.",
"_____no_output_____"
]
],
[
[
"6. Comment évoluent les résultats obtenus si on prend un autre prior ? essayer par exemple $\\pi (p) = 2 p$ ou\n $\\pi (p) = 3 p^2$.",
"_____no_output_____"
]
],
[
[
"\nfig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(16,6))\n\nfor N in [2**i for i in range(10)]:\n r = np.random.random(1000)<=0.8\n p = np.linspace(0, 1, 1000)\n n = np.sum(r[:N])\n y = scipy.special.binom(N,n)*p**n*(1-p)**(N-n)\n norm = scipy.integrate.simps(y, p)\n ax1.plot(p, y/norm, label=f'N={N}', lw = 3) \n ax1.set_xlabel('p', fontsize =18, color = 'b')\n ax1.set_ylabel('fN(p|n)', fontsize =18, color = 'b')\n\nfor N in [2**i for i in range(10)]:\n r = np.random.random(1000)<=0.8\n p = np.linspace(0, 1, 1000)\n n = np.sum(r[:N])\n y = scipy.special.binom(N,n)*p**n*(1-p)**(N-n)*2*p\n norm = scipy.integrate.simps(y, p)\n ax2.plot(p, y/norm, label=f'N={N}', lw = 3)\n ax2.set_xlabel('p', fontsize =18, color = 'b')\n ax2.set_ylabel('fN(p|n)', fontsize =18, color = 'b')\n\nfor N in [2**i for i in range(10)]:\n r = np.random.random(1000)<=0.8\n p = np.linspace(0, 1, 1000)\n n = np.sum(r[:N])\n y = scipy.special.binom(N,n)*p**n*(1-p)**(N-n)*3*p**2\n norm = scipy.integrate.simps(y, p)\n ax3.plot(p, y/norm, label=f'N={N}', lw = 3)\n ax3.set_xlabel('p', fontsize =18, color = 'b')\n ax3.set_ylabel('fN(p|n)', fontsize =18, color = 'b')\n\n \nplt.show()\n",
"_____no_output_____"
],
[
"\nprint('\\n Pour prior = 2p :\\n')\n\ndef gaussian(x, mu, sig):\n return 1./(np.sqrt(2.*np.pi)*sig)*np.exp(-np.power((x - mu)/sig, 2.)/2)\n\n\nfor N in [2**i for i in range(8)]:\n r = np.random.random(128)<=0.8\n n = np.sum(r[:N])\n p = np.linspace(0, 1, 1000)\n y = scipy.special.binom(N,n)*p**(n)*(1-p)**(N-n)*2*p\n norm = scipy.integrate.simps(y, p)\n popt,pcov = scipy.optimize.curve_fit(gaussian,p, y/norm)\n\n print('\\nNombre de lancés :', N)\n print('Valeur la plus probable de p :',np.round(p[np.argmax(y/norm)],4))\n print('Variance de la distribution de p :', np.round(popt[1]**2,4))\n print('Ecart à la valeur théorique de p :', np.round(abs(0.8-p[np.argmax(y/norm)]),4))\n",
"\n Pour prior = 2p :\n\n\nNombre de lancés : 1\nValeur la plus probable de p : 0.4995\nVariance de la distribution de p : 0.0671\nEcart à la valeur théorique de p : 0.3005\n\nNombre de lancés : 2\nValeur la plus probable de p : 1.0\nVariance de la distribution de p : 0.0191\nEcart à la valeur théorique de p : 0.2\n\nNombre de lancés : 4\nValeur la plus probable de p : 0.7998\nVariance de la distribution de p : 0.0279\nEcart à la valeur théorique de p : 0.0002\n\nNombre de lancés : 8\nValeur la plus probable de p : 0.7778\nVariance de la distribution de p : 0.0171\nEcart à la valeur théorique de p : 0.0222\n\nNombre de lancés : 16\nValeur la plus probable de p : 0.8819\nVariance de la distribution de p : 0.0061\nEcart à la valeur théorique de p : 0.0819\n\nNombre de lancés : 32\nValeur la plus probable de p : 0.7578\nVariance de la distribution de p : 0.0053\nEcart à la valeur théorique de p : 0.0422\n\nNombre de lancés : 64\nValeur la plus probable de p : 0.8619\nVariance de la distribution de p : 0.0018\nEcart à la valeur théorique de p : 0.0619\n\nNombre de lancés : 128\nValeur la plus probable de p : 0.8218\nVariance de la distribution de p : 0.0011\nEcart à la valeur théorique de p : 0.0218\n"
],
[
"print('\\n Pour prior = 3p² :\\n')\n\ndef gaussian(x, mu, sig):\n return 1./(np.sqrt(2.*np.pi)*sig)*np.exp(-np.power((x - mu)/sig, 2.)/2)\n\n\nfor N in [2**i for i in range(8)]:\n r = np.random.random(128)<=0.8\n n = np.sum(r[:N])\n p = np.linspace(0, 1, 1000)\n y = scipy.special.binom(N,n)*p**(n)*(1-p)**(N-n)*3*p**2\n norm = scipy.integrate.simps(y, p)\n popt,pcov = scipy.optimize.curve_fit(gaussian,p, y/norm)\n\n print('\\nNombre de lancés :', N)\n print('Valeur la plus probable de p :',np.round(p[np.argmax(y/norm)],4))\n print('Variance de la distribution de p :', np.round(popt[1]**2,4))\n print('Ecart à la valeur théorique de p :', np.round(abs(0.8-p[np.argmax(y/norm)]),4))\n",
"\n Pour prior = 3p² :\n\n\nNombre de lancés : 1\nValeur la plus probable de p : 1.0\nVariance de la distribution de p : 0.0191\nEcart à la valeur théorique de p : 0.2\n\nNombre de lancés : 2\nValeur la plus probable de p : 1.0\nVariance de la distribution de p : 0.0124\nEcart à la valeur théorique de p : 0.2\n\nNombre de lancés : 4\nValeur la plus probable de p : 1.0\nVariance de la distribution de p : 0.0065\nEcart à la valeur théorique de p : 0.2\n\nNombre de lancés : 8\nValeur la plus probable de p : 0.7998\nVariance de la distribution de p : 0.0146\nEcart à la valeur théorique de p : 0.0002\n\nNombre de lancés : 16\nValeur la plus probable de p : 0.7778\nVariance de la distribution de p : 0.0089\nEcart à la valeur théorique de p : 0.0222\n\nNombre de lancés : 32\nValeur la plus probable de p : 0.8529\nVariance de la distribution de p : 0.0036\nEcart à la valeur théorique de p : 0.0529\n\nNombre de lancés : 64\nValeur la plus probable de p : 0.8328\nVariance de la distribution de p : 0.0021\nEcart à la valeur théorique de p : 0.0328\n\nNombre de lancés : 128\nValeur la plus probable de p : 0.7538\nVariance de la distribution de p : 0.0014\nEcart à la valeur théorique de p : 0.0462\n"
]
],
[
[
"## Loi exponentielle\n\nOn souhaite estimer le paramètre $\\lambda$ d'une loi exponentielle de fonction densité de probabilité :\n\n$$f(x) = \\left\\{ \\begin{array}{ll} \\lambda \\exp ( -\\lambda x ) & \\textrm{pour } x\\ge 0 \\\\\n0 & \\textrm{sinon} \\end{array} \\right.$$\n\nà partir d'une série de $N$ mesures ${x_1, x_2,\\ldots,x_N}$. Dans le cadre de l'analyse bayésienne, on va\nconstruire la fonction densité de probabilité associée au paramètre $\\lambda$ sous la forme~:\n\n$$ f(\\lambda | {x_1, x_2,\\ldots,x_N} ) \\propto L({x_1, x_2,\\ldots,x_N}|\\lambda) \\times \\pi (\\lambda) $$\n\noù $ L({x_1, x_2,\\ldots,x_N}|\\lambda) $ est la fonction de vraisemblance.\n\n1. Donner la forme de $ L({x_1, x_2,\\ldots,x_N}|\\lambda) $\n",
"_____no_output_____"
],
[
"\n $ L({x_1, x_2,\\ldots,x_N}|\\lambda) = \\prod_{i = 1}^{n} \\lambda \\exp ( -\\lambda xi ) = \\lambda^{n} \\exp ( -\\lambda \\sum_{i = 1}^{n} xi )$\n \n \nLa fonction de vraisemblance est donnée par :\n$$ \\log L (\\tau) = \\sum_i \\log f( x_i ; \\tau) = \\sum_i \\log \\left(\\frac{1}{\\tau} \\exp\\left( -\\frac{x_i}{\\tau}\\right) \\right) = - n \\log \\tau - \\frac{1}{\\tau} \\sum_i x_i $$\n\n\n",
"_____no_output_____"
],
[
"\n2. Simuler une série de $128$ mesures effectuées avec $\\lambda=.5$ et stocker le résultat des mesures dans un vecteur.\n",
"_____no_output_____"
]
],
[
[
"vecteur =np.random.exponential(0.5, 128)\n",
"_____no_output_____"
]
],
[
[
"Dans la suite, on prend comme prior $\\pi (\\lambda) = \\textrm{cst}$ pour $ 0 \\le \\lambda \\le 3 $\n\n\n3. Représenter $ f(\\lambda | {x_1, x_2,\\ldots,x_N}) $ pour N = 1, 2, 4, 8, 16, 32, 64, 128.\n",
"_____no_output_____"
]
],
[
[
"vecteur = np.random.exponential(0.5, 128)\n\nplt.figure(figsize=[15, 7]) \n\ndef ln_vraisemblance(Lambda, vecteur):\n return -len(vecteur) * np.log(Lambda) - np.sum(vecteur) / Lambda\n\ndef ln_prior(Lambda): \n return -np.log(Lambda)\n\ndef ln_postérior(Lambda, vecteur):\n ln_vraisemblance(Lambda, vecteur) + ln_postérior (Lambda) \n \nLambda = np.linspace(0.001, 3, 10000)\n\n\nfor n in [2**i for i in range(8)]:\n log_y = ln_vraisemblance(Lambda, vecteur[:n]) + ln_prior (Lambda)\n y = np.exp(log_y-np.max(log_y)) # on soustrait le max du logy pour limiter les grandes valeurs\n norm = scipy.integrate.simps(y, Lambda)\n plt.plot(Lambda, y/norm, label=f'N = {n}')\n plt.xlabel('Lambda', color='orange', fontsize = 20)\n plt.ylabel('f(Lambda|x1 ...xn)', color='orange', fontsize = 20)\n plt.title('Distribution de probabilité de Lambda à partir des mesures effectuées\\n', color='b', fontsize = 20)\nplt.legend()\nplt.show()\n\n",
"_____no_output_____"
]
],
[
[
"4. Pour chaque cas, en déduire la valeur plus probable de $\\lambda_{MV}$ et sa variance $\\sigma^2$.",
"_____no_output_____"
]
],
[
[
"vecteur = np.random.exponential(0.5, 128)\n\nplt.figure(figsize=[15, 7]) \n\ndef ln_vraisemblance(Lambda, vecteur):\n return -len(vecteur) * np.log(Lambda) - np.sum(vecteur) / Lambda\n\ndef ln_prior(Lambda): \n return -np.log(Lambda)\n\ndef ln_postérior(Lambda, vecteur):\n ln_vraisemblance(Lambda, vecteur) + ln_postérior (Lambda) \n\n\ndef gaussian(x, mu, sig):\n return 1./(np.sqrt(2.*np.pi)*sig)*np.exp(-np.power((x - mu)/sig, 2.)/2)\n \nLambda = np.linspace(0.001, 3, 10000)\n\nfor n in [2**i for i in range(8)]:\n log_y = ln_vraisemblance(Lambda, vecteur[:n]) + ln_prior (Lambda)\n y = np.exp(log_y-np.max(log_y)) # on soustrait le max du logy pour limiter les grandes valeurs\n norm = scipy.integrate.simps(y, Lambda)\n plt.plot(Lambda, y/norm, label=f'N = {n}')\n popt,pcov = scipy.optimize.curve_fit(gaussian,Lambda,y/norm)\n plt.xlabel('Lambda', color='orange', fontsize = 20)\n plt.ylabel('f(Lambda|x1 ...xn)', color='orange', fontsize = 20)\n plt.title('Distribution de probabilité de Lambda à partir des mesures effectuées\\n', color='b', fontsize = 20)\n print('\\nPour n =', n)\n print('Valeur la plus probable de Lambda :',np.round(Lambda[np.argmax(y/norm)],4))\n print('Variance de la distribution de Lambda :', np.round(popt[1]**2,4))\n\n \nplt.legend()\n",
"\nPour n = 1\nValeur la plus probable de Lambda : 0.4179\nVariance de la distribution de Lambda : 0.3543\n\nPour n = 2\nValeur la plus probable de Lambda : 0.3546\nVariance de la distribution de Lambda : 0.1212\n\nPour n = 4\nValeur la plus probable de Lambda : 0.3168\nVariance de la distribution de Lambda : 0.0355\n\nPour n = 8\nValeur la plus probable de Lambda : 0.5928\nVariance de la distribution de Lambda : 0.0519\n\nPour n = 16\nValeur la plus probable de Lambda : 0.5706\nVariance de la distribution de Lambda : 0.0221\n\nPour n = 32\nValeur la plus probable de Lambda : 0.5745\nVariance de la distribution de Lambda : 0.0108\n\nPour n = 64\nValeur la plus probable de Lambda : 0.4911\nVariance de la distribution de Lambda : 0.0038\n\nPour n = 128\nValeur la plus probable de Lambda : 0.4818\nVariance de la distribution de Lambda : 0.0018\n"
]
],
[
[
"5. En déduire le niveau de confiance associé à l'intervalle $[\\lambda_{MV}-\\sigma, \\lambda_{MV}+\\sigma]$.",
"_____no_output_____"
],
[
"## Loi gaussienne\n\nOn souhaite estimer les paramètres $\\mu$ et $\\sigma$ d'une loi gaussienne de fonction densité de probabilité :\n\n$$f(x) = \\frac{1}{\\sqrt{2 \\pi} \\sigma} \\exp \\left( - \\frac{(x-\\mu)^2}{2\\sigma^2}\\right)$$\n\nà partir d'une série de $N=1000$ mesures ${x_1, x_2,\\ldots,x_N}$ avec $\\mu=1$ et $\\sigma=2$ , utiliser la bibliothèque `emcee` (https://emcee.readthedocs.io/) pour estimer les lois de distribution associées aux paramètres $\\mu$ et $\\sigma$. Discuter le choix des priors.",
"_____no_output_____"
]
],
[
[
"mesures = np.random.normal(1, 2, 1000)",
"_____no_output_____"
],
[
"def ln_vraisemblance(paramètres, mesures):\n return -len(mesures) * np.log(paramètres[1]) - .5 * np.sum(np.square(mesures - paramètres[0])/paramètres[1])",
"_____no_output_____"
],
[
"#prior = 1 donc ln(prior) = 0\ndef ln_prior(paramètres):\n return 0 ",
"_____no_output_____"
],
[
"def ln_posterior(paramètres, mesures):\n return ln_vraisemblance(paramètres, mesures) + ln_prior(paramètres)",
"_____no_output_____"
],
[
"import emcee\nnombre_chaînes = 10\n#Comme on s'occupe de mu et de sigma il faut faire 2 colonnes\np0 = np.random.random(size=(nombre_chaînes, 2))+1\nsampler = emcee.EnsembleSampler(nombre_chaînes, 2, ln_posterior, args=[mesures,])\nsampler.run_mcmc(p0, 10000)",
"_____no_output_____"
],
[
"samples = sampler.get_chain()\nfig, (ax1, ax2) = plt.subplots(2, figsize=(12, 8))\n\nax1.plot(samples[:, :, 0], alpha=0.4)\nax1.set_ylim(0, 2)\nax1.set_xlim(0, len(samples))\nax1.set_ylabel('mu')\nax1.yaxis.set_label_coords(-0.08, 0.5)\nax1.set_xlabel(\"Nombre de pas\")\n\nax2.plot(samples[:, :, 1], alpha=0.4)\nax2.set_ylim(0, 4)\nax2.set_xlim(0, len(samples))\nax2.set_ylabel('sigma')\nax2.yaxis.set_label_coords(-0.08, 0.5)\nax2.set_xlabel(\"Nombre de pas\")\n\nplt.show()",
"_____no_output_____"
]
]
]
| [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6cf954080254f95d6afb07073d9830500abff5 | 85,601 | ipynb | Jupyter Notebook | Module3/Module3 - Lab5.ipynb | huangale/edxpy | 383b6c6c32cbaebb1c55d0464dd33cad0a22023f | [
"MIT"
]
| null | null | null | Module3/Module3 - Lab5.ipynb | huangale/edxpy | 383b6c6c32cbaebb1c55d0464dd33cad0a22023f | [
"MIT"
]
| null | null | null | Module3/Module3 - Lab5.ipynb | huangale/edxpy | 383b6c6c32cbaebb1c55d0464dd33cad0a22023f | [
"MIT"
]
| null | null | null | 85.515485 | 53,384 | 0.71991 | [
[
[
"# DAT210x - Programming with Python for DS",
"_____no_output_____"
],
[
"## Module3 - Lab5",
"_____no_output_____"
],
[
"This code is intentionally missing! Read the directions on the course lab page!",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport matplotlib.pyplot as plt\nimport matplotlib\n\n# This is new\nfrom pandas.plotting import andrews_curves",
"_____no_output_____"
],
[
"# Look pretty...\n\n# matplotlib.style.use('ggplot')\nplt.style.use('ggplot')",
"_____no_output_____"
],
[
"df = pd.read_csv('D:/misc/edx/Programming with Python for Data Science/DAT210x/Module3/Datasets/wheat.data', index_col='id')\ndf",
"_____no_output_____"
],
[
"# df.drop(columns = ['area','perimeter'], inplace = True)\n# df",
"_____no_output_____"
],
[
"plt.figure()\nandrews_curves(df, 'wheat_type', alpha = 0.4, color=('k', 'r', 'b'))\nplt.show()",
"_____no_output_____"
]
]
]
| [
"markdown",
"code"
]
| [
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6cfcd22b83ec7df336271911924da862b83489 | 555 | ipynb | Jupyter Notebook | docs/presentations/working_with_event_data/Untitled.ipynb | pratikthanki/kloppy | ab3293e03f958720489cd2d9e25a1c9f12b9970c | [
"BSD-3-Clause"
]
| 176 | 2020-04-24T09:12:05.000Z | 2022-03-27T07:03:44.000Z | docs/presentations/working_with_event_data/Untitled.ipynb | pratikthanki/kloppy | ab3293e03f958720489cd2d9e25a1c9f12b9970c | [
"BSD-3-Clause"
]
| 95 | 2020-04-24T18:37:36.000Z | 2022-03-23T21:59:10.000Z | notebooks/sample-steps-notebook.ipynb | AWS-EDU/aws-edu-question-reader | f372a7233f13a14fa375590ca411601028aa7a24 | [
"MIT"
]
| 39 | 2020-05-08T21:45:26.000Z | 2022-03-19T09:29:41.000Z | 16.818182 | 34 | 0.526126 | []
| []
| []
|
cb6d0222c287e45591557f950c613183120d0488 | 286,386 | ipynb | Jupyter Notebook | Preprocessing/Preprocessing.ipynb | rsrahul1000/Diabetic-Retinopathy-Detection | 2f6e67b1d463c28b40f2cc71313d630b7eccd5aa | [
"MIT"
]
| null | null | null | Preprocessing/Preprocessing.ipynb | rsrahul1000/Diabetic-Retinopathy-Detection | 2f6e67b1d463c28b40f2cc71313d630b7eccd5aa | [
"MIT"
]
| null | null | null | Preprocessing/Preprocessing.ipynb | rsrahul1000/Diabetic-Retinopathy-Detection | 2f6e67b1d463c28b40f2cc71313d630b7eccd5aa | [
"MIT"
]
| null | null | null | 623.934641 | 147,868 | 0.946432 | [
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\nimport cv2\nimport pandas as pd\nimport matplotlib.image as mpimg\nimport pylab as pl\n%matplotlib inline",
"_____no_output_____"
],
[
"image = cv2.imread('train_images/0a4e1a29ffff.png') # 000c1434d8d7 0a4e1a29ffff 7b87b0015282",
"_____no_output_____"
],
[
"#imgplot = plt.imshow(image)\nimgplot = plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))",
"_____no_output_____"
],
[
"img_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n\nimg_gray_blur = cv2.GaussianBlur(img_gray, (5,5), 0)\n\ncanny_edges = cv2.Canny(img_gray_blur, 15, 35) #Vary the parameter for different results\n\nret, mask = cv2.threshold(canny_edges, 70, 255, cv2.THRESH_BINARY)\n\nimgplot = plt.imshow(mask,cmap='binary',filternorm=1,filterrad=4.0)\n#imgplot = plt.imshow(cv2.cvtColor(mask, cv2.COLOR_BGR2RGB))",
"_____no_output_____"
],
[
"import numpy as np\nimport cv2\nimport matplotlib.pyplot as plt\nimport sys\n \ndef build_filters():\n filters = []\n ksize = 31\n for theta in np.arange(0, np.pi, np.pi / 16):\n kern = cv2.getGaborKernel((ksize, ksize), 4.0, theta, 10.0, 0.5, 0, ktype=cv2.CV_32F)\n kern /= 1.5*kern.sum()\n filters.append(kern)\n return filters\n \ndef process(img, filters):\n accum = np.zeros_like(img)\n for kern in filters:\n fimg = cv2.filter2D(img, cv2.CV_8UC3, kern)\n np.maximum(accum, fimg, accum)\n return accum\n \n\nimg_fn = 'train_images/0a4e1a29ffff.png' #000c1434d8d7 7b87b0015282 0c917c372572\n\nimg = cv2.imread(img_fn)\nif img is None:\n print ('Failed to load image file:', img_fn)\n sys.exit(1)\n\nfilters = build_filters()\n\n#img_converted_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\nimga = cv2.resize(img, (960, 960)) \ncv2.imshow('original', imga)\n#plt.imshow(img)\n#plt.show()\n\nres1 = process(img, filters)\nresa = cv2.resize(res1, (960, 960)) \ncv2.imshow('result', resa)\n#plt.imshow(res1)\n#plt.show()\n\nimg_gray = cv2.cvtColor(res1, cv2.COLOR_BGR2GRAY)\nimg_gray_blur = cv2.GaussianBlur(img_gray, (5,5), 0)\ncanny_edges = cv2.Canny(img_gray_blur, 15, 25) #change this parameter for ifferent results\nret, mask = cv2.threshold(canny_edges, 70, 255, cv2.THRESH_BINARY_INV)\n\nmaska = cv2.resize(mask, (960, 960)) \ncv2.imshow('Mask', maska)\n#plt.imshow(mask,cmap='plasma')\n#plt.show()\n\n\ncv2.waitKey(0)\ncv2.destroyAllWindows()\nfor _ in range(0,10):\n cv2.waitKey(1)\n",
"_____no_output_____"
],
[
"image.reshape(-1,1050,1050)\nlen(image)",
"_____no_output_____"
],
[
"#Intensity Thresholding ==> desnt work properly for now\nimport cv2\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nimage = cv2.imread('train_images/0c917c372572.png')\ngray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)\nret, thresh = cv2.threshold(gray,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)\n\ncv2.namedWindow(\"image\", cv2.WINDOW_AUTOSIZE);\ncv2.imshow('image', thresh)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\nfor _ in range(0,10):\n cv2.waitKey(1)",
"_____no_output_____"
],
[
"#thresholding try 2\nimport cv2\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nmax_value = 255\nmax_type = 4\nmax_binary_value = 255\ntrackbar_type = 'Type: \\n 0: Binary \\n 1: Binary Inverted \\n 2: Truncate \\n 3: To Zero \\n 4: To Zero Inverted'\ntrackbar_value = 'Value'\nwindow_name = 'Threshold Demo'\n \nsrc = cv2.imread('train_images/0a38b552372d.png') #3b73a3a4a734 0c917c372572 0a38b552372d 0a4e1a29ffff\n#convert to gray\nsrc_gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)\n# Create a window to display results\ncv2.namedWindow(window_name)\n\ndef Threshold_Demo(val):\n #0: Binary\n #1: Binary Inverted\n #2: Threshold Truncated\n #3: Threshold to Zero\n #4: Threshold to Zero Inverted\n threshold_type = cv2.getTrackbarPos(trackbar_type, window_name)\n threshold_value = cv2.getTrackbarPos(trackbar_value, window_name)\n _, dst = cv2.threshold(src_gray, threshold_value, max_binary_value, threshold_type )\n dst = cv2.resize(dst, (800, 750)) \n cv2.imshow(window_name, dst)\n \n# Create Trackbar to choose type of Threshold\ncv2.createTrackbar(trackbar_type, window_name , 3, max_type, Threshold_Demo)\n# Create Trackbar to choose Threshold value\ncv2.createTrackbar(trackbar_value, window_name , 0, max_value, Threshold_Demo)\n \n# Call the function to initialize\nThreshold_Demo(0)\n# Wait until user finishes program\ncv2.waitKey(0)\ncv2.destroyAllWindows()\nfor _ in range(0,10):\n cv2.waitKey(1)",
"_____no_output_____"
],
[
"cv2.imshow(\"1\",mask)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n#for _ in range(0,10):\n# cv2.waitKey(1)",
"_____no_output_____"
],
[
"import matplotlib.image as mpimg\nimg=mpimg.imread('train_images/000c1434d8d7.png')\nimgplot = plt.imshow(img)\nplt.show()",
"_____no_output_____"
],
[
"train = pd.read_csv('train.csv')",
"_____no_output_____"
],
[
"train.head(10)",
"_____no_output_____"
],
[
"from keras import backend as K\nK.tensorflow_backend._get_available_gpus()",
"Using TensorFlow backend.\n"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6d123b8f07320fe5494ea7728e035a91ce2d48 | 339,452 | ipynb | Jupyter Notebook | TopicNotes/ComputerVision/.ipynb_checkpoints/HoughLines-checkpoint.ipynb | D-K-E/ai-notes | d420f29ad1a6ba880f77bd14192ed4922d0bbbee | [
"MIT"
]
| null | null | null | TopicNotes/ComputerVision/.ipynb_checkpoints/HoughLines-checkpoint.ipynb | D-K-E/ai-notes | d420f29ad1a6ba880f77bd14192ed4922d0bbbee | [
"MIT"
]
| null | null | null | TopicNotes/ComputerVision/.ipynb_checkpoints/HoughLines-checkpoint.ipynb | D-K-E/ai-notes | d420f29ad1a6ba880f77bd14192ed4922d0bbbee | [
"MIT"
]
| null | null | null | 1,616.438095 | 161,336 | 0.96003 | [
[
[
"# packages\nimport numpy as np\nimport cv2\nimport matplotlib.pyplot as plt\n%matplotlib inline",
"_____no_output_____"
],
[
"# read the image\nimg_n = cv2.imread(\"images/linesNoter.jpg\")\nimg_h = cv2.imread(\"images/linel.png\")\n\nimage1 = np.copy(img_n)\nimage2 = np.copy(img_h)\n\nimage1 = cv2.cvtColor(image1, cv2.COLOR_BGR2RGB)\nimage2 = cv2.cvtColor(image2, cv2.COLOR_BGR2RGB)\n\nfig, (ax1, ax2) = plt.subplots(1,2, figsize=(10,20))\n\nax1.imshow(image1)\nax2.imshow(image2)\n",
"_____no_output_____"
],
[
"# perform edge detection\nimage1_g = cv2.cvtColor(image1, cv2.COLOR_RGB2GRAY)\nimage2_g = cv2.cvtColor(image2, cv2.COLOR_RGB2GRAY)\n\n# define trashold for the images\n\n# image1\nlow1 = 250\nhigh1 = 254\n\n# image2\nlow2 = 50\nhigh2 = 254\n\n# Apply canny to both images\n\nedges1 = cv2.Canny(image1_g, low1, high1)\nedges2 = cv2.Canny(image2_g, low2, high2)\n\n\nfig, (ax1, ax2) = plt.subplots(1,2, figsize=(10,20))\n\nax1.imshow(edges1, cmap='gray')\nax2.imshow(edges2, cmap='gray')\n",
"_____no_output_____"
],
[
"# Define the Hough transform parameters\nrho = 20\ntheta = np.pi/180\nthreshold = 80\nmin_line_length = 200\nmax_line_gap = 20\n\n# Find lines with hough transform\nlines1 = cv2.HoughLinesP(edges1, rho, theta, \n threshold, np.array([]),\n min_line_length, max_line_gap\n )\n#\nlines2 = cv2.HoughLinesP(edges2, rho, theta, \n threshold, np.array([]),\n min_line_length, max_line_gap\n )\n#\nline_image1 = np.copy(image1)\nline_image2 = np.copy(image2)\n\nfor line in lines1:\n for x1,y1,x2,y2 in line:\n cv2.line(line_image1, \n (x1,y1), \n (x2,y2), \n (255,0,0),5)\n \nfor line in lines2:\n for x1,y1,x2,y2 in line:\n cv2.line(line_image2, \n (x1,y1), \n (x2,y2), \n (255,0,0),5)\n\nfig, (ax1, ax2) = plt.subplots(1,2, figsize=(10,20))\n\nax1.imshow(line_image1, cmap='gray')\nax2.imshow(line_image2, cmap='gray')\n",
"_____no_output_____"
]
]
]
| [
"code"
]
| [
[
"code",
"code",
"code",
"code"
]
]
|
cb6d1b734dc2c2ac71e86ffff94473e02db443da | 657,413 | ipynb | Jupyter Notebook | Arvato Project Workbook.ipynb | deevesh/Udacity_Captone_Project | 32e37c273c386f46418a5a113c4644b22011de13 | [
"FTL",
"RSA-MD"
]
| null | null | null | Arvato Project Workbook.ipynb | deevesh/Udacity_Captone_Project | 32e37c273c386f46418a5a113c4644b22011de13 | [
"FTL",
"RSA-MD"
]
| null | null | null | Arvato Project Workbook.ipynb | deevesh/Udacity_Captone_Project | 32e37c273c386f46418a5a113c4644b22011de13 | [
"FTL",
"RSA-MD"
]
| null | null | null | 61.798552 | 187,260 | 0.604442 | [
[
[
"# Capstone Project: Create a Customer Segmentation Report for Arvato Financial Services\n\nIn this project, you will analyze demographics data for customers of a mail-order sales company in Germany, comparing it against demographics information for the general population. You'll use unsupervised learning techniques to perform customer segmentation, identifying the parts of the population that best describe the core customer base of the company. Then, you'll apply what you've learned on a third dataset with demographics information for targets of a marketing campaign for the company, and use a model to predict which individuals are most likely to convert into becoming customers for the company. The data that you will use has been provided by our partners at Bertelsmann Arvato Analytics, and represents a real-life data science task.\n\nIf you completed the first term of this program, you will be familiar with the first part of this project, from the unsupervised learning project. The versions of those two datasets used in this project will include many more features and has not been pre-cleaned. You are also free to choose whatever approach you'd like to analyzing the data rather than follow pre-determined steps. In your work on this project, make sure that you carefully document your steps and decisions, since your main deliverable for this project will be a blog post reporting your findings.",
"_____no_output_____"
]
],
[
[
"# importing libraries\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport pprint\nimport operator\nimport time\nimport ast\n\nfrom sklearn.preprocessing import Imputer\nfrom sklearn.cluster import KMeans\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.decomposition import PCA \nfrom sklearn.preprocessing import LabelEncoder\n\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.ensemble import AdaBoostClassifier\nfrom sklearn.ensemble import GradientBoostingClassifier\nfrom sklearn.ensemble import BaggingClassifier\nfrom sklearn.pipeline import Pipeline\n\n\n# magic word for producing visualizations in notebook\n%matplotlib inline",
"_____no_output_____"
]
],
[
[
"## Part 0: Get to Know the Data\n\nThere are four data files associated with this project:\n\n- `Udacity_AZDIAS_052018.csv`: Demographics data for the general population of Germany; 891 211 persons (rows) x 366 features (columns).\n- `Udacity_CUSTOMERS_052018.csv`: Demographics data for customers of a mail-order company; 191 652 persons (rows) x 369 features (columns).\n- `Udacity_MAILOUT_052018_TRAIN.csv`: Demographics data for individuals who were targets of a marketing campaign; 42 982 persons (rows) x 367 (columns).\n- `Udacity_MAILOUT_052018_TEST.csv`: Demographics data for individuals who were targets of a marketing campaign; 42 833 persons (rows) x 366 (columns).\n\nEach row of the demographics files represents a single person, but also includes information outside of individuals, including information about their household, building, and neighborhood. Use the information from the first two files to figure out how customers (\"CUSTOMERS\") are similar to or differ from the general population at large (\"AZDIAS\"), then use your analysis to make predictions on the other two files (\"MAILOUT\"), predicting which recipients are most likely to become a customer for the mail-order company.\n\nThe \"CUSTOMERS\" file contains three extra columns ('CUSTOMER_GROUP', 'ONLINE_PURCHASE', and 'PRODUCT_GROUP'), which provide broad information about the customers depicted in the file. The original \"MAILOUT\" file included one additional column, \"RESPONSE\", which indicated whether or not each recipient became a customer of the company. For the \"TRAIN\" subset, this column has been retained, but in the \"TEST\" subset it has been removed; it is against that withheld column that your final predictions will be assessed in the Kaggle competition.\n\nOtherwise, all of the remaining columns are the same between the three data files. For more information about the columns depicted in the files, you can refer to two Excel spreadsheets provided in the workspace. [One of them](./DIAS Information Levels - Attributes 2017.xlsx) is a top-level list of attributes and descriptions, organized by informational category. [The other](./DIAS Attributes - Values 2017.xlsx) is a detailed mapping of data values for each feature in alphabetical order.\n\nIn the below cell, we've provided some initial code to load in the first two datasets. Note for all of the `.csv` data files in this project that they're semicolon (`;`) delimited, so an additional argument in the [`read_csv()`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html) call has been included to read in the data properly. Also, considering the size of the datasets, it may take some time for them to load completely.\n\nYou'll notice when the data is loaded in that a warning message will immediately pop up. Before you really start digging into the modeling and analysis, you're going to need to perform some cleaning. Take some time to browse the structure of the data and look over the informational spreadsheets to understand the data values. Make some decisions on which features to keep, which features to drop, and if any revisions need to be made on data formats. It'll be a good idea to create a function with pre-processing steps, since you'll need to clean all of the datasets before you work with them.",
"_____no_output_____"
]
],
[
[
"start = time.time()\n\n# load in the data\nazdias = pd.read_csv('../../data/Term2/capstone/arvato_data/Udacity_AZDIAS_052018.csv', sep=';')\n#customers = pd.read_csv('../../data/Term2/capstone/arvato_data/Udacity_CUSTOMERS_052018.csv', sep=';')\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"/opt/conda/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2785: DtypeWarning: Columns (18,19) have mixed types. Specify dtype option on import or set low_memory=False.\n interactivity=interactivity, compiler=compiler, result=result)\n"
],
[
"# Be sure to add in a lot more cells (both markdown and code) to document your\n# approach and findings!",
"_____no_output_____"
],
[
"# Check the structure of the data after it's loaded (e.g. print the number of\n# rows and columns, print the first few rows).\nprint(azdias.shape)",
"(891221, 366)\n"
],
[
"# print the first 10 rows of the dataset\nazdias.head(10)",
"_____no_output_____"
],
[
"azdias['ALTERSKATEGORIE_GROB'].describe()",
"_____no_output_____"
],
[
"azdias['ALTERSKATEGORIE_GROB'].median()",
"_____no_output_____"
],
[
"azdias['ALTERSKATEGORIE_GROB'].describe(percentiles=[0.80])",
"_____no_output_____"
],
[
"# replacing values for CAMEO_DEUG_2015\nazdias['CAMEO_DEUG_2015'] = azdias['CAMEO_DEUG_2015'].replace('X',-1)",
"_____no_output_____"
],
[
"azdias['CAMEO_DEUG_2015'].describe()",
"_____no_output_____"
],
[
"azdias['CAMEO_DEUG_2015'].median()",
"_____no_output_____"
],
[
"azdias['HH_EINKOMMEN_SCORE'].describe()",
"_____no_output_____"
],
[
"azdias['HH_EINKOMMEN_SCORE'].median()",
"_____no_output_____"
],
[
"# read the attributes details of the dataset \nfeat_info = pd.read_excel('DIAS Attributes - Values 2017.xlsx')\ndel feat_info['Unnamed: 0']\nfeat_info.head(15)",
"_____no_output_____"
],
[
"# Fill the attribute column where the values are NaNs using ffill\nfeat_info_attribute = feat_info['Attribute'].fillna(method='ffill')\nfeat_info['Attribute'] = feat_info_attribute\nfeat_info.head(10)",
"_____no_output_____"
],
[
"# Get the encoded values that are actually missing or unknown values \n# Subset the meaning column to contain only those values using \"unknown\" or \"no \" terms \nfeat_info = feat_info[(feat_info['Meaning'].str.contains(\"unknown\") | feat_info['Meaning'].str.contains(\"no \"))]\npd.set_option('display.max_rows', 500)\nfeat_info\n",
"_____no_output_____"
],
[
"# Convert to a list of strings\nfeat_info.loc[feat_info['Attribute'] == 'AGER_TYP', 'Value'].astype(str).str.cat(sep=',').split(',')",
"_____no_output_____"
],
[
"# Because both of the first 2 rows of feat_info belong to the same attribute, combine the values \n# for each row into a single list of strings\n\nunknowns = []\nfor attribute in feat_info['Attribute'].unique():\n _ = feat_info.loc[feat_info['Attribute'] == attribute, 'Value'].astype(str).str.cat(sep=',')\n _ = _.split(',')\n unknowns.append(_)\n \nunknowns = pd.concat([pd.Series(feat_info['Attribute'].unique()), pd.Series(unknowns)], axis=1)\nunknowns.columns = ['attribute', 'missing_or_unknown']",
"_____no_output_____"
],
[
"feat_info = unknowns\nfeat_info",
"_____no_output_____"
],
[
"start = time.time()\n\n# Converting the missing values to Nans in the dataset\nmissing_values = pd.Series(feat_info['missing_or_unknown'].values, index=feat_info.index).to_dict()\nazdias[azdias.isin(missing_values)] = np.nan\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Total execution time: 451.64 seconds\n"
],
[
"azdias.shape",
"_____no_output_____"
],
[
"#azdias.head(10)",
"_____no_output_____"
],
[
"start = time.time()\n\n# Checking how much missing data there is in each column of the dataset.\nmissing_col = azdias.isnull().sum()\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Total execution time: 110.18 seconds\n"
],
[
"# Investigate patterns in the amount of missing data in each column.\nplt.hist(missing_col, bins=15, facecolor='b', alpha=1)\nplt.xlabel('Count of missing values in column')\nplt.ylabel('Number of columns')\nplt.title('Histogram for the count of missing values in columns')\nplt.grid(True)\nplt.show()",
"_____no_output_____"
],
[
"missing_columns = missing_col[missing_col>0]\nmissing_columns.sort_values(inplace=True)\nmissing_columns.plot.bar(figsize=(20,15), facecolor='b')\nplt.xlabel('Column name with missing values')\nplt.ylabel('Number of missing values')\nplt.grid(True)\nplt.title('Column Name vs missing values')\nplt.show()",
"_____no_output_____"
],
[
"start = time.time()\n\n# This operation is to remove the outlier columns from the dataset. \n\n # identify the columns having more than 20K missing values\nmissing_col_updated = missing_col[missing_col>200000]\n\n# dropping those columns from the data set\nazdias.drop(missing_col_updated.index, axis=1, inplace=True) \n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Total execution time: 71.32 seconds\n"
],
[
"# listing the dropped columns\nprint(missing_col_updated)",
"ALTER_KIND1 810163\nALTER_KIND2 861722\nALTER_KIND3 885051\nALTER_KIND4 890016\nALTERSKATEGORIE_FEIN 262947\nD19_BANKEN_ONLINE_QUOTE_12 257113\nD19_GESAMT_ONLINE_QUOTE_12 257113\nD19_KONSUMTYP 257113\nD19_LETZTER_KAUF_BRANCHE 257113\nD19_LOTTO 257113\nD19_SOZIALES 257113\nD19_TELKO_ONLINE_QUOTE_12 257113\nD19_VERSAND_ONLINE_QUOTE_12 257113\nD19_VERSI_ONLINE_QUOTE_12 257113\nEXTSEL992 654153\nKK_KUNDENTYP 584612\ndtype: int64\n"
],
[
"azdias.shape",
"_____no_output_____"
],
[
"start = time.time()\n\n# Separate the data into two subsets based on the number of missing # values in each row.\n# Keep the the rows having less than 20 missing values for the analyis \nn_missing = azdias.isnull().transpose().sum()\nazdias_missing_low = azdias[n_missing<20] # rows having less than 20 missing values \n#azdias_missing_high = azdias[n_missing>=20]; # rows having more or equal to 20 missing values \nn_missing_low = azdias_missing_low.isnull().transpose().sum()\n#n_missing_high = azdias_missing_high.isnull().transpose().sum()\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Total execution time: 130.19 seconds\n"
],
[
"# check the count for remaining number of rows \nazdias_missing_low.shape",
"_____no_output_____"
],
[
"# The only binary categorical variable that does not take integer values is OST_WEST_KZ which uses either W or O\n# Re-encoding with 1 and 0. \n\nazdias_missing_low['OST_WEST_KZ'].replace(['W', 'O'], [1, 0], inplace=True)\nazdias_missing_low['OST_WEST_KZ'].head()",
"/opt/conda/lib/python3.6/site-packages/pandas/core/generic.py:5890: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame\n\nSee the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n self._update_inplace(new_data)\n"
],
[
"# For columns > 10 different values, drop for # simplicity. \ncat_cols_to_drop = ['CAMEO_DEU_2015', 'GFK_URLAUBERTYP', 'LP_FAMILIE_FEIN', 'LP_LEBENSPHASE_FEIN', \n 'LP_LEBENSPHASE_GROB', 'LP_STATUS_FEIN', 'PRAEGENDE_JUGENDJAHRE','EINGEFUEGT_AM']\n\n# For columns < 10 levels, re-encode using dummy variables.\ncat_cols_to_dummy = ['CJT_GESAMTTYP', 'FINANZTYP', 'GEBAEUDETYP', 'GEBAEUDETYP_RASTER', 'HEALTH_TYP', \n 'KBA05_HERSTTEMP', 'KBA05_MAXHERST', 'KBA05_MODTEMP', 'LP_FAMILIE_GROB', 'LP_STATUS_GROB',\n 'NATIONALITAET_KZ', 'SHOPPER_TYP', 'VERS_TYP']",
"_____no_output_____"
],
[
"start = time.time()\n\n# Dropping the categorical columns \nazdias_missing_low.drop(cat_cols_to_drop, axis=1, inplace = True)\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Total execution time: 97.84 seconds\n"
],
[
"start = time.time()\n\n# Creating dummy variables for columns with less than 10 categories unique values \n# then drop the original columns\n\n\nfor col in cat_cols_to_dummy:\n dummy = pd.get_dummies(azdias_missing_low[col], prefix = col)\n azdias_missing_low = pd.concat([azdias_missing_low, dummy], axis = 1)\n\nprint(\"Dropping the dummied columns\")\nazdias_missing_low.drop(cat_cols_to_dummy, axis=1, inplace = True)\n\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))\n",
"Dropping the dummied columns\nTotal execution time: 1408.53 seconds\n"
],
[
"print(azdias_missing_low.shape)",
"(746902, 398)\n"
],
[
"# replacing values for CAMEO_INTL_2015\nazdias_missing_low['CAMEO_INTL_2015'] = azdias_missing_low['CAMEO_INTL_2015'].replace('XX',-1)",
"_____no_output_____"
],
[
"# replacing values for CAMEO_DEUG_2015\nazdias_missing_low['CAMEO_DEUG_2015'] = azdias_missing_low['CAMEO_DEUG_2015'].replace('X',-1)",
"_____no_output_____"
],
[
"# Create a cleaning function so the same changes can be done on the customer dataset as it was on the\n# general population dataset. \n\ndef clean_data(azdias, feat_info):\n \"\"\"\n \n INPUT: \n azdias: Population/Customer demographics DataFrame\n feat_info: feat info DataFrame\n OUTPUT: Trimmed and cleaned demographics DataFrame\n \"\"\"\n \n # Convert missing values to Nans\n print(\"Convert missing values\")\n missing_values = pd.Series(feat_info['missing_or_unknown'].values, index=feat_info.index).to_dict()\n azdias[azdias.isin(missing_values)] = np.nan\n\n missing_col = azdias.isnull().sum()\n\n print(\"dropping missing_col_updated\")\n\n # Remove the outlier columns from the dataset\n missing_col_updated = missing_col[missing_col>200000] #taking out the columns having more than 20K missing values\n azdias.drop(missing_col_updated.index, axis=1, inplace=True) # dropping those columns from the data set\n \n n_missing = azdias.isnull().transpose().sum()\n azdias_missing_low = azdias[n_missing<20] # rows having less than 20 missing values \n n_missing_low = azdias_missing_low.isnull().transpose().sum()\n \n # The only binary categorical variable that does not take integer values is OST_WEST_KZ which uses either W or O\n\n print(\"replacing values for OST_WEST_KZ\")\n\n azdias_missing_low['OST_WEST_KZ'].replace(['W', 'O'], [1, 0], inplace=True)\n azdias_missing_low['OST_WEST_KZ'].head()\n \n # For columns > 10 different values, drop for # simplicity. \n # For columns < 10 levels, re-encode using dummy variables.\n \n cat_cols_to_drop = ['CAMEO_DEU_2015', 'GFK_URLAUBERTYP', 'LP_FAMILIE_FEIN', 'LP_LEBENSPHASE_FEIN', \n 'LP_LEBENSPHASE_GROB', 'LP_STATUS_FEIN', 'PRAEGENDE_JUGENDJAHRE','EINGEFUEGT_AM']\n\n cat_cols_to_dummy = ['CJT_GESAMTTYP', 'FINANZTYP', 'GEBAEUDETYP', 'GEBAEUDETYP_RASTER', 'HEALTH_TYP', \n 'KBA05_HERSTTEMP', 'KBA05_MAXHERST', 'KBA05_MODTEMP', 'LP_FAMILIE_GROB', 'LP_STATUS_GROB',\n 'NATIONALITAET_KZ', 'SHOPPER_TYP', 'VERS_TYP']\n \n \n print(\"Dropping categorical columns with 10 or more values\")\n # Drop categorical columns with 10 or more values\n azdias_missing_low.drop(cat_cols_to_drop, axis=1, inplace = True)\n \n \n for col in cat_cols_to_dummy:\n dummy = pd.get_dummies(azdias_missing_low[col], prefix = col)\n azdias_missing_low = pd.concat([azdias_missing_low, dummy], axis = 1)\n\n print(\"Dropping dummies\")\n azdias_missing_low.drop(cat_cols_to_dummy, axis=1, inplace = True)\n \n # replacing values for CAMEO_INTL_2015\n azdias_missing_low['CAMEO_INTL_2015'] = azdias_missing_low['CAMEO_INTL_2015'].replace('XX',-1)\n \n # replacing values for CAMEO_DEUG_2015\n azdias_missing_low['CAMEO_DEUG_2015'] = azdias_missing_low['CAMEO_DEUG_2015'].replace('X',-1)\n \n \n # Return the cleaned dataframe.\n return azdias_missing_low\n",
"_____no_output_____"
],
[
"azdias_missing_low.head(10)",
"_____no_output_____"
],
[
"start = time.time()\n\nazdias_missing_low=azdias_missing_low.fillna(0)\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Total execution time: 23.27 seconds\n"
],
[
"scaler = StandardScaler()",
"_____no_output_____"
],
[
"# Apply feature scaling to the population data.\nstart = time.time()\n\nazdias_missing_low = pd.DataFrame(scaler.fit_transform(azdias_missing_low), columns = azdias_missing_low.columns)\n\nend = time.time()\nprint(\"Total execution time: {:.2f} seconds\".format(end-start))",
"_____no_output_____"
]
],
[
[
"## Part 1: Customer Segmentation Report\n\nThe main bulk of your analysis will come in this part of the project. Here, you should use unsupervised learning techniques to describe the relationship between the demographics of the company's existing customers and the general population of Germany. By the end of this part, you should be able to describe parts of the general population that are more likely to be part of the mail-order company's main customer base, and which parts of the general population are less so.",
"_____no_output_____"
]
],
[
[
"customers = pd.read_csv('../../data/Term2/capstone/arvato_data/Udacity_CUSTOMERS_052018.csv', sep=';')",
"/opt/conda/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2785: DtypeWarning: Columns (18,19) have mixed types. Specify dtype option on import or set low_memory=False.\n interactivity=interactivity, compiler=compiler, result=result)\n"
],
[
"customers.shape",
"_____no_output_____"
],
[
"customers.head(10)",
"_____no_output_____"
],
[
"start = time.time()\n\n# Run the clean_data function on the population dataset\ncustomers = clean_data(customers, feat_info)\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))\n",
"Convert missing values\ndropping missing_col_updated\nreplacing values for OST_WEST_KZ\n"
],
[
"customers.shape",
"_____no_output_____"
],
[
"start = time.time()\n\ncustomers=customers.fillna(0)\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Total execution time: 0.53 seconds\n"
],
[
"# Drop the extra columns of customers dataset.\ncustomers.drop(columns=['CUSTOMER_GROUP', 'ONLINE_PURCHASE', 'PRODUCT_GROUP'], inplace=True)",
"_____no_output_____"
],
[
"cols_to_drop = ['AGER_TYP', 'ALTER_HH', 'ALTER_KIND1', 'ALTER_KIND2', 'ALTER_KIND3',\n 'ALTER_KIND4', 'ALTERSKATEGORIE_FEIN', 'D19_BANKEN_ANZ_12',\n 'D19_BANKEN_ANZ_24', 'D19_BANKEN_DATUM', 'D19_BANKEN_OFFLINE_DATUM',\n 'D19_BANKEN_ONLINE_DATUM', 'D19_BANKEN_ONLINE_QUOTE_12',\n 'D19_GESAMT_ANZ_12', 'D19_GESAMT_ANZ_24', 'D19_GESAMT_DATUM',\n 'D19_GESAMT_OFFLINE_DATUM', 'D19_GESAMT_ONLINE_DATUM',\n 'D19_GESAMT_ONLINE_QUOTE_12', 'D19_KONSUMTYP',\n 'D19_LETZTER_KAUF_BRANCHE', 'D19_LOTTO', 'D19_SOZIALES',\n 'D19_TELKO_ANZ_12', 'D19_TELKO_ANZ_24', 'D19_TELKO_DATUM',\n 'D19_TELKO_OFFLINE_DATUM', 'D19_TELKO_ONLINE_DATUM',\n 'D19_TELKO_ONLINE_QUOTE_12', 'D19_VERSAND_ANZ_12', 'D19_VERSAND_ANZ_24',\n 'D19_VERSAND_DATUM', 'D19_VERSAND_OFFLINE_DATUM',\n 'D19_VERSAND_ONLINE_DATUM', 'D19_VERSAND_ONLINE_QUOTE_12',\n 'D19_VERSI_ANZ_12', 'D19_VERSI_ANZ_24', 'D19_VERSI_ONLINE_QUOTE_12',\n 'EXTSEL992', 'KBA05_ANTG1', 'KBA05_ANTG2', 'KBA05_ANTG3', 'KBA05_ANTG4',\n 'KBA05_BAUMAX', 'KBA05_MAXVORB', 'KK_KUNDENTYP', 'TITEL_KZ']\n\ncustomers.drop(cols_to_drop, axis=1, inplace = True)",
"_____no_output_____"
],
[
"customers.shape",
"_____no_output_____"
],
[
"# Apply feature scaling to the population data.\nstart = time.time()\n\ncustomers = pd.DataFrame(scaler.fit_transform(customers), columns = customers.columns)\n\nend = time.time()\nprint(\"Total execution time: {:.2f} seconds\".format(end-start))",
"Total execution time: 13.63 seconds\n"
],
[
"customers.head(10)",
"_____no_output_____"
],
[
"# Apply PCA to the population data.\nstart = time.time()\n\npca = PCA()\ncustomers = pca.fit_transform(customers)\n\nend = time.time()\nprint(\"Total execution time: {:.2f} seconds\".format(end-start))",
"Total execution time: 14.74 seconds\n"
],
[
"# Investigate the variance accounted for by each principal component.\nn_components = min(np.where(np.cumsum(pca.explained_variance_ratio_)>0.8)[0]+1) # 80% of variance selected\n\nfig = plt.figure()\nax = fig.add_axes([0,0,1,1],True)\nax2 = ax.twinx()\nax.plot(pca.explained_variance_ratio_, label='Variance',)\nax2.plot(np.cumsum(pca.explained_variance_ratio_), label='Cumulative Variance',color = 'red');\nax.set_title('n_components needed for >%80 explained variance: {}'.format(n_components));\nax.axvline(n_components, linestyle='dashed', color='black')\nax2.axhline(np.cumsum(pca.explained_variance_ratio_)[n_components], linestyle='dashed', color='black')\nfig.legend(loc=(0.8,0.2));",
"_____no_output_____"
],
[
"# Re-apply PCA to the data while selecting for number of components to retain.\nstart = time.time()\n\npca = PCA(n_components=60, random_state=10)\nazdias_pca = pca.fit_transform(customers)\n\nend = time.time()\nprint(\"Total execution time of this procedure: {:.2f} seconds\".format(end-start))",
"Total execution time of this procedure: 11.04 seconds\n"
],
[
"# check the sum of the explained variance\npca.explained_variance_ratio_.sum()",
"_____no_output_____"
],
[
"def plot_pca(data, pca, n_components):\n '''\n\tPlot the features with the most absolute variance for given pca component \n\t'''\n compo = pd.DataFrame(np.round(pca.components_, 4), columns = data.keys()).iloc[n_components-1]\n compo.sort_values(ascending=False, inplace=True)\n compo = pd.concat([compo.head(5), compo.tail(5)])\n \n compo.plot(kind='bar', title='Component ' + str(n_components))\n ax = plt.gca()\n ax.grid(linewidth='0.5', alpha=0.5)\n ax.set_axisbelow(True)\n plt.show()",
"_____no_output_____"
],
[
"# plot_pca(customers, pca, 2)",
"_____no_output_____"
],
[
"from sklearn.cluster import KMeans, MiniBatchKMeans\n\nstart = time.time()\n\nkmeans_scores = []\nfor i in range(2,30,2):\n\n #run k-means clustering on the data \n kmeans = MiniBatchKMeans(i)\n kmeans.fit(azdias_pca)\n \n #compute the average within-cluster distances.\n #print(i,kmeans.score(azdias_pca))\n kmeans_scores.append(-kmeans.score(azdias_pca))\n\nend = time.time()\nprint(\"Total execution time: {:.2f} seconds\".format(end-start))",
"Total execution time: 10.08 seconds\n"
],
[
"kmeans_scores",
"_____no_output_____"
],
[
"# Investigate the change in within-cluster distance across number of clusters.\n# HINT: Use matplotlib's plot function to visualize this relationship.\n\n# Plot elbow plot\nx = range(2, 30, 2)\nplt.figure(figsize=(8, 4))\nplt.plot(x, kmeans_scores, marker='o')\nplt.xticks(x)\nplt.xlabel('K')\nplt.ylabel('SSE');",
"_____no_output_____"
],
[
"# Re-fit the k-means model with the selected number of clusters (20) and obtain\n# cluster predictions for the general population demographics data.\nstart = time.time()\n\nkmeans_20 = KMeans(20, random_state=10)\nclusters_pop = kmeans_20.fit_predict(azdias_pca)\n\nend = time.time()\nprint(\"Total execution time of this procedure: {:.2f} seconds\".format(end-start))",
"Total execution time of this procedure: 115.93 seconds\n"
],
[
"#general_prop = []\ncustomers_prop = []\nx = [i+1 for i in range(20)]\nfor i in range(20):\n #general_prop.append((clusters_pop == i).sum()/len(clusters_pop))\n customers_prop.append((clusters_pop == i).sum()/len(clusters_pop))\n\n\ndf_general = pd.DataFrame({'cluster' : x, 'Customers pop':customers_prop})\n\n#ax = sns.countplot(x='index', y = df_general['prop_1', 'prop_2'], data=df_general )\ndf_general.plot(x='cluster', y = ['Customers pop'], kind='bar', figsize=(9,6))\nplt.ylabel('proportion of persons in each cluster')\nplt.show()",
"_____no_output_____"
]
],
[
[
"## Part 2: Supervised Learning Model\n\nNow that you've found which parts of the population are more likely to be customers of the mail-order company, it's time to build a prediction model. Each of the rows in the \"MAILOUT\" data files represents an individual that was targeted for a mailout campaign. Ideally, we should be able to use the demographic information from each individual to decide whether or not it will be worth it to include that person in the campaign.\n\nThe \"MAILOUT\" data has been split into two approximately equal parts, each with almost 43 000 data rows. In this part, you can verify your model with the \"TRAIN\" partition, which includes a column, \"RESPONSE\", that states whether or not a person became a customer of the company following the campaign. In the next part, you'll need to create predictions on the \"TEST\" partition, where the \"RESPONSE\" column has been withheld.",
"_____no_output_____"
]
],
[
[
"mailout_train = pd.read_csv('../../data/Term2/capstone/arvato_data/Udacity_MAILOUT_052018_TRAIN.csv', sep=';')",
"/opt/conda/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2785: DtypeWarning: Columns (18,19) have mixed types. Specify dtype option on import or set low_memory=False.\n interactivity=interactivity, compiler=compiler, result=result)\n"
],
[
"mailout_train.info()",
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 42962 entries, 0 to 42961\nColumns: 367 entries, LNR to ALTERSKATEGORIE_GROB\ndtypes: float64(267), int64(94), object(6)\nmemory usage: 120.3+ MB\n"
],
[
"mailout_train.shape",
"_____no_output_____"
],
[
"mailout_train.head()",
"_____no_output_____"
],
[
"# Imbalance of REPONSE column\nvc = mailout_train['RESPONSE'].value_counts()\nvc",
"_____no_output_____"
],
[
"# positive response\nvc[1]/(vc[0]+vc[1])",
"_____no_output_____"
],
[
"# negative response\nvc[0]/(vc[0]+vc[1])",
"_____no_output_____"
],
[
"mailout_train.head(10)",
"_____no_output_____"
],
[
"# find features to drop because of many missing values\nmissing_per_column = mailout_train.isnull().mean()",
"_____no_output_____"
],
[
"plt.hist(missing_per_column, bins=34)",
"_____no_output_____"
],
[
"start = time.time()\n\n# clean data, no splitting of rows necessary\nmailout_train = clean_data(mailout_train, feat_info)\nmailout_train.shape\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Convert missing values\ndropping missing_col_updated\nreplacing values for OST_WEST_KZ\nDropping categorical columns with 10 or more values\n"
],
[
"# this columns has data values as time\nmailout_train.drop(labels=['D19_LETZTER_KAUF_BRANCHE'], axis=1, inplace=True)",
"_____no_output_____"
],
[
"mailout_train.shape",
"_____no_output_____"
],
[
"mailout_train.head(10)",
"_____no_output_____"
],
[
"# extract RESPONSE column\nresponse = mailout_train['RESPONSE']",
"_____no_output_____"
],
[
"# drop RESPONSE column\nmailout_train.drop(labels=['RESPONSE'], axis=1, inplace=True)",
"_____no_output_____"
],
[
"# impute median and scale azdias\nimputer = Imputer(strategy='median')\nscaler = StandardScaler()",
"_____no_output_____"
],
[
"mailout_train_imputed = pd.DataFrame(imputer.fit_transform(mailout_train))\nmailout_train_scaled = scaler.fit_transform(mailout_train_imputed)\n",
"_____no_output_____"
],
[
"mailout_train_scaled.shape",
"_____no_output_____"
],
[
"response.shape",
"_____no_output_____"
]
],
[
[
"Dataset has been preprocessed for further analysis ",
"_____no_output_____"
]
],
[
[
"def classify(clf, param_grid, X_train=mailout_train_scaled, y_train=response):\n \"\"\"\n Fits a classifier to its training data and prints its ROC AUC score.\n \n INPUT:\n - clf (classifier): classifier to fit\n - param_grid (dict): classifier parameters used with GridSearchCV\n - X_train (DataFrame): training input\n - y_train (DataFrame): training output\n \n OUTPUT:\n - classifier: input classifier fitted to the training data\n \"\"\"\n \n # cv uses StratifiedKFold\n grid = GridSearchCV(estimator=clf, param_grid=param_grid, scoring='roc_auc', cv=5)\n grid.fit(X_train, y_train)\n print(grid.best_score_)\n \n return grid.best_estimator_",
"_____no_output_____"
],
[
"start = time.time()\n\n# LogisticRegression\nlogreg = LogisticRegression(random_state=12)\nclassify(logreg, {})\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"0.669752148548\nTotal execution time: 122.39 seconds\n"
],
[
"start = time.time()\n\n# BaggingClassifier\nbac = BaggingClassifier(random_state=12)\nclassify(bac, {})\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"0.586992194594\nTotal execution time: 180.17 seconds\n"
],
[
"start = time.time()\n\n# AdaBoostClassifier\nabc = AdaBoostClassifier(random_state=12)\nabc_best_est = classify(abc, {})\n\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"0.771348891187\nTotal execution time: 141.47 seconds\n"
],
[
"start = time.time()\n\n# GradientBoostingClassifier\ngbc = GradientBoostingClassifier(random_state=12)\nclassify(gbc, {})\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"0.770407792289\nTotal execution time: 672.09 seconds\n"
],
[
"# Tuning the model which gave the best result",
"_____no_output_____"
],
[
"# tune with the help of GridSearchCV\n# the result is our model that will be used with the test set\ngbc = GradientBoostingClassifier(random_state=12)\nparam_grid = {'loss': ['deviance', 'exponential'],\n 'max_depth': [2, 3],\n 'n_estimators':[80],\n 'random_state': [12]\n }\n\nstart = time.time()\n\ngbc_tuned = classify(gbc, param_grid)\ngbc_tuned\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"0.781698508941\nTotal execution time: 1516.39 seconds\n"
],
[
"# Import StratifiedKFold\nfrom sklearn.model_selection import StratifiedKFold\n\n# Initialize 5 stratified folds\nskf = StratifiedKFold(n_splits=5, random_state=12)\nskf.get_n_splits(mailout_train, response)\nprint(skf)",
"StratifiedKFold(n_splits=5, random_state=12, shuffle=False)\n"
],
[
"def create_pipeline(clf):\n \n # Create machine learning pipeline\n pipeline = Pipeline([\n ('imp', imputer),\n ('scale', scaler),\n ('clf', clf)\n ])\n \n return pipeline",
"_____no_output_____"
],
[
"def cross_validate(clf):\n\n pipeline = create_pipeline(clf)\n scores = []\n i = 0\n\n # Perform 5-fold validation\n for train_index, test_index in skf.split(mailout_train, response):\n i+=1\n print('Fold {}'.format(i))\n \n # Split the data into training and test sets\n X_train, X_test = mailout_train.iloc[train_index], mailout_train.iloc[test_index]\n y_train, y_test = response.iloc[train_index], response.iloc[test_index]\n\n # Train using the pipeline\n pipeline.fit(X_train, y_train)\n\n #Predict on the test data\n y_pred = pipeline.predict(X_test)\n\n score = roc_auc_score(y_test, y_pred)\n scores.append(score)\n print(\"Score: {}\".format(score))\n \n return scores",
"_____no_output_____"
],
[
"from sklearn.metrics import roc_auc_score\n\nstart = time.time()\n\ntuned_scores = cross_validate(gbc)\n\nend = time.time()\nelapsed = end - start\nprint(\"Total execution time: {:.2f} seconds\".format(elapsed))",
"Fold 1\nScore: 0.4995483288166215\nFold 2\nScore: 0.5054254312384393\nFold 3\nScore: 0.5\nFold 4\nScore: 0.49992471013401596\nFold 5\nScore: 0.4994729709381117\nTotal execution time: 242.16 seconds\n"
]
],
[
[
"## Part 3: Kaggle Competition\n\nNow that you've created a model to predict which individuals are most likely to respond to a mailout campaign, it's time to test that model in competition through Kaggle. If you click on the link [here](http://www.kaggle.com/t/21e6d45d4c574c7fa2d868f0e8c83140), you'll be taken to the competition page where, if you have a Kaggle account, you can enter. If you're one of the top performers, you may have the chance to be contacted by a hiring manager from Arvato or Bertelsmann for an interview!\n\nYour entry to the competition should be a CSV file with two columns. The first column should be a copy of \"LNR\", which acts as an ID number for each individual in the \"TEST\" partition. The second column, \"RESPONSE\", should be some measure of how likely each individual became a customer – this might not be a straightforward probability. As you should have found in Part 2, there is a large output class imbalance, where most individuals did not respond to the mailout. Thus, predicting individual classes and using accuracy does not seem to be an appropriate performance evaluation method. Instead, the competition will be using AUC to evaluate performance. The exact values of the \"RESPONSE\" column do not matter as much: only that the higher values try to capture as many of the actual customers as possible, early in the ROC curve sweep.",
"_____no_output_____"
]
],
[
[
"mailout_test = pd.read_csv('../../data/Term2/capstone/arvato_data/Udacity_MAILOUT_052018_TEST.csv', sep=';')",
"/opt/conda/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2785: DtypeWarning: Columns (18,19) have mixed types. Specify dtype option on import or set low_memory=False.\n interactivity=interactivity, compiler=compiler, result=result)\n"
],
[
"mailout_test.info()",
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 42833 entries, 0 to 42832\nColumns: 366 entries, LNR to ALTERSKATEGORIE_GROB\ndtypes: float64(267), int64(93), object(6)\nmemory usage: 119.6+ MB\n"
],
[
"mailout_test.head(10)",
"_____no_output_____"
],
[
"# extract lnr for later generation of the competition result file\n# lnr = mailout_test.LNR",
"_____no_output_____"
],
[
"# clean data\nmailout_test = clean_data(mailout_test, feat_info)\nmailout_test.shape",
"Convert missing values\ndropping missing_col_updated\nreplacing values for OST_WEST_KZ\nDropping categorical columns with 10 or more values\n"
],
[
"# this columns has data values as time\nmailout_test.drop(labels=['D19_LETZTER_KAUF_BRANCHE'], axis=1, inplace=True)",
"_____no_output_____"
],
[
"lnr = mailout_test.LNR",
"_____no_output_____"
],
[
"mailout_test.shape",
"_____no_output_____"
],
[
"# impute median and scale azdias \nmailout_test_imputed = pd.DataFrame(imputer.transform(mailout_test))\nmailout_test_scaled = scaler.transform(mailout_test_imputed)",
"_____no_output_____"
],
[
"# use the trained model from Part 2 to predict the probabilties of the testing data \nresponse_test = gbc_tuned.predict_proba(mailout_test_scaled)\nresponse_test",
"_____no_output_____"
],
[
"response_test.shape",
"_____no_output_____"
],
[
"# generate result file for the competition\nresult = pd.DataFrame({'LNR':lnr, 'RESPONSE':response_test[:,0]})\nresult.head(10)",
"_____no_output_____"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6d3435a2ffd2dfa2a43401cb1593eacd8cb144 | 38,703 | ipynb | Jupyter Notebook | intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb | prokokok/deep-learning-v2-pytorch | 5f04298aab7d51873b59e8720122def5673f1815 | [
"MIT"
]
| null | null | null | intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb | prokokok/deep-learning-v2-pytorch | 5f04298aab7d51873b59e8720122def5673f1815 | [
"MIT"
]
| null | null | null | intro-to-pytorch/Part 4 - Fashion-MNIST (Solution).ipynb | prokokok/deep-learning-v2-pytorch | 5f04298aab7d51873b59e8720122def5673f1815 | [
"MIT"
]
| null | null | null | 108.411765 | 24,056 | 0.849185 | [
[
[
"# Classifying Fashion-MNIST\n\nNow it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 97% accuracy. Fashion-MNIST is a set of 28x28 greyscale images of clothes. It's more complex than MNIST, so it's a better representation of the actual performance of your network, and a better representation of datasets you'll use in the real world.\n\n<img src='assets/fashion-mnist-sprite.png' width=500px>\n\nIn this notebook, you'll build your own neural network. For the most part, you could just copy and paste the code from Part 3, but you wouldn't be learning. It's important for you to write the code yourself and get it to work. Feel free to consult the previous notebooks though as you work through this.\n\nFirst off, let's load the dataset through torchvision.",
"_____no_output_____"
]
],
[
[
"import torch\nfrom torchvision import datasets, transforms\nimport helper\n\n# Define a transform to normalize the data\ntransform = transforms.Compose([transforms.ToTensor(),\n transforms.Normalize((0.5,), (0.5,))])\n# Download and load the training data\ntrainset = datasets.FashionMNIST('~/.pytorch/F_MNIST_data/', download=True, train=True, transform=transform)\ntrainloader = torch.utils.data.DataLoader(trainset, batch_size=64, shuffle=True)\n\n# Download and load the test data\ntestset = datasets.FashionMNIST('~/.pytorch/F_MNIST_data/', download=True, train=False, transform=transform)\ntestloader = torch.utils.data.DataLoader(testset, batch_size=64, shuffle=True)",
"Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz\nDownloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-labels-idx1-ubyte.gz\nDownloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-images-idx3-ubyte.gz\nDownloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-labels-idx1-ubyte.gz\nProcessing...\nDone!\n"
]
],
[
[
"Here we can see one of the images.",
"_____no_output_____"
]
],
[
[
"image, label = next(iter(trainloader))\nhelper.imshow(image[0,:]);",
"_____no_output_____"
]
],
[
[
"## Building the network\n\nHere you should define your network. As with MNIST, each image is 28x28 which is a total of 784 pixels, and there are 10 classes. You should include at least one hidden layer. We suggest you use ReLU activations for the layers and to return the logits or log-softmax from the forward pass. It's up to you how many layers you add and the size of those layers.",
"_____no_output_____"
]
],
[
[
"from torch import nn, optim\nimport torch.nn.functional as F",
"_____no_output_____"
],
[
"# TODO: Define your network architecture here\nclass Classifier(nn.Module):\n def __init__(self):\n super().__init__()\n self.fc1 = nn.Linear(784, 256)\n self.fc2 = nn.Linear(256, 128)\n self.fc3 = nn.Linear(128, 64)\n self.fc4 = nn.Linear(64, 10)\n \n def forward(self, x):\n # make sure input tensor is flattened\n x = x.view(x.shape[0], -1)\n \n x = F.relu(self.fc1(x))\n x = F.relu(self.fc2(x))\n x = F.relu(self.fc3(x))\n x = F.log_softmax(self.fc4(x), dim=1)\n \n return x",
"_____no_output_____"
]
],
[
[
"# Train the network\n\nNow you should create your network and train it. First you'll want to define [the criterion](http://pytorch.org/docs/master/nn.html#loss-functions) (something like `nn.CrossEntropyLoss` or `nn.NLLLoss`) and [the optimizer](http://pytorch.org/docs/master/optim.html) (typically `optim.SGD` or `optim.Adam`).\n\nThen write the training code. Remember the training pass is a fairly straightforward process:\n\n* Make a forward pass through the network to get the logits \n* Use the logits to calculate the loss\n* Perform a backward pass through the network with `loss.backward()` to calculate the gradients\n* Take a step with the optimizer to update the weights\n\nBy adjusting the hyperparameters (hidden units, learning rate, etc), you should be able to get the training loss below 0.4.",
"_____no_output_____"
]
],
[
[
"# TODO: Create the network, define the criterion and optimizer\nmodel = Classifier()\ncriterion = nn.NLLLoss()\noptimizer = optim.Adam(model.parameters(), lr=0.003)",
"_____no_output_____"
],
[
"# TODO: Train the network here\nepochs = 5\n\nfor e in range(epochs):\n running_loss = 0\n for images, labels in trainloader:\n log_ps = model(images)\n loss = criterion(log_ps, labels)\n \n optimizer.zero_grad()\n loss.backward()\n optimizer.step()\n \n running_loss += loss.item()\n else:\n print(f\"Training loss: {running_loss/len(trainloader)}\")",
"Training loss: 283.4510831311345\nTraining loss: 274.7842669263482\nTraining loss: 267.907463490963\nTraining loss: 258.2156918346882\nTraining loss: 251.79347000271082\n"
],
[
"%matplotlib inline\n%config InlineBackend.figure_format = 'retina'\n\nimport helper\n\n# Test out your network!\n\ndataiter = iter(testloader)\nimages, labels = dataiter.next()\nimg = images[1]\n\n# TODO: Calculate the class probabilities (softmax) for img\nps = torch.exp(model(img))\n\n# Plot the image and probabilities\nhelper.view_classify(img, ps, version='Fashion')",
"_____no_output_____"
],
[
"from torch import nn\nimport torch.nn.functional as F\nfrom torch import optim\n\nfrom collections import OrderedDict",
"_____no_output_____"
],
[
"# Step1 Build Model (Class)\n\ninput_dim = 784\nhidden_layers = [256,128,64]\noutput_dim = 10\n\nclass Classifier1(nn.Module):\n def __init__(self):\n super().__init__()\n \n self.fc1 = nn.Linear(input_dim, hidden_layers[0])\n self.fc2 = nn.Linear(hidden_layers[0], hidden_layers[1])\n self.fc3 = nn.Linear(hidden_layers[1], hidden_layers[2])\n self.fc4 = nn.Linear(hidden_layers[2], output_dim)\n \n def forward(self, x):\n x = F.relu(self.fc1(x))\n x = F.relu(self.fc2(x))\n x = F.relu(self.fc3(x))\n x = nn.LogSoftmax(dim = 1)(x)\n return x\n\nclasifier1 = Classifier1()\n\n\n# Step2 Set the loss function\ncriterion = nn.NLLLoss()\n\n# Step3 Set the Optimizer\noptimzer = optim.SGD(clasifier1.parameters(), lr = 0.003)\n\n# Step4 Training \nepochs = 5\nfor e in range(epochs):\n running_loss = 0\n for images, labels in trainloader:\n # Flatten the images\n images = images.view(images.shape[0],-1)\n \n # Step4-1 Initializing optimizer\n optimzer.zero_grad()\n \n # Step4-2 Get the Prediction\n output = clasifier1(images)\n \n # Step4-3 Calculate the loss\n loss = criterion(output, labels)\n \n # Step4-4 Backwards the loss\n loss.backward()\n \n # Step4-5 Update Gradient\n optimzer.step()\n \n running_loss += loss.item()\n else:\n print(f\"Training loss: {running_loss/len(trainloader)}\")\n \n ",
"Training loss: 2.824750444909403\nTraining loss: 1.315409468244642\nTraining loss: 1.1065568941107182\nTraining loss: 1.0283418046131825\nTraining loss: 0.9834006609184656\n"
]
]
]
| [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
]
| [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
]
]
|
cb6d4685184f97abaae6d44096c00dc21a28afd1 | 116,674 | ipynb | Jupyter Notebook | SVM/10Fold for Pathology _ NPathology/'5 IB + HF.ipynb | Lance0218/Ultrasound-Machine-Learning | 7093db106294fdea6b79da4cab64636a1c7db6ec | [
"MIT"
]
| 2 | 2018-10-24T16:44:29.000Z | 2022-03-09T11:37:48.000Z | SVM/10Fold for Pathology _ NPathology/'5 IB + HF.ipynb | Lance0218/Ultrasound-Machine-Learning | 7093db106294fdea6b79da4cab64636a1c7db6ec | [
"MIT"
]
| null | null | null | SVM/10Fold for Pathology _ NPathology/'5 IB + HF.ipynb | Lance0218/Ultrasound-Machine-Learning | 7093db106294fdea6b79da4cab64636a1c7db6ec | [
"MIT"
]
| null | null | null | 356.801223 | 54,922 | 0.913528 | [
[
[
"# import models\nimport matplotlib.pyplot as plt \nimport numpy as np\nimport xlrd\nfrom sklearn.preprocessing import MinMaxScaler\nfrom sklearn.svm import SVC\nfrom sklearn.model_selection import StratifiedKFold\nfrom sklearn.model_selection import GridSearchCV\nfrom sklearn.metrics import roc_curve, auc\nimport itertools\nfrom sklearn.metrics import confusion_matrix\n\n# load data\n## Pathology for train\ndata = xlrd.open_workbook('Pathology.xlsx').sheets()[0]\nX_tra = np.zeros((111, 2))\nX_tra[:, 0] = data.col_values(3) # X0 = Integrated backscatter\n#X_tra[:, 1] = data.col_values(4) # X1 = Q factor (HHT)\nX_tra[:, 1] = data.col_values(6) # X2 = Homogeneity factor\n\n### scaling to 0~1\nScaler = MinMaxScaler(copy=True, feature_range=(0, 1)).fit(X_tra)\nX_train = Scaler.transform(X_tra)\n\n### label\nnrows = data.nrows\ny_train = []\nfor i in range(nrows): # y = 'T' or 'F' from Pathology data \n if data.cell(i,1).value < 10:\n y_train.append(0)\n elif data.cell(i,1).value >= 10:\n y_train.append(1)\ny_train = np.ravel(y_train) # Return a contiguous flattened array\nclass_names = np.ravel(['negative', 'positive']) \n\n## New Pathology for test\ndata = xlrd.open_workbook('NPathology.xlsx').sheets()[0]\nX_te = np.zeros((74, 2))\nX_te[:, 0] = data.col_values(3) # X0 = Integrated backscatter\n#X_te[:, 1] = data.col_values(4) # X1 = Q factor (HHT)\nX_te[:, 1] = data.col_values(6) # X2 = Homogeneity factor\n\n### scaling to 0~1\nX_test = Scaler.transform(X_te)\n\n### label\nnrows = data.nrows\ny_test = []\nfor i in range(nrows): # y = 'T' or 'F' from Pathology data \n if data.cell(i,1).value < 10:\n y_test.append(0)\n elif data.cell(i,1).value >= 10:\n y_test.append(1)\ny_test = np.ravel(y_test) # Return a contiguous flattened array\n\n# training & validation\n## set CV\ncv = StratifiedKFold(10)\n## set parameters\nC_l = list(2**(i/100) for i in range(-100, 325, 25))\nC_r = list(2**(i/100) for i in range(-100, 325, 25)) \nC_p = list(2**(i/100) for i in range(-700, -375, 25))\ngamma_r = list(2**(i/100) for i in range(-300, 125, 25))\ngamma_p = list(2**(i/100) for i in range(100, 525, 25))\n\n## SVC_linear\nlinear_prarmeters = {'kernel': ['linear'], 'C': C_l}\nclf_linear = GridSearchCV(SVC(), linear_prarmeters, cv=cv, n_jobs=3).fit(X_train, y_train)\nprint('The best parameters of linear are {0}\\n with a validation score of {1:.2%}'\n .format(clf_linear.best_params_, clf_linear.best_score_))\n\n## SVC_rbf\nrbf_prarmeters = {'kernel': ['rbf'], 'C': C_r, 'gamma': gamma_r}\nclf_rbf = GridSearchCV(SVC(), rbf_prarmeters, cv=cv, n_jobs=3).fit(X_train, y_train)\nprint('The best parameters of rbf are {0}\\n with a validation score of {1:.2%}'\n .format(clf_rbf.best_params_, clf_rbf.best_score_))\n\n## SVC_poly\npoly_prarmeters = {'kernel': ['poly'], 'C': C_p, 'gamma': gamma_p, 'degree': [1, 2, 3]}\nclf_poly = GridSearchCV(SVC(), poly_prarmeters, cv=cv, n_jobs=3).fit(X_train, y_train)\nprint('The best parameters of poly are {0}\\n with a validation score of {1:.2%}\\n'\n .format(clf_poly.best_params_, clf_poly.best_score_))\n\n# test\n## SVC_linear\ntest_predict_linear = clf_linear.predict(X_test)\ntest_score_linear = clf_linear.score(X_test, y_test)\nprint('test accuracy of linear = {0:.2%}'.format(test_score_linear))\ndec_linear = clf_linear.decision_function(X_test)\n\n## SVC_rbf\ntest_predict_rbf = clf_rbf.predict(X_test)\ntest_score_rbf = clf_rbf.score(X_test, y_test)\nprint('test accuracy of rbf = {0:.2%}'.format(test_score_rbf))\ndec_rbf = clf_rbf.decision_function(X_test)\n\n## SVC_poly\ntest_predict_poly = clf_poly.predict(X_test)\ntest_score_poly = clf_poly.score(X_test, y_test)\nprint('test accuracy of poly = {0:.2%}\\n'.format(test_score_poly))\ndec_poly = clf_poly.decision_function(X_test)\n\n## Confusion matrix \n### define confusion matrix\ndef plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues):\n global i\n print('{0}'.format(kernel[i]))\n print('Sensitivity = {0:.2%}'.format(cm[1,1]/(cm[1,0]+cm[1,1])))\n print('Specificity = {0:.2%}'.format(cm[0,0]/(cm[0,0]+cm[0,1])))\n print('LR+ = {0:.2f}'.format((cm[1,1]/(cm[1,0]+cm[1,1]))/(cm[0,1]/(cm[0,0]+cm[0,1]))))\n print('LR- = {0:.2f}'.format((cm[1,0]/(cm[1,0]+cm[1,1]))/(cm[0,0]/(cm[0,0]+cm[0,1]))))\n print('PPV = {0:.2%}'.format(cm[1,1]/(cm[0,1]+cm[1,1])))\n print('NPV = {0:.2%}'.format(cm[0,0]/(cm[0,0]+cm[1,0])))\n print('Accuracy = {0:.2%}\\n'.format((cm[0,0]+cm[1,1])/(cm[0,0]+cm[0,1]+cm[1,0]+cm[1,1])))\n\n plt.imshow(cm, interpolation='nearest', cmap=cmap)\n plt.colorbar()\n tick_marks = np.arange(len(classes))\n plt.xticks(tick_marks, classes)\n plt.yticks(tick_marks, classes)\n\n fmt = '.2f' if normalize else 'd'\n thresh = cm.max() / 2.\n for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):\n plt.text(j, i, format(cm[i, j], fmt),\n horizontalalignment='center',\n color='white' if cm[i, j] > thresh else 'black')\n \n plt.tight_layout()\n plt.title(title, size = 20)\n plt.ylabel('True label', size = 15)\n plt.xlabel('Predicted label', size = 15)\n\nkernel = ['linear', 'rbf', 'poly']\npre_kernel = [test_predict_linear, test_predict_rbf, test_predict_poly] # predict of each kernel\n\nfor i in range(0,3): \n ## Compute confusion matrix\n cnf_matrix = confusion_matrix(y_test, pre_kernel[i])\n np.set_printoptions(precision=4)\n\n ## Plot non-normalized confusion matrix\n plt.figure(figsize=(6,6))\n plot_confusion_matrix(cnf_matrix, classes=class_names,\n title='{0} Confusion matrix'.format(kernel[i]))\nplt.show()\n\n## ROC curve\n### compute ROC and AUC\nfpr = dict()\ntpr = dict()\nthresholds = dict()\nt_score = dict()\nroc_auc = dict()\n\ndec = [dec_linear, dec_rbf, dec_poly] # direction of each kernel \n\nfor i in range(0,3): \n fpr[i], tpr[i], thresholds[i] = roc_curve(y_test, dec[i])\n roc_auc[i] = auc(fpr[i], tpr[i])\n t_score[i] = tpr[i] - fpr[i]\n \n for j in range(len(t_score[i])):\n if t_score[i][j] == max(t_score[i]):\n s = j\n break\n print('{0} Cut-off value = {1:.4f}'.format(kernel[i], thresholds[i][s]))\n print('{0} AUROC = {1:.4f}'.format(kernel[i], roc_auc[i]))\n\n### plot\nplt.figure(figsize=(10,10))\nlw=2\ncolors = ['red', 'green', 'blue']\nlinestyles = ['-', '-.', ':']\nfor i, color, linestyle in zip(range(0,3), colors, linestyles): \n plt.plot(fpr[i], tpr[i], color=color, linestyle=linestyle, lw=lw, \n label='ROC curve of {0} (auc = {1:.4f})'.format(kernel[i], roc_auc[i]))\nplt.plot([0, 1], [0, 1], color='orange', lw=lw, linestyle='--')\nplt.xlim([-0.05, 1.05])\nplt.ylim([-0.05, 1.05])\nplt.xlabel('False Positive Rate (1-specificity)', size = 20)\nplt.ylabel('True Positive Rate (sensitivity)', size = 20)\nplt.title('Receiver operating characteristic', size = 25)\nplt.legend(loc='lower right')\nplt.show()",
"The best parameters of linear are {'C': 1.4142135623730951, 'kernel': 'linear'}\n with a validation score of 81.98%\nThe best parameters of rbf are {'C': 0.8408964152537145, 'gamma': 0.1767766952966369, 'kernel': 'rbf'}\n with a validation score of 82.88%\nThe best parameters of poly are {'C': 0.009290680585958758, 'degree': 1, 'gamma': 32.0, 'kernel': 'poly'}\n with a validation score of 82.88%\n\ntest accuracy of linear = 83.78%\ntest accuracy of rbf = 81.08%\ntest accuracy of poly = 81.08%\n\nlinear\nSensitivity = 92.86%\nSpecificity = 55.56%\nLR+ = 2.09\nLR- = 0.13\nPPV = 86.67%\nNPV = 71.43%\nAccuracy = 83.78%\n\nrbf\nSensitivity = 92.86%\nSpecificity = 44.44%\nLR+ = 1.67\nLR- = 0.16\nPPV = 83.87%\nNPV = 66.67%\nAccuracy = 81.08%\n\npoly\nSensitivity = 92.86%\nSpecificity = 44.44%\nLR+ = 1.67\nLR- = 0.16\nPPV = 83.87%\nNPV = 66.67%\nAccuracy = 81.08%\n\n"
]
]
]
| [
"code"
]
| [
[
"code"
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.