├── AutoLinePlotter ├── __init__.py └── main.py ├── diagrams ├── pong.png ├── pong_c51.png └── pong_dqn.png ├── .gitignore ├── setup.py ├── README.md └── LICENSE /AutoLinePlotter/__init__.py: -------------------------------------------------------------------------------- 1 | from .main import plotter -------------------------------------------------------------------------------- /diagrams/pong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Will-Nie/AutoLinePlotter/HEAD/diagrams/pong.png -------------------------------------------------------------------------------- /diagrams/pong_c51.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Will-Nie/AutoLinePlotter/HEAD/diagrams/pong_c51.png -------------------------------------------------------------------------------- /diagrams/pong_dqn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Will-Nie/AutoLinePlotter/HEAD/diagrams/pong_dqn.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.png 2 | *.pdf 3 | events.* 4 | *.csv 5 | *.txt 6 | __pycache__ 7 | *.egg-info 8 | *.whl 9 | 10 | ### macOS template 11 | # General 12 | .DS_Store 13 | .AppleDouble 14 | .LSOverride 15 | 16 | 17 | # luarocks build files 18 | *.tar.gz -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | from setuptools import setup 3 | 4 | with open("README.md", "r") as fh: 5 | long_description = fh.read() 6 | 7 | setup( 8 | name='AutoLinePlotter', 9 | version='0.0.2', 10 | packages=setuptools.find_packages(), 11 | url='https://github.com/Will-Nie/AutoLinePlotter', 12 | license='Apache License, Version 2.0', 13 | author='WillNie; Weiyuhong', 14 | author_email='nieyunpengwill@hotmail.com', 15 | description='This repo support auto line plot for multi-seed event file from TensorBoard', 16 | long_description=long_description, 17 | long_description_content_type="text/markdown", 18 | install_requires=['numpy','tensorboard','matplotlib','seaborn','pandas','typing'], 19 | classifiers=[ 20 | "Programming Language :: Python :: 3", 21 | "Operating System :: OS Independent", 22 | ], 23 | python_requires='>=3.6', 24 | ) 25 | 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AutoLinePlotter 2 | This repo support auto line plot for multi-seed event files from TensorBoard 3 | 4 | 5 | To use this AutoLinePlotter, simply ``pip install AutoLinePlotter``. Then, import ``plotter`` function from ``AutoLinePlotter`` to make a lineplot/lineplots. 6 | 7 | 8 | For the function ``plotter``, it has the following inputs: 9 | 10 | >``root: str,``: the location of the folder containing all algorithms data. Each is a folder containing a few seeds of event file generated from TensorBoard. 11 | 12 | >``titles: List[str]``: the titles to be plotted in each diagram; This has no effect in plot_together mode 13 | 14 | >``labels: List[str]``: the labels for each algorithm 15 | 16 | >``x_axes: List[str]``: the x-axis for each diagram; This has no effect in plot_together mode 17 | 18 | >``y_axes: List[str]``: the y-axis for each diagram; This has no effect in plot_together mode 19 | 20 | >``plot_together: bool = False``: whether to plot together or not 21 | 22 | >``plot_together_x_axis: str = None``: if plot_together, indicates the x axis for the plot 23 | 24 | >``plot_together_y_axis: str = None``: if plot_together, indicates the y axis for the plot 25 | 26 | >``plot_together_title: str = None``: if plot_together, indicates the title for the plot 27 | 28 | 29 | *** 30 | 31 | 32 | For example, under ``User/files/pong`` directory (see below), we have two folders: ``pong_c51`` and ``pong_dqn`` in which a few events files are included respectively. 33 | In this case, ``root`` should be ``'User/files/pong'``; ``titles`` could be ``['pong_c51', 'pong_dqn']``; labels could be ``['pong_c51', 'pong_dqn']``; 34 | ``x_axes`` could be ``['env_step','env_step'] ``, ``y_axes`` could be ``['return','return']``. 35 | 36 | 37 | >- User/files/pong 38 | > 39 | > - pong_c51 40 | > - events.out.tfevents.1632662517.pong-c51-seed0 41 | > - events.out.tfevents.1632662517.pong-c51-seed1 42 | > - events.out.tfevents.1632662517.pong-c51-seed2 43 | > - events.out.tfevents.1632662517.pong-c51-seed3 44 | > - events.out.tfevents.1632662517.pong-c51-seed4 45 | > - pong_dqn 46 | > - events.out.tfevents.1632662517.pong-dqn-seed0 47 | > - events.out.tfevents.1632662517.pong-dqn-seed1 48 | > - events.out.tfevents.1632662517.pong-dqn-seed2 49 | > - events.out.tfevents.1632662517.pong-dqn-seed3 50 | > - events.out.tfevents.1632662517.pong-dqn-seed4 51 | 52 | > Funcion output 53 | 54 | > ![avatar](./diagrams/pong_c51.png) 55 | > ![avatar](./diagrams/pong_dqn.png) 56 | 57 | **Notice** 58 | 59 | ``titles``, ``labels``, ``x_axes``, ``y_axes`` should follow the alphabetical order for the files within root. This is, in the case above, all these 60 | four list will be of dimension two. For whatever one enters, the first element in all these four lists should point to the final graph of ``pong_c51`` and the 61 | second element in all these four lists should point to the final graph of ``pong_dqn``. 62 | 63 | The only restriction in naming folders is for the folders containing events files. The format should be ``env_algo``. For instance, in the above case, the two folders are named 64 | ``pong_c51`` and ``pong_dqn`` respectively. (there should not be any ``_`` within ``env`` or ``algo`` naming) 65 | 66 | If ``plot_together`` is enabled, these line plots will be plotted together. So, besides the above input, users should turn on ``plot_together `` and set 67 | ``plot_together_x_axis ``, ``plot_together_y_axis`` and ``plot_together_title``. Notice that in this case, ``titles``, ``x_axes``, ``y_axes`` will have no effects. However, 68 | They should be implemented as if the user wants to plot with ``plot_together=False`` to avoid errors. If ``plot_together`` is enabled, the output for the above example is as follows: 69 | 70 | > Funcion output 71 | 72 | > ![avatar](./diagrams/pong.png) -------------------------------------------------------------------------------- /AutoLinePlotter/main.py: -------------------------------------------------------------------------------- 1 | import os 2 | import csv 3 | from tensorboard.backend.event_processing import event_accumulator 4 | import numpy as np 5 | import matplotlib.pyplot as plt 6 | from matplotlib.ticker import FuncFormatter 7 | import seaborn as sns 8 | import pandas as pd 9 | from typing import List 10 | 11 | 12 | def simple_moving_average(interval, windowsize): 13 | from collections import deque 14 | window = np.ones(int(windowsize)) / float(windowsize) 15 | re = deque(np.convolve(interval, window, 'valid')) 16 | while len(re) < len(interval): 17 | re.appendleft(interval[0]) 18 | return list(re) 19 | 20 | 21 | def exponentially_weighted_moving_average(interval, beta, bias=True): 22 | mean_total = [] 23 | bias_correction = 1 24 | mean = 0 25 | for i in range(len(interval)): 26 | if bias: 27 | mean = ((beta) * mean + (1 - beta) * interval[i]) 28 | revised_mean = mean / (1 - beta ** (bias_correction)) 29 | mean_total.append(revised_mean) 30 | else: 31 | mean = ((beta) * mean + (1 - beta) * interval[i]) 32 | mean_total.append(mean) 33 | bias_correction += 1 34 | return mean_total 35 | 36 | 37 | def x_update_scale_value(temp, position): 38 | if temp / 1e+6 % 1 == 0: 39 | result = int(temp // 1e+6) 40 | else: 41 | result = temp / 1e+6 42 | return "{}M".format(result) 43 | 44 | 45 | def plot(data: list, xlabel: str, ylabel: str, title: str, pth: str = './picture.png'): 46 | """ 47 | Overview: 48 | Draw training polyline 49 | Interface: 50 | data (:obj:`List[Dict]`): the data we will use to draw polylines 51 | data[i]['step']: horizontal axis data 52 | data[i]['value']: vertical axis data 53 | data[i]['label']: the data label 54 | xlabel (:obj:`str`): the x label name 55 | ylabel (:obj:`str`): the y label name 56 | title (:obj:`str`): the title name 57 | """ 58 | # sns.set(style="darkgrid", font_scale=1.5) 59 | sns.set() 60 | f = plt.figure(figsize=(7, 5.5)) 61 | for nowdata in data: 62 | step, value, label = nowdata['x'], nowdata['y'], nowdata['label'] 63 | sns.lineplot(x=step, y=value, label=label) 64 | 65 | plt.gca().xaxis.set_major_formatter(FuncFormatter(x_update_scale_value)) 66 | plt.tick_params(axis='both', labelsize=16) 67 | plt.title(title, fontsize=23) 68 | plt.legend(loc='upper left', prop={'size': 8}, fontsize=12) 69 | plt.xlabel(xlabel, fontsize=23) 70 | plt.ylabel(ylabel, fontsize=23) 71 | plt.tight_layout() 72 | f.savefig(pth, bbox_inches='tight') 73 | 74 | 75 | def plotter( 76 | root: str, 77 | titles: List[str], 78 | labels: List[str], 79 | x_axes: List[str], 80 | y_axes: List[str], 81 | max_x: int = None, 82 | output_format: str = '.pdf', 83 | normalise: str = None, 84 | windowsize=10, 85 | beta=0.9, 86 | bias=True, 87 | plot_together: bool = False, 88 | plot_together_x_axis: str = None, 89 | plot_together_y_axis: str = None, 90 | plot_together_title: str = None, 91 | ): 92 | ''' 93 | root: the location of the folder containing all algorithms data. Each is a folder containing a few seeds of event file generated from TensorBoard 94 | titles: the titles to be plotted in each diagram; This has no effect in plot_together mode 95 | labels: the labels for each algorithm 96 | x_axes: the x-axis for each diagram; This has no effect in plot_together mode 97 | y_axes: the y-axis for each diagram; This has no effect in plot_together mode 98 | max_x: the maximum x in x-axis ones wants to plot 99 | output_format: output format is either .pdf or .png 100 | normalise: whether to use normalisation (ema or sma) or not 101 | windowsize: windowsize for sma 102 | beta: beta for ema 103 | bias: wether to use bias correction 104 | plot_together: whether to plot together or not 105 | plot_together_x_axis: if plot_together, indicates the x axis for the plot 106 | plot_together_y_axis: if plot_together, indicates the y axis for the plot 107 | plot_together_title: if plot_together, indicates the title for the plot 108 | ''' 109 | 110 | headers = ['steps', 'value'] 111 | 112 | count_file = 0 113 | data_holder = [] # for plotting together only 114 | foot_root = root # for plotting together only 115 | for root, dirs, _ in os.walk(root): 116 | if len(dirs) > 1: 117 | dirs.sort() 118 | for d in dirs: 119 | 120 | title = titles[count_file] 121 | label = labels[count_file] 122 | x_axis = x_axes[count_file] 123 | y_axis = y_axes[count_file] 124 | count_file += 1 125 | exp_path = os.path.join(root, d) 126 | print(exp_path) 127 | env, agent = d.split('_') 128 | print(env, agent) 129 | results = {} 130 | for exp_root, _, exp_files in os.walk(exp_path): 131 | reward_seeds = [] 132 | for exp_i, exp_file in enumerate(exp_files): # ToDo: offline 133 | if ('.csv' in exp_file or '.png' in exp_file or '.pdf' in exp_file): 134 | continue 135 | try: 136 | ea = event_accumulator.EventAccumulator(os.path.join(exp_root, exp_file)) 137 | ea.Reload() 138 | rewards = ea.scalars.Items('evaluator_step/reward_mean') 139 | reward_seeds.append(rewards) 140 | except: 141 | raise Exception("{0} should not be in the directory: {1}".format(exp_file, exp_path)) 142 | dummy = [len(i) for i in reward_seeds] 143 | max_steps = max([len(i) for i in reward_seeds]) 144 | index = dummy.index(max_steps) 145 | if max_x is not None and max_x < reward_seeds[index][len(reward_seeds[index]) - 1].step: 146 | assert type(max_x) == int, 'max_x should be an integer' 147 | result = [] 148 | for k in range(len(reward_seeds[index])): 149 | if reward_seeds[index][k].step <= max_x: 150 | result.append(reward_seeds[index][k].step) 151 | else: 152 | max_steps = k - 1 153 | break 154 | results['step'] = result 155 | for j in range(len(reward_seeds)): 156 | max_steps_seed = len(reward_seeds[j]) 157 | reward_j = [] 158 | i = 0 159 | while i <= max_steps: 160 | if i <= max_steps_seed - 1: 161 | reward_j.append(reward_seeds[j][i].value) 162 | i += 1 163 | else: 164 | i = max_steps_seed - 1 165 | for _ in range(max_steps - max_steps_seed + 1): 166 | reward_j.append(reward_seeds[j][i].value) 167 | break 168 | if normalise == 'sma': 169 | results[j] = simple_moving_average(reward_j, windowsize) 170 | elif normalise == 'ema': 171 | results[j] = exponentially_weighted_moving_average(reward_j, beta, bias) 172 | else: 173 | results[j] = reward_j 174 | 175 | else: 176 | result = [] 177 | for i, reward in enumerate(reward_seeds[index]): 178 | result.append(reward.step) 179 | results['step'] = result 180 | for j in range(len(reward_seeds)): 181 | reward_j = [] 182 | for i, reward in enumerate(reward_seeds[j]): 183 | reward_j.append(reward.value) 184 | while i < max_steps - 1: 185 | reward_j.append(reward.value) 186 | i += 1 187 | i = 0 188 | if normalise == 'sma': 189 | results[j] = simple_moving_average(reward_j, windowsize=10) 190 | elif normalise == 'ema': 191 | results[j] = exponentially_weighted_moving_average(reward_j, beta=0.9, bias=True) 192 | else: 193 | results[j] = reward_j 194 | steps = results['step'] * (len(results) - 1) 195 | results.pop('step') 196 | value = [] 197 | for i in range(len(results)): 198 | value.extend(results[i]) 199 | if not plot_together: 200 | sns.set() 201 | f = plt.figure(figsize=(7, 5.5)) 202 | #figure_lineplot = sns.lineplot(x=steps, y=value, label=label, color='#ad1457') 203 | #sns.set(style="darkgrid", font_scale=1.5) 204 | sns.lineplot(x=steps, y=value, label=label) 205 | plt.gca().xaxis.set_major_formatter(FuncFormatter(x_update_scale_value)) 206 | plt.tick_params(axis='both', labelsize=16) 207 | 208 | plt.title(title, fontsize=23) 209 | plt.legend(loc='upper left', fontsize=12) 210 | plt.xlabel(x_axis, fontsize=23) 211 | plt.ylabel(y_axis, fontsize=23) 212 | plt.tight_layout() 213 | #plt.show() 214 | #figure = figure_lineplot.get_figure() 215 | f.savefig(exp_path + '/' + title + output_format, bbox_inches='tight') 216 | plt.close() 217 | else: 218 | data_holder.append({'x': steps, 'y': value, 'label': label}) 219 | csv_dicts = [] 220 | for i, _ in enumerate(steps): 221 | csv_dicts.append({'steps': steps[i], 'value': value[i]}) 222 | with open(os.path.join(exp_path, '{}.csv'.format(d)), 'w', newline='') as f: 223 | writer = csv.DictWriter(f, headers) 224 | writer.writeheader() 225 | writer.writerows(csv_dicts) 226 | if plot_together: 227 | assert type(plot_together_x_axis) is str and type(plot_together_y_axis) is str and type( 228 | plot_together_title 229 | ) is str, 'Please indicate the x-axis, the y-axis and the title' 230 | plot( 231 | data_holder, 232 | plot_together_x_axis, 233 | plot_together_y_axis, 234 | plot_together_title, 235 | pth=foot_root + foot_root[foot_root.rfind('/'):] + output_format 236 | ) 237 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------