import is a Python statement that finds a module that is accessible by the currently running process, loads it, and makes its contents available to the scope in which the statement was made. A statement like
import django.db.models
is looking for a module named django.db.models. If the statement is successful, django.db.models will be a variable name in the scope, it will be a Python object (of class Module, but that’s not important), and it will have functions, class constructors, variables and constants. These Python objects will be accessible through the dot operator.
An alternative way of writing import statements is
from django.utils import encoding
And then the variable will just be encoding. The encoding module has a function for handling unicode-to-web translation. Accessing it through the dot operator, it looks like this:
ready_str = encoding.smart_str(unready_str)
We call the parts of the import statement that describe the module the import string.
That’s what’s funny. Python has two independent ways of making sense of of the import string. The old system is based on the assumption that everything is a filesystem, with folders and filenames. This is called the sys.path_hooks system.
In the old system, the parts of the import string would be split up, and then a collection of directories would be scanned to see if the first name in the import string could be matched with a subdirectory. If it could, that directory would be scanned until the last name on the import string. If that name was a filename, it would be loaded as a module. If that name was a directory and that directory had a file named __init__.py, then that file would be loaded as the module.
The sys.path_hooks array has a list of different methods for trying to scan a filesystem for the parts of the import string. A path_hook is a function that takes a path to a directory; if it can handle the contents of the directory, it returns a Finder, an object whose job is to figure out how to load the module; if it can’t, it returns an ImportError exception. The object that loads the module is called, naturally, a Loader.
The list of directories is stored in an array, sys.path. This path is initialized by Python when it starts up, but programs can modify it at run-time to point to extra directories if they want.
The new system is called sys.meta_path, and it’s an array of Finders, objects that have one method, find_module(fullname). It’s an anything-goes API that gives developers the freedom to import modules from anywhere: databases, archives, remote web resources, even code written on-the-fly internally. The new system can apply any meaning at all to the import string.
In Python, the import string is offered to each object in sys.meta_path before being offered to each sys.path_hook. The filesystem is typically the last finder tried.
To read more about Meta Paths, see Meta Paths
Python 3 moves almost everything about this process into python’s library, leaving only a bare minimum of functionality inside the Python executable to load this library and run it. When the Python developers did that, they added a lot of functionality to make it easier to write new import modules. The old way still works, but there are now Module Specifications, which are metadata about a module, and the old path_hooks system is now just a meta_path handler added to the new system as the last resort.
To read more about Module Specifications, see Module Specifications
Yes, for one reason: iteration. Iteration is the ability to take a path where you believe Python modules can be found, and list through them. This facility is useful for large frameworks where a user wants to add new commands, or new objects, or new operations; Django uses this facility a lot! The pkgutil library depends upon Finders being able to iterate their contents, and with the filesystem iterator, that means being able to tell there’s more than one kind of syntax in a directory.


 My list includes,
Brewing Kettle
Fermenter + Air Lock
Funnel (optional)
Sanitizer
Auto-Siphon
Stir Spoon
Beer Recipe Kit
Rubbermaid Tote, Largest size avialable (for sanitizing)
Next we should sanitize everything thats going to touch the mash(beer before alcohol)


Campaigns
Players
Stats
Account
Logged in as
.
Your Campaigns
Log Out
Add a Campaign
Name
Date
Players
Players
Stats
My Account
×
Add a Campaign
Name:
Date Started:
Add a Player


Clustering:
No clustering
k-means
Number of Clusters:
3
4
5
6
7
8
9
10
Interactive Topic Modeling:
Dataset:
Arms Dealing
Terrorist Activity
Employees Disappearance
User:
P1
P2
P3
P4
P5
P6
P7
P8
Number of topics:
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20


A web service use Machine Learning models to predict the Power Production of the wind Turbine on the bases of given wind speed.
The cut-in wind speed of turbine is 0.325 and cut- out wind speed is 24.39.
| Model 1: Polynomial Regression - scikit-learn. | kW | |
| Model 2: Random Forest Model - scikit-learn. | ||
| Model 3: Neural network Model - Keras/TensorFlow. | kW |


| Dataset | Augmentation | Model |
|---|---|---|
| Github | Github | Github |
| Colab | Colab | Colab |
Tensorboard Experiment: https://tensorboard.dev/experiment/8LTXbHV8QQGXxBASaVYeJw/#scalars
Note about Dataset
There was this gist https://gist.github.com/wpm/52758adbf506fd84cff3cdc7fc109aad
which claims to parse the SST dataset properly, but there are comments on the gist like
This script make unusual thing - it pushes all non-sentence phrases from dictionary to train sample. So you will achive training sample with 230K trees inside. I’ve spent some time before notice this. Be careful
Which is why this way was NOT considered, Instead I matched the phrases to the sentences, and based on that the label was got. Individual phrases were not included in training set. ONLY the sentences and their labels were included. Ofcourse with a lot of augmentations ○( ＾皿＾)っ Hehehe…
This was probably very tricky, and difficult to do. I was using nlpaug
a package to simplify nlp augmentations and i used google translate python library to translate sentences, which basically internally using HTTP/2 API calls to translate.
Here’s the code for that
from nlpaug.augmenter.word import WordAugmenter
import google_trans_new
from google_trans_new import google_translator
import random
class BackTranslateAug(WordAugmenter):
def __init__(self, name='BackTranslateAug', aug_min=1, aug_max=10,
aug_p=0.3, stopwords=None, tokenizer=None, reverse_tokenizer=None,
device='cpu', verbose=0, stopwords_regex=None):
super(BackTranslateAug, self).__init__(
action=Action.SUBSTITUTE, name=name, aug_min=aug_min, aug_max=aug_max,
aug_p=aug_p, stopwords=stopwords, tokenizer=tokenizer, reverse_tokenizer=reverse_tokenizer,
device=device, verbose=0, stopwords_regex=stopwords_regex)
self.translator = google_translator()
def substitute(self, data):
if not data:
return data
if self.prob() < self.aug_p:
trans_lang = random.choice(list(google_trans_new.LANGUAGES.keys()))
trans_text = self.translator.translate(data, lang_src='en', lang_tgt=trans_lang)
en_text = self.translator.translate(trans_text, lang_src=trans_lang, lang_tgt='en')
return en_text
return data
aug = BackTranslateAug(aug_max=3, aug_p=1)
augmented_text = aug.augment(text)
Original: The Rock is destined to be the 21st Century 's new `` Conan '' and that he 's going to make a splash even greater than Arnold Schwarzenegger , Jean-Claud Van Damme or Steven Segal .
Augmented Text: The Rock is intended to be the 21st century new `` Conan 'and that he will do a splash even larger than Arnold Schwarzenegger, Jean-Claud Van Damme or Steven Segal.
Seems straight forward right ? just apply this over the entire DataFrame
?
WRONG
8% 958/11286 [09:54<2:13:42, 1.29it/s]
It would take about 2 hours to do this, even on an 8 core beast machine with really good internet. So i even tried different multiprocessing libraries, but they don’t work, it the google translate api library gets locked up. And i tested this on colab and also a standalone pc. same issue.
ALSO you will exhaust the requests limit
[/usr/local/lib/python3.7/dist-packages/google_trans_new/google_trans_new.py](https://localhost:8080/#) in translate(self, text, lang_tgt, lang_src, pronounce) 192 except requests.exceptions.HTTPError as e: 193 # Request successful, bad response --> 194 raise google_new_transError(tts=self, response=r) 195 except requests.exceptions.RequestException as e: 196 # Request failed
google_new_transError: 429 (Too Many Requests) from TTS API. Probable cause: Unknown
So what can you do ?
PLAY SMORT
Beat Google at their own game.
When i was struggling with this, i realised something, i remembered that there’s google translate api built into Google Sheets, so here i come, using Google Sheets as a NLP Data Augmentor.
It took about 60-70 mins, but it was done atleast (～￣▽￣)～
Link to Google Sheet Back Translate Augmentor
Substitutes a random word with their synonym
aug = naw.SynonymAug(aug_src='wordnet')
synonym_sentences = dataset_aug['sentence'].progress_apply(aug.augment)
Original: The Rock is destined to be the 21st Century 's new `` Conan '' and that he 's going to make a splash even greater than Arnold Schwarzenegger , Jean-Claud Van Damme or Steven Segal .
Augmented Text: The Rock is destined to follow the 21st Hundred ' s new ` ` Conan ' ' and that helium ' s going to make a splash yet swell than Arnold Schwarzenegger, Blue jean - Claud Van Damme or Steven Segal.
aug = naw.RandomWordAug(aug_max=3)
augmented_text = aug.augment(text)
Original: The Rock is destined to be the 21st Century 's new `` Conan '' and that he 's going to make a splash even greater than Arnold Schwarzenegger , Jean-Claud Van Damme or Steven Segal .
Augmented Text: The Rock is destined to be the 21st ' s new ` ` Conan ' ' that ' s going to make a splash even greater than Arnold Schwarzenegger, Jean - Claud Van Damme or Steven Segal.
aug = naw.RandomWordAug(action="swap", aug_max=3)
augmented_text = aug.augment(text)
Original: The Rock is destined to be the 21st Century 's new `` Conan '' and that he 's going to make a splash even greater than Arnold Schwarzenegger , Jean-Claud Van Damme or Steven Segal .
Augmented Text: The Rock is destined to be the 21st Century ' s new ` ` Conan ' ' and he that ' s going to make a splash even greater than Arnold, Schwarzenegger Jean Claud - Van Damme or Steven Segal.
Why did I stack 5 layers of LSTM ?
😅 I am new to NLP, i should have done research, so it turns out for classification tasks taking 2-3 layers is enough, we generally use more LSTM layers for sequence generation like machine translation.
While it is not theoretically clear what is the additional power gained by the deeper architecture, it was observed empirically that deep RNNs work better than shallower ones on some tasks. In particular, Sutskever et al (2014) report that a 4-layers deep architecture was crucial in achieving good machine-translation performance in an encoder-decoder framework. Irsoy and Cardie (2014) also report improved results from moving from a one-layer BI-RNN to an architecture with several layers. Many other works report result using layered RNN architectures, but do not explicitly compare to 1-layer RNNs.
Model [embedding_dim, dropout] |
LSTM [hidden_dim,layers] |
Augmentation | Epochs | Test Accuracy | Remark |
|---|---|---|---|---|---|
| 128, 0.2 | 256, 5 | delete, swap | 100 | 40.8 | Heavy Overfit |
| 128, 0.2 | 256, 5 | delete, swap, synonym, translate | 30 | 40.3 | More Augmentation, Heavy Overfit |
| 128, 0.2 | 256, 2 | delete, swap, synonym, translate | 30 | 40.2 | Less Layers, Heavy Overfit |
| 128, 0.5 | 256, 2 | delete, swap, synonym, translate | 30 | 39.7 | Increased Dropout, Still Heavy Overfit |
| 128, 0.5 | 128, 2 | delete, swap, synonym, translate | 30 | 40.9 | Decreased hidden_dim , Reduced Overfit |
| 128, 0.5 | 64, 2 | delete, swap, synonym, translate | 30 | 42.2 | Decreased hidden_dim , Reduced Overfit |
| 128, 0.5 | 32, 2 | delete, swap, synonym, translate | 30 | 40.2 | Decreased hidden_dim , Acc Reduced |
| 128, 0.5 | 64, 5 | delete, swap, synonym, translate | 30 | 40.5 | Increased Num Layers |
| 128, 0.0 | 64, 1 | delete, swap, synonym, translate | 30 | 40.1 | Single Layer LSTM, 0 Dropout |
The logs can be viewed at https://tensorboard.dev/experiment/8LTXbHV8QQGXxBASaVYeJw/#scalars
Notice version_5
above
(。﹏。*)
so the test accuracy shown in the plot is the last epoch test accuracy, instead the validation accuracy can be considered.I ran out of ideas, what could i do, since i need to use LSTMs only. But after reading a few papers from https://paperswithcode.com/sota/sentiment-analysis-on-sst-5-fine-grained it seems people have got 50% accuracies using LSTMs.
sentence: the film provides some great insight into the neurotic mindset of all comics -- even those who have reached the absolute top of the game .
label: neutral, predicted: positive
sentence: offers that rare combination of entertainment and education .
label: very positive, predicted: positive
sentence: perhaps no picture ever made has more literally showed that the road to hell is paved with good intentions .
label: positive, predicted: neutral
sentence: steers turns in a snappy screenplay that <unk> at the edges it ' s so clever you want to hate it .
label: positive, predicted: neutral
sentence: but he somehow pulls it off .
label: positive, predicted: neutral
sentence: take care of my cat offers a refreshingly different slice of asian cinema .
label: positive, predicted: very positive
sentence: ultimately , it <unk> the reasons we need stories so much .
label: neutral, predicted: negative
sentence: the movie ' s ripe , <unk> beauty will tempt those willing to probe its inscrutable mysteries .
label: positive, predicted: very positive
sentence: offers a breath of the fresh air of true sophistication .
label: very positive, predicted: positive
sentence: a disturbing and frighteningly evocative assembly of imagery and hypnotic music composed by philip glass .
label: neutral, predicted: very positive
sentence: effective but <unk> biopic
label: neutral, predicted: neutral
sentence: if you sometimes like to go to the movies to have fun , wasabi is a good place to start .
label: positive, predicted: positive
sentence: emerges as something rare , an issue movie that ' s so honest and keenly observed that it doesn ' t feel like one .
label: very positive, predicted: very positive
sentence: this is a film well worth seeing , talking and singing heads and all .
label: very positive, predicted: very positive
sentence: what really surprises about wisegirls is its low-key quality and genuine tenderness .
label: positive, predicted: positive
sentence: <unk> wendigo is <unk> why we go to the cinema to be fed through the eye , the heart , the mind .
label: positive, predicted: positive
sentence: one of the greatest family-oriented , fantasy-adventure movies ever .
label: very positive, predicted: very positive
sentence: an utterly compelling ` who wrote it ' in which the reputation of the most famous author who ever lived comes into question .
label: positive, predicted: positive
sentence: illuminating if overly talky documentary .
label: neutral, predicted: neutral
sentence: a masterpiece four years in the making .
label: very positive, predicted: very positive


Return to my programming portfolio.
Learn more about me.
View my resume.
Explore my skills and hobbies.


Company profile - Canadian Company Capabilities
Third-Party Information Liability Disclaimer
Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.
Bay Communications & Marketing Inc.
Mailing Address:
P.O. Box 656Station F
TORONTO, Ontario
M4Y 2N6
Location Address:
520-920 Yonge StTORONTO, Ontario
M4W 3C7
Tel.:<PHONE_NUMBER>
Fax:<PHONE_NUMBER>
Logo
Company Profile
A boutique and award-winng communications and marketing firm in business since 1991, Bay has worked successfully with many corporations, governments and non-profits in Canada and internationally. Experts in content development and marketing, newsletters (print and online), website writing, social media, media relations and PR. Subject matter expertise in small business, women's entrepreneurship, international trade, exporting, diversity, consumer services, real estate and tourism. Well known for writing documents, reports and communication materials that are captivating as well as informative, with a focus on the best language style to use for the target audience.
One of the first 10 women-owned firms in Canada to be certified by WEConnect Canada, which qualifies women business owners for corporate supplier diversity programs.
Key strengths:
Unparalleled network of domestic and global contacts
Deep knowledge of selling to niche markets such as small business owners, women entrepreneurs and minority groups
Strong relationships with business orgs targeting these groups
Subject matter expertise in small and mid-market business, women entrepreneurship, international trade, and diversity
Experience in being a woman-owned business for over 20 years
Capabilities
Content creation/writing
Editing
Executive and Government Ministers' messages.
Summaries of business events and presentations/speeches.
Profiles and case studies of successful business owners, employees, etc.
Writing blogs, white papers, reports
Marketing
Media relations
Project management
Presentations and webinars.
Mentoring program development & management
Full profile
Full profile
Contact information
Company description
561410 - Document Preparation Services
Product / Service / Licensing
Editing
Executive messages.
Summaries of business events and presentations/speeches.
Profiles and case studies of successful business owners, employees, etc.
Writing blogs, white papers, reports
Media relations
Project management
Presentations and webinars.
Mentoring program development & management
Sector information
Key / Major clients:
RBC Royal Bank Scotiabank
WEConnect Canada
Export Development Canada (EDC)
Business Development Bank (BDC)
International Finance Corp. (World Bank)
Global Banking Alliance for Women
Robert Half Canada
Ontario Ministry of Consumer Services
Ontario Ministry of Economic Development, Trade & Employment
Industry Canada
World Law Group
Primus Business Services
Department of Foreign Affairs & International Trade
Office of Small & Medium Enterprises, Public Works Canada
Nova Scotia Centre for Women in Business
B.C. Womens Enterprise Centre
Brookfield Properties
GWL Realty Advisors
Toronto Lawyers Association (TLA)
I.E.Canada (Canadian Association of Importers & Exporters)
State of Illinois Canadian Office
Organization of Women in International Trade
Minerva Canada
London House (Grand Cayman)
Success stories:
Developed and launched strategic communication vehicles for the Department of Foreign Affairs and International Trade (DFAIT) to showcase its Businesswomen in Trade program, to educate women entrepreneurs about exporting and to support their trade activities.Launched a small business newsletter for Industry Canada from the Minister of State (Small Business and Tourism) to raise awareness of government programs to help SMEs.
Developed a strategy and communication vehicles for Scotiabank International to raise awareness of its support for women entrepreneurs in the Caribbean to help them grow their businesses.
Guided RBC Royal Bank into becoming a leading bank for women entrepreneurs through a proactive outreach strategy and the development, launch and writing of communication vehicles that resonate with women.
Produced all strategic communication materials and conducted media relations to assist WEConnect Canada (national certification program for women business owners) launch and create a national profile with its target audiences.
Provided consulting and communications support for the launch of the Build in Canada Innovation Program (BCIP), targeted to small and medium firms.
Researched and wrote Canadian Business Women and Federal Government Contracts report to assist Office of Small and Medium Enterprises (OSME), Public Works & Government Services Canada to develop strategies for engagement with women owned and operated businesses in Canada.
Researched and wrote seven guidebooks for Ontario Ministry of Economic Development, Trade & Employment (MEDTE)s comprehensive E-Business Toolkit, a series positioned to provide small and medium sized businesses (SMEs) with information on a variety of advanced e business topics plus developed accompanying slide presentations to assist Ministry staff during seminars and workshops. Revamped and rewrote MEDTEs online guide for small business. Wrote articles for the Wisdom Exchange Reporter, a newsletter targeted to high-growth companies, and wrote articles and company profiles for Leading Growth Firms (Report 19) on Ontarios highest performing companies.
Frequent contributions to business publications and web sites on the benefits of going global for a variety of clients including DFAIT, RBC Royal Bank, Scotiabank, Organization of Women in International Trade (OWIT) and Canadian Association of Importers and Exporters (IECanada).
Spearheaded trade missions to Australia, Mexico and the U.S. for the Organization of Women in International Trade (OWIT).
Provided Export Development Canada (EDC) with consulting and communications to develop a Canadian Supply Chain Roundtable, an initiative designed to increase the profile of strategic supply chain management in Canada.
Write articles for US-based Minority Business Entrepreneur magazine that highlight supplier diversity initiatives and profile the work of enlightened corporations like TELUS and Canadian banks.
Provide application writing service for business award nominees. In 2013, two women business owners that Bay helped clinched top honours in the RBC Canadian Women Entrepreneur Awards.
Testimonial:
I'm on the new website and totally impressed. It is superb!! Thanks to all of you for working so hard in such a tight timeline to develop the new look for WEConnect Canada delivering on the promise with new programs, tools, and content to enable women to connect, to do business together, to grow our communities and to drive innovation.Mary Anderson, President, WEConnect Canada, Toronto, ON
Susan did an excellent job with IFC GEM's newsletter. Her work was timely, accurate, and engaging. The GEM newsletter reaches thousands of women business owners around the world who got to read Susans well-researched stories.
Jozefina Cutura, Program Officer, Gender-Entrepreneurship-Markets (GEM), International Finance Corporation (IFC), Washington, D.C.
Congratulations on your award, Susan! This is a significant recognition of the work you do on behalf of women entrepreneurs. Based on the support you've provided to us, it is well deserved.
David Wilton, Director, Small Business, Scotiabank, Toronto, ON
I really have to take this opportunity to compliment your writing and professionalism. You're one of the easiest and best to work with.
Ryan Hamilton, Managing Editor, MBE Magazine, Henderson, Nevada
Susan thanks so much for such a great job with this guide this will be invaluable to our certified women business enterprises.
Betty Wood, Lead Strategist, WEConnect Canada, Toronto, ON
The profiles look great! You did a wonderful job capturing the essence of our business. Thank you very much!
Angel Tang, RBC Dominion Securities Inc, Toronto, ON
We really appreciated your insight into small business, your writing style, your creative input and your ability to do whatever it took to meet tight deadlines in helping us launch the newsletter for small business.
Deanna Hammel, Policy Officer, Small Business and Tourism Branch, Small Business and Marketplace Services, Industry Canada, Ottawa, ON
Since we got so much great feedback on the last article, we'd like to do a Part 2. Thanks again for the great articles, Susan!
Angela Thompson, Web Strategy Manager, Marketing Services, Primus Business Services, Toronto, ON
Thank you for making yesterdays session so informative and interactive. I know there were a few light bulb moments in the room and the feedback was very positive. One woman told me that she sets a high standard when choosing workshop/training as she cannot afford to waste her time and yesterday went beyond her expectations.
Gordia Macdonald, Senior Business Development Officer, Centre for Women in Business, Halifax, NS
I would like to take this opportunity to thank you and your team for the hard and diligent work you demonstrated on this project. It was a pleasure to work with you and your colleagues over the course of the past few months.
John Cotsomitis, Sr. Program Coordinator, Entrepreneurship Branch, Ontario Ministry of Economic Development, Trade & Employment, Toronto
Third-Party Information Liability Disclaimer
Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.
Contacts
Contact information
Description
Company description
561410 - Document Preparation Services
Products, services and licensing
Product / Service / Licensing
Editing
Executive messages.
Summaries of business events and presentations/speeches.
Profiles and case studies of successful business owners, employees, etc.
Writing blogs, white papers, reports
Media relations
Project management
Presentations and webinars.
Mentoring program development & management
Sector
Sector information
Key / Major clients:
RBC Royal Bank Scotiabank
WEConnect Canada
Export Development Canada (EDC)
Business Development Bank (BDC)
International Finance Corp. (World Bank)
Global Banking Alliance for Women
Robert Half Canada
Ontario Ministry of Consumer Services
Ontario Ministry of Economic Development, Trade & Employment
Industry Canada
World Law Group
Primus Business Services
Department of Foreign Affairs & International Trade
Office of Small & Medium Enterprises, Public Works Canada
Nova Scotia Centre for Women in Business
B.C. Womens Enterprise Centre
Brookfield Properties
GWL Realty Advisors
Toronto Lawyers Association (TLA)
I.E.Canada (Canadian Association of Importers & Exporters)
State of Illinois Canadian Office
Organization of Women in International Trade
Minerva Canada
London House (Grand Cayman)
Success stories:
Developed and launched strategic communication vehicles for the Department of Foreign Affairs and International Trade (DFAIT) to showcase its Businesswomen in Trade program, to educate women entrepreneurs about exporting and to support their trade activities.Launched a small business newsletter for Industry Canada from the Minister of State (Small Business and Tourism) to raise awareness of government programs to help SMEs.
Developed a strategy and communication vehicles for Scotiabank International to raise awareness of its support for women entrepreneurs in the Caribbean to help them grow their businesses.
Guided RBC Royal Bank into becoming a leading bank for women entrepreneurs through a proactive outreach strategy and the development, launch and writing of communication vehicles that resonate with women.
Produced all strategic communication materials and conducted media relations to assist WEConnect Canada (national certification program for women business owners) launch and create a national profile with its target audiences.
Provided consulting and communications support for the launch of the Build in Canada Innovation Program (BCIP), targeted to small and medium firms.
Researched and wrote Canadian Business Women and Federal Government Contracts report to assist Office of Small and Medium Enterprises (OSME), Public Works & Government Services Canada to develop strategies for engagement with women owned and operated businesses in Canada.
Researched and wrote seven guidebooks for Ontario Ministry of Economic Development, Trade & Employment (MEDTE)s comprehensive E-Business Toolkit, a series positioned to provide small and medium sized businesses (SMEs) with information on a variety of advanced e business topics plus developed accompanying slide presentations to assist Ministry staff during seminars and workshops. Revamped and rewrote MEDTEs online guide for small business. Wrote articles for the Wisdom Exchange Reporter, a newsletter targeted to high-growth companies, and wrote articles and company profiles for Leading Growth Firms (Report 19) on Ontarios highest performing companies.
Frequent contributions to business publications and web sites on the benefits of going global for a variety of clients including DFAIT, RBC Royal Bank, Scotiabank, Organization of Women in International Trade (OWIT) and Canadian Association of Importers and Exporters (IECanada).
Spearheaded trade missions to Australia, Mexico and the U.S. for the Organization of Women in International Trade (OWIT).
Provided Export Development Canada (EDC) with consulting and communications to develop a Canadian Supply Chain Roundtable, an initiative designed to increase the profile of strategic supply chain management in Canada.
Write articles for US-based Minority Business Entrepreneur magazine that highlight supplier diversity initiatives and profile the work of enlightened corporations like TELUS and Canadian banks.
Provide application writing service for business award nominees. In 2013, two women business owners that Bay helped clinched top honours in the RBC Canadian Women Entrepreneur Awards.
Testimonial:
I'm on the new website and totally impressed. It is superb!! Thanks to all of you for working so hard in such a tight timeline to develop the new look for WEConnect Canada delivering on the promise with new programs, tools, and content to enable women to connect, to do business together, to grow our communities and to drive innovation.Mary Anderson, President, WEConnect Canada, Toronto, ON
Susan did an excellent job with IFC GEM's newsletter. Her work was timely, accurate, and engaging. The GEM newsletter reaches thousands of women business owners around the world who got to read Susans well-researched stories.
Jozefina Cutura, Program Officer, Gender-Entrepreneurship-Markets (GEM), International Finance Corporation (IFC), Washington, D.C.
Congratulations on your award, Susan! This is a significant recognition of the work you do on behalf of women entrepreneurs. Based on the support you've provided to us, it is well deserved.
David Wilton, Director, Small Business, Scotiabank, Toronto, ON
I really have to take this opportunity to compliment your writing and professionalism. You're one of the easiest and best to work with.
Ryan Hamilton, Managing Editor, MBE Magazine, Henderson, Nevada
Susan thanks so much for such a great job with this guide this will be invaluable to our certified women business enterprises.
Betty Wood, Lead Strategist, WEConnect Canada, Toronto, ON
The profiles look great! You did a wonderful job capturing the essence of our business. Thank you very much!
Angel Tang, RBC Dominion Securities Inc, Toronto, ON
We really appreciated your insight into small business, your writing style, your creative input and your ability to do whatever it took to meet tight deadlines in helping us launch the newsletter for small business.
Deanna Hammel, Policy Officer, Small Business and Tourism Branch, Small Business and Marketplace Services, Industry Canada, Ottawa, ON
Since we got so much great feedback on the last article, we'd like to do a Part 2. Thanks again for the great articles, Susan!
Angela Thompson, Web Strategy Manager, Marketing Services, Primus Business Services, Toronto, ON
Thank you for making yesterdays session so informative and interactive. I know there were a few light bulb moments in the room and the feedback was very positive. One woman told me that she sets a high standard when choosing workshop/training as she cannot afford to waste her time and yesterday went beyond her expectations.
Gordia Macdonald, Senior Business Development Officer, Centre for Women in Business, Halifax, NS
I would like to take this opportunity to thank you and your team for the hard and diligent work you demonstrated on this project. It was a pleasure to work with you and your colleagues over the course of the past few months.
John Cotsomitis, Sr. Program Coordinator, Entrepreneurship Branch, Ontario Ministry of Economic Development, Trade & Employment, Toronto


WITNESS LIST Appropriations Committee February 3, 1999-8:00A Natural Resources On: Huston, Robert (Texas Natural Resource Conservation Commission) Petersen, Ken (Texas Natural Resource Conservation Commission) Saitas, Jeff (Texas Natural Resource Conservation Commission) Transportation On: Behrens, Michael (Texas Department of Transportation) Heald, Charles (Texas Department of Transportation) Workforce On: Roth, Diane (Texas Workforce Commission) Sheridan, Mike (Texas Workforce Commission)


Toggle navigation
Colaboracao 2018
Dashboard
Disk Report
Disk Usage - Details
Domino Health
General Health
Mail Health
Cluster Health
HTTP Health
Em Desenvolvimento ...
NN
Loading ...
NN
Loading ...
NN
Loading ...
Notifications Panel
Loading ...
N minutes ago
Loading ...
NN minutes ago
Loading ...
HH:MM AM
Loading ...
Yesterday
View All Alerts


{% extends "/layout.html" %} {% block styles %} {% endblock %} {% block body %}
For more information, visit http://opensource.org/licenses/MIT.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Short text connected with another closed by a dot.
Short text - another text
Long text with a bold link on Google
Short text with a bold text that have an "italic" word inside.
Short text containing italic text, - bold text
Short text containing open tag that is closed on another line


--- title: "Committee" exclude_me: true ---
All enquiries to<EMAIL_ADDRESS>2014 Oxford: hosted by Dr Chris Ponting, University of Oxford, Dr Nazneen Rahman, Imperial Cancer Research; Dr Nick Loman, Institute of Microbiology and Infection, University of Birmingham; Dr Neil Hall, University of Liverpool; Dr Mike Quail, Wellcome Trust Sanger Institute; Mr Mick Watson, Edinburgh Genomics
2013 Nottingham: Dr Sarah Ayling, The Genome Analysis Centre, Norwich; Professor Mark Blaxter, GenePool, University of Edinburgh; Dr David Buck, Oxford; Dr Sarah Butcher, Imperial College London; Dr Lisa Crossman, The Genome Analysis Centre, Norwich; Associate Professor Richard Emes, University of Nottingham; Mr Mick Watson, ARK-Genomics, Edinburgh; Professor Chris Ponting, Oxford; Professor Neil Hall, Centre for Genomic Research, University of Liverpool; Dr Sarah Hunter, EMBL European Bioinformatics Institute; Dr Nick Loman, Centre for Systems Biology, University of Birmingham; Dr Sarah Teichmann, EMBL European Bioinformatics Institute; Dr Mike Quail, Sanger Institute; Dr Rory Bowden, Oxford.
2012 Nottingham: hosted by Dr Aziz Aboobaker, The Centre for Genetics and Genomics/DeepSeq, University of Nottingham; Professor Mark Blaxter, GenePool, University of Edinburgh; Dr David Buck, The Wellcome Trust Centre for Human Genetics, University of Oxford; Dr Mario Caccamo, The Genomics Analysis Centre (TGAC), Norwich; Professor Neil Hall, Centre for Genomic Research, University of Liverpool; Dr Nick Loman, The Centre for Systems Biology, University of Birmingham (and Twitter, @pathogenomenick); Professor Ed Louis, The Centre for Genetics and Genomics/DeepSeq, University of Nottingham; Professor Chris Ponting, The MRC Functional Genetics Unit, University of Oxford; Dr Anthony Rogers, EASIH, University of Cambridge; Dr Mick Watson, ARK-Genomics, Edinburgh.
2011 Nottingham: Professor Mark Blaxter, Institute of Evolutionary Biology, University of Edinburgh; Professor Neil Hall, Centre for Genomic Research, University of Liverpool; Professor Ed Louis, University of Nottingham; Dr Aziz Aboobaker, The Centre for Genetics and Genomics/DeepSeq, University of Nottingham.


---
layout: post
title: "Setting up the MH-Z14A CO2 sensor with Raspberry Pi"
date: 2020-05-17
tags: pi sensor python
---
After feeling tired for days (yay for COVID-19 and being at home all day every day), I wanted to see if the indoor air was at fault.
So I bought an an MH-Z14A sensor to get CO2-levels at home, by attaching it to a Raspberry Pi 3.
Indoor CO2-levels have pretty large impact on sleep and concentration. Usually measured in ppm (parts per million), the desired values are below 1000ppm.
CO2 levels and effects
source.
| PPM |
Effects |
| 250-400 |
normal outdoor air level |
| 400 - 1000 |
indoor, good airflow |
| 1000-2000 |
drowsiness, poor air |
| 2000-5000 |
headaches, sleepiness, stale air |
| >5000 |
unusual air conditions, other gases |
| >40000 |
harmful due to oxygen deprivation |
You'll need a CO2-sensor, a Raspberry Pi and some jumper cables.
Log into your Pi and run sudo raspi-config
.
Go to 5 Interfacing Options, then P6 Serial.
Select No on the login shell and Yes on the serial port hardware.
Then install pyserial for the sensor code.
sudo apt install python3-pip
pip3 install pyserial
Sensor setup
The sensor has three interfaces, analog output, PWM output and a 9600 baud 3V/5V TTL UART interface. You basically send a request and the sensor responds.
I manually rewired the cable that came with the sensor, to have female jumper DuPont wires to attach to the Pi's GPIO pins.
You can also use F-M jumper wires and use the PWM interface instead.
The sensor pins are:
PWM (yellow) TXD (green) RXD (blue) VCC (red) GND (black) | AnalogOutput (white) HD (brown)
and need to be attached to the Pi's pins like this:
Python code
Here's a simplified version of the code, for the full version check here.
{% highlight python %}
#!/usr/bin/env python3
import serial
import time
class CO2Sensor():
request = [0xff, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79]
def __init__(self, port='/dev/ttyS0'):
self.serial = serial.Serial(
port = port,
timeout = 1
)
def get(self):
self.serial.write(bytearray(self.request))
response = self.serial.read(9)
if len(response) == 9:
current_time = time.strftime('%H:%M:%S', time.localtime())
return {"time": current_time, "ppa": (response[2] << 8) | response[3], "temp": response[4]}
return -1
def main():
# other Pi versions might need CO2Sensor('/dev/ttyAMA0')
sensor = CO2Sensor()
print(sensor.get())
if __name__ == '__main__':
main()
{% endhighlight %}
Now if you run python3 filename.py
, you'll get the time, the current ppm value and the current temperature.
Finished! :)


val component: TComponent
Overrides ComponentProvider.component
The component that this provider is responsible for.
Getter


Sprint 99: Finalise the Course
Table of Contents
1 About This Sprint
This sprint describes what you can consider once you have passed the course.
2 User Stories covered in this Sprint
- As a teacher I want the students to continue practicing what I have taught them so they further increase their proficiency.
- As a student I want to continue learning and applying object oriented design so that I become a better software engineer.
- As a student I want to contribute back to the course so that students in coming years can benefit from my experiences.
3 Introduction
Congratulations, dear traveller, for having made it this far. Your journey in this course is about to end. If you have made it this far you probably:
- Know a thing or two about object oriented design.
- Have a healthy suspicion of people who use internet memes.
You may also have passed the assignments and the exam. I hope you have. I would like you to spend a few moments and think about where to go from here, and what you can do to further ingrain your object oriented design skills. Below I list a number of activities that can help you in this endeavour. I also list some activities that will help me to improve the course.
4 Experiential Learning
4.1 Summarise your Learning
Reflect upon what you have done and read. What have you learnt? What would you like to know more about?
4.2 Update the Course Backlog
- Purge the [completed] course sprints from the backlog.
- Add items to answer any questions you may still have about the course contents.
- Reflect upon how you can change your current ways of working, with respect to object oriented design.
- Reprioritise your backlog.
4.3 Fill in the Course Evaluation
I value your feedback, and I am constantly looking for ways to improve the course further. Please complete the official course evaluation.
I would also like you to think about how the course was delivered, and what was delivered. If you can think of things that can be done better, please do send me an e-mail and tell me this. I would love to discuss course improvement with you.
In particular, if you have ideas that can make the assignments more streamlined for you, as a student, to learn from and to exercise your understanding of everything about object oriented design, then please tell me.
Also, if you have ideas that can make the marking of assignments more streamlined (How do you unit test a software design?), please discuss this with me.
4.4 Pass the Torch: System for Next Year
If you have an idea of a system that is of reasonable size that you think would be good for the students to work on next year, then summarise it in 1-2 pages and send it to me. I would like the system to have:
- Some meaningful user interaction (to make use cases from)
- Some interesting interaction between objects (to make interaction diagrams)
- Some complex relations between classes (to exercise design patterns)
- Inheritance hierarchies
4.5 Work for me
If you are interested in helping out in the course next year, then let me know already now, and I’ll contact you when it is time to start planning next year’s course instance.
4.6 Sell the Course Book
You are of course welcome to keep the course book (Larman). It is actually a decent reference book for most things baout UML and a quick guide to common design patterns (and design practices) too. However, if you want to sell the book, and want my help, then use the link below to submit your name, contact information, information about your book, and your asking price. I will make this available to next years students, who may then contact you:
During next year’s course I will clear this list, so if you didn’t get the book sold, then you need to remember to re-add yourself.
5 Sprint Acceptance Tests
You are done with this sprint when:
- You have at least considered each of the things to do listed above under experiential learning.
You may also have:
- Updated your Course Backlog.
Thank you for your time and interest. – MSV


ForceFantasies.com
website
User Agreement
including Privacy Policy, Copyright Information and Legal Notices
| AGE AND ACCESS |
By requesting, accessing, and/or downloading any pages or files from Open Mind Media Inc's (OMM's) websites, you (the User) are acknowledging your agreement and acceptance of this User Agreement. By requesting and viewing files and pages from OMM websites and servers, you certify that: you are 18 years of age or older; you are familiar with all local and federal laws affecting your legal right to access adult-oriented materials; you have the legal right to access adult-oriented materials and OMM has the legal right to transmit them to you; and you will not share these materials with, make them available to, or make them accessible by, any other persons, especially not minors or non-consenting adults. |
| YOUR PRIVACY |
Each time you request a page or
image from this website, the server logs your IP#, provider, browser type, and the
URL of the previous page viewed. The data is saved to generate statistics about web visitors
as a group. It is not stored in order to reveal anything to anyone about
your specific accesses as an individual.
Non-customer emails from the user to our staff may be excerpted for posting; your email should contain information as to what information you wish to remain private, whether you wish to remain anonymous, and whether you want your email address to remain confidential. Each email must contain privacy instructions for the content of that same email. PAYING CUSTOMERS: Customer emails from the customer to our staff regarding the membership and account are considered private and confidential. Your name, your address, your email address, your phone number, your account information, and all other information you provide as a customer, are considered private and confidential. This information is accessible only to Open Mind Media staff and staff of companies associated with running this site and providing your services (for instance, the company that does billing system: Verotel.com). Your personal data is not provided to unrelated third parties, and my company does not send spam or emails unrelated to the operation of the website. |
| COPYRIGHT |
All materials on OMM websites and servers are copyrighted by Open Mind Media (except electronic messages posted by users and specific material attributed to other copyrights). All materials on OMM websites are protected under treaty provisions and worldwide copyright laws. Materials in and from any part of this website may not be reproduced, copied, edited, published, transmitted or uploaded in any way without the written permission of Open Mind Media. ("Fair Use" laws provide only for extremely limited use of samples for the purpose of review or education.) Materials displayed on public pages are not be construed to be uncopyrighted nor "in public domain". Persons uploading, publishing or reselling Open Mind Media copyrighted material will be in violation of: the international Berne Convention for the Protection of Literary and Artistic Works, which established in 1886 a copyright common-law for nations around the world; Federal law 17 USC 501, which protects owners of copyrighted material; and/or Federal law 18 USC 2257, which requires publishers (including webmasters) to have documented proof of each model's adult age on file. If you email any content to OMM, any processing of that material will be done according to your stated copyright limitations and instructions included in the same email transmission. If you believe that your work is appearing on an OMM website and has been copied in a way that constitutes copyright infringement, Open Mind Media can be reached as follows: Open Mind Media, Inc. Attn: Copyright Please provide to OMM the following written information: a statement by you that you have a good faith belief that the disputed use is not authorized by the copyright owner, its agent, or the law; a description of the copyrighted work that you believe has been infringed; a description of where the material that you believe is infringing is located on the site; a statement by you, made under penalty of perjury, that the information in your Notice is accurate and that you are the copyright owner or authorized to act on the copyright owner's behalf; your name; your electronic or physical signature; and your address, telephone number, and email address. |
| WEBSITE CONTENT, FILE CONTENT |
Some OMM files contain mature adult content. Webpages leading to access to these files are identified by clearly labeled entry pages. By using the service, you may be exposed to content that you find offensive, indecent or objectionable. OMM is not liable in any way for any content, including, but not limited to, for any errors or omissions in any content, or for any loss or damage of any kind incurred as a result of the use of any content posted, emailed, transmitted or otherwise made available via the service. |
| PUBLIC COMMUNICATION AREAS / USER CONTRIBUTIONS | Guestbook pages, Chatrooms, and Message Board pages are publicly accessible to anyone on the internet. Public posts transmitted and uploaded by users to such pages will be accessible to the general public. User posts are not pre-screened before posting. They are automatically posted. OMM reserves the right (but not the obligation) to edit or delete posts. OMM does not control the content posted via the service and, as such, does not guarantee the accuracy, integrity or quality of such content. Open Mind Media disclaims any liability with respect to content in the public communication areas. All information, files, data, text, photographs, graphics, video, messages or other materials ("content"), whether publicly posted or privately transmitted, are the sole responsibility of the person from which such content originated. You, not OMM, are entirely responsible for all content that you upload, post, email, transmit or otherwise make available via the service. Recognizing the global nature of the Internet, you agree to comply with all applicable laws regarding your online conduct and acceptable content. You agree not to post infringing, defamatory, libelous or otherwise unlawful material, or any material deemed excessively violent, harassing, threatening or otherwise objectionable. It is OMM's right, but not obligation, to monitor, delete and/or modify such posts and/or report such posts to legal authorities. If you are aware of any such material posted on this site, please contact OMM. |
| LIMITED LICENSE (USE OF SERVICE) |
OMM provides the materials on this site for personal, non-commercial use by viewers, guests, visitors, and members of this website. Users are granted a single copy license to download or print each file and/or page made available for downloading found on this site for personal, non-commercial use only. OMM reserves the right to limit the amount of materials downloaded. Users may not: use any of the materials found in any area of this website for any public display, performance, sale or rental; remove, modify or alter any copyright or other proprietary notice, or trademarks from any of the materials found in any area of this website; or otherwise transfer any material located in any area of this website to any other person or entity. If at any time you breach or violate any provision of this User Agreement, OMM reserves the right to terminate this license. You agree to hold OMM, and its staff, subsidiaries, and affiliates, harmless from any claim or demand, including reasonable attorneys' fees, made by any third party due to or arising out of content you submit, post, transmit or make available through the service, your use of the service, your connection to the service, your violation of the User Agreement, or your violation of any rights of another. |
| USER CONDUCT |
You agree to not use the service to: upload, post, email, transmit or otherwise make available any content that you do not have a right to make available under any law; upload, post, email, transmit or otherwise make available any content that is unlawful, harmful, threatening, harassing, defamatory, libelous, or invasive of another's privacy; impersonate any person or entity for any unlawful or malicious purpose, including, but not limited to, OMM staff members, monitors or hosts; falsely state or otherwise misrepresent your affiliation with a person or entity; upload, post, email, transmit or otherwise make available any unsolicited or unauthorized advertising, promotional materials, junk mail, spam, or any other form of solicitation; intentionally or unintentionally violate any applicable local, state, national or international law; "stalk" or otherwise harass another person or entity; collect or store personal data about other users for illegal or malicious purposes; upload, post, email, transmit or otherwise make available any material that contains software viruses or any other computer code, files or programs designed to interrupt, destroy, impose surveillance, or limit the functionality of any computer software or hardware or telecommunications equipment; or interfere with or disrupt the service or servers or networks connected to the service, or disobey any requirements, procedures, policies or regulations of networks connected to the service. |
| LEGAL COMPLIANCE | All persons appearing on Open Mind Media websites, in adult-content context, are consenting adults, 18 years of age or older. OMM keeps documentation of verification of models' adult age on file. Some images made before July 3, 1995 may lack this documentation. OMM's website images do not depict actual sexually explicit conduct (sexual congress).  The materials on this website are provided "as is" without any express or implied warranty of any kind including warranties of merchantability, noninfringement of intellectual property or fitness for a particular purpose. OMM offers no assurance of uninterrupted or error-free service. this website does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained on this web site. OMM may change any of the information found at this site at any time without notice. OMM makes no commitment to update the information found at this site. OMM shall not be liable for any damages arising out of the use or inability to use the material or information available on this site. Any material downloaded or otherwise obtained through the use of the service is done at your own discretion and risk and that you will be solely responsible for any damage to your computer system or loss of data that results from the download of any such material. No advice or information, whether oral or written, obtained by you from OMM or through or from the service shall create any warranty not expressly stated in the terms of service. OMM makes no warranty that: the service will meet your requirements, the service will be uninterrupted, timely, secure, or error-free, the results that may be obtained from the use of the service will be accurate or reliable, the quality of any products, services, information, or other material purchased or obtained by you through the service will meet your expectations, and/or any errors in the software will be corrected. OMM shall not be liable for any direct, indirect, incidental, special, consequential or exemplary damages, including but not limited to, damages for loss of profits, goodwill, use, data or other intangible losses (even if OMM has been advised of the possibility of such damages), resulting from: the use or the inability to use the service; the cost of procurement of substitute goods and services resulting from any goods, data, information or services purchased or obtained or messages received or transactions entered into through or from the service; unauthorized access to or alteration of your transmissions or data; statements or conduct of any third party on the service; or any other matter relating to the service. Your access to OMM files is a privilege, not a right. If OMM deems that your access is inconsistent with the goals of this website, your access may be temporarily or permanently restricted or blocked. |
| CHANGES OF SERVICE |
OMM reserves the right at any time to modify or discontinue, temporarily or permanently, the service (or any part thereof) with or without notice. OMM shall not be liable to you for any modification, suspension or discontinuance of the service. If OMM believes that you have violated or acted inconsistently with the letter or spirit of the User Agreement, OMM, in its sole discretion, may terminate your access or use of the service, or any part thereof, for any reason. OMM has no responsibility or liability for the deletion or failure to store any messages and other communications or other content maintained or transmitted by the service. |
| THIRD PARTIES |
This site contains links to other Web sites or resources which are controlled by third parties. Those linked sites are not under the control of OMM, and OMM is not responsible for the content or policies of any linked site or any link contained in a link site. OMM provides those links only as a convenience, and the inclusion of any link does not imply endorsement by OMM of any linked site. Your correspondence or business dealings with, or participation in promotions of, advertisers found on or through the service, including payment and delivery of related goods or services, and any other terms, conditions, warranties or representations associated with such dealings, are solely between you and such advertiser. OMM shall not be responsible or liable for any loss or damage of any sort incurred as the result of any such dealings or as the result of the presence of such advertisers on the service. |
| VENUE | This site is maintained and operated by OMM via offices in Greater Los Angeles, California, United States of America. OMM makes no representation that the materials available on this site are appropriate or available for use in other locations, and access to them from jurisdictions where their contents are illegal is prohibited. In the event of a dispute arising out of or relating to this User Agreement, or your use of or access to this site, you and OMM agree to submit to the personal and exclusive jurisdiction of the courts located within the county of Los Angeles, California. The failure of OMM to exercise or enforce any right or provision of this User Agreement shall not constitute a waiver of such right or provision. If any provision of this User Agreement is found by a court of competent jurisdiction to be invalid, the parties nevertheless agree that the court should endeavor to give effect to the parties' intentions as reflected in the provision, and the other provisions of the User Agreement remain in full force and effect. |
| LEGAL NOTES |
The section titles (headers) in this User Agreement are for convenience only and have no legal or contractual effect. Members (customers) of this site are additionally subject to the Member User Agreement, accessible via the Sign-Up/Join page of this website. |
| CONTACT |
This User Agreement may be updated by OMM from time to time without active transmittal of notice to you. If the User Agreement is updated or changed, the link and date of such change will be posted on the entry page (main directory index page) of each affected Open Mind Media website, to be visible to all visiting users. Open Mind Media,
Inc. |


Annotations for
The list of canvases which have annotations are below. There is a link to the Annotation List which can be downloaded and linked to the manifest. This is done by adding a otherContent
section to the relevant canvas in the manifest. For example:
{ "@id": "#{tCanvases.get(0).canvas.id}", "@type": "sc:Canvas", "images": [ ... ], "otherContent": [ { "@id": "http://example.com/sas/annotation/list/#{tCanvases.get(0).canvas.shortId}.json", "@type": "sc:AnnotationList", "label": "My fantastic annotations" }] }
{ "@id": "http://example.com/canvas/1", "@type": "sc:Canvas", "images": [ ... ], "otherContent": [ { "@id": "http://example.com/sas/annotation/list/short-id.json", "@type": "sc:AnnotationList", "label": "My fantastic annotations" }] }
No annotations found. Start annotating!


'Poor choice of words' - FG candidate apologises for comments about asylum seekers
by Stephen McNeiceA Fine Gael by-election candidate has apologised for her "very poor choice of words" when speaking about asylum seekers and direct provision.
Verona Murphy is contesting this month's by-election in Wexford.
In an interview with RTÉ over the weekend, the businesswoman said there were issues with the direct provision system.
She suggested that people protesting about a proposed centre in Oughterard, Co Galway were "absolutely justified because they hadn't been given enough information".
She argued: "These people are coming from such war-torn countries that they have to be deprogrammed, for the want of a better word, but through support services.
"They carry angst that you wouldn't ordinarily see, possibly infiltrated by ISIS and we have to protect ourselves against that."
The comments drew criticism, including from the Irish Refugee Council:
In a statement issued by Fine Gael, Ms Murphy apologised for the comments.
She said: “This was a very poor choice of words and I am very sorry to anyone who was offended by them.
“People coming here fleeing persecution deserve to be treated with compassion and respect.
"They need to be given opportunities to forge a new start for themselves and their families.
"That is why we have direct provision: to provide board and lodging to people seeking asylum."
She added: “The point I was trying to make was that some people coming to this country do so from very difficult circumstances and the support services they need here have a vital role in helping them.”
A spokesperson for Fine Gael added that immigration "enriches our country socially, culturally and economically".
They suggested that 'some form of incentive' is currently being considered to encourage parties to run more candidates from ethnic minorities.


Select file 1:
Select file 2:
Specify a URL or HTML to merge into the results:
URL:
HTML:
Hello
world
Page 2
Merge Content
Result_Code:
Result_Details:


- Fact - Class in tags
-
Represents a fact in the Expert System.
- Fact(String, double) - Constructor for class tags.Fact
-
Constructs a Fact object from a string
- Fact(String) - Constructor for class tags.Fact
-
confidenceValue
defaults to 1.0.
- Fact(String, List<Argument>, double) - Constructor for class tags.Fact
-
- factIDs - Variable in class graphing.KnnGraphVisualizer
-
- factMatch - Variable in class tags.VariableReturn
-
True if two facts match.
- facts - Variable in class es.internal.ExpertSystemImpl
-
- facts - Variable in class es.internal.ExpertSystemImplTest
-
- facts - Variable in class es.internal.ThinkCycleExecutor
-
- facts - Variable in class es.internal.ThinkCycleExecutorTest
-
- facts - Variable in class es.internal.Thinker
-
- facts - Variable in class es.internal.ThinkerTest
-
- factsContains(Fact, Map<String, Argument>) - Method in class es.internal.ThinkCycleExecutor
-
Checks if a particular fact getMatchResult with any other fact in the ES.
- findRuleIndices(List<String>) - Method in class es.internal.Teacher
-
Finds the indices of the input and output tokens in the given token list.
- forceContinue - Variable in class graphing.KnnGraphVisualizer
-
- forwardSearch(Set<Tag>, int) - Method in interface knn.api.KnowledgeNodeNetwork
-
Performs forward search in the KNN.
- forwardSearch(Set<Tag>, int) - Method in class knn.internal.KnowledgeNodeNetworkImpl
-
- ForwardSearcher - Class in knn.internal
-
Searcher which performs forward search in the KNN.
- ForwardSearcher(DirectSearcher) - Constructor for class knn.internal.ForwardSearcher
-
- forwardSearcher - Variable in class knn.internal.ForwardSearcherTest
-
- forwardSearcher - Variable in class knn.internal.KnowledgeNodeNetworkImpl
-
- forwardSearcher - Variable in class knn.internal.KnowledgeNodeNetworkImplTest
-
- forwardSearcher - Variable in class knn.internal.LambdaSearcher
-
- forwardSearcher - Variable in class knn.internal.LambdaSearcherTest
-
- ForwardSearcherFactory - Interface in knn.internal
-
Guice factory for the forward searcher.
- ForwardSearcherTest - Class in knn.internal
-
- ForwardSearcherTest() - Constructor for class knn.internal.ForwardSearcherTest
-
- forwardSearchTest() - Method in class integration.KnowledgeNodeNetworkAnimalTest
-
Test the forward Search of the Knowledge Node network
- forwardSearchWithPlyTest() - Method in class integration.KnowledgeNodeNetworkAnimalTest
-
- forwardThink(int) - Method in interface knn.api.KnowledgeNodeNetwork
-
Performs forward thinking in the KNN.
- forwardThink(int) - Method in class knn.internal.KnowledgeNodeNetworkImpl
-
- fromViewer - Variable in class graphing.GraphVisualizer
-


BRRelutionTagMessageV1 Class Reference
| Inherits from | BRBeaconMessage : NSObject |
|---|---|
| Declared in | BRRelutionTagMessageV1.h BRRelutionTagMessageV1.m |
Overview
A Relution Tag message is a Relution specific advertising message that can be delivered by BlueRange SmartBeacons. A Relution tag message contains one or more tag identifiers. The concept of Relution Tag messages is designed for apps that do not require internet access but want to react to tags, that can be assigned dynamically to a beacon using the Relution platform.
– initWithTags:andRssi:andTxPower:
- (id)initWithTags:(NSArray *)tags andRssi:(int)rssi andTxPower:(short)txPower


Learning objectives
- Understand ggplot2’s grammar of graphics
- Apply the grammar to create a variety of plots including scatter plots, box plots and histograms
- Learn about how R handles categorical data
In this session we will focus our attention on the popular ggplot2 package for visualizing tabular data and will be learning how to create various different kinds of plot.
We’ll be using an extended version of the METABRIC data set (from last week) in which columns have been added for the mRNA expression values for selected genes, including estrogen receptor alpha (ESR1), progesterone receptor (PGR), GATA3 and FOXA1.
The METABRIC study characterized the genomic mutations and gene expression profiles for over 2000 primary breast tumours. In addition to the gene expression data generated using microarrays, genome-wide copy number profiles were obtained using SNP microarrays and targeted sequencing was performed using a panel of 40 driver-mutation genes to detect mutations (single nucleotide variants).
Curtis et al., Nature 486:346-52, 2012
Pereira et al., Nature Communications 7:11479, 2016
Both the clinical data and the gene expression values were downloaded from cBioPortal.
These have been combined into a single table using techniques we will cover later in the course. We’ve removed observations for patient tumour samples for which expression data are not available, so our table has fewer rows.
In addition, we have replaced spaces in column names with underscores so we don’t have to constantly refer to these using backticks ( `
). Note, however, that even after renaming some of the column names, we have one column, ‘3-gene classifier’, that is not strictly a valid name in R as it starts with a number and contains a hyphen. Valid names for variables in R contain only letters, numbers and the dot (.
) and underscore (_
) characters and should not begin with a number. So when we refer to the ‘3-gene classifier’ column we’ll have to use backticks, e.g. metabric$`3-gene_classifier`
.
library(tidyverse)
metabric <- read_csv("data/metabric_clinical_and_expression_data.csv")
metabric
## # A tibble: 1,904 x 32
## Patient_ID Cohort Age_at_diagnosis Survival_time Survival_status Vital_status
## <chr> <dbl> <dbl> <dbl> <chr> <chr>
## 1 MB-0000 1 75.6 140. LIVING Living
## 2 MB-0002 1 43.2 84.6 LIVING Living
## 3 MB-0005 1 48.9 164. DECEASED Died of Dis…
## 4 MB-0006 1 47.7 165. LIVING Living
## 5 MB-0008 1 77.0 41.4 DECEASED Died of Dis…
## 6 MB-0010 1 78.8 7.8 DECEASED Died of Dis…
## 7 MB-0014 1 56.4 164. LIVING Living
## 8 MB-0022 1 89.1 99.5 DECEASED Died of Oth…
## 9 MB-0028 1 86.4 36.6 DECEASED Died of Oth…
## 10 MB-0035 1 84.2 36.3 DECEASED Died of Dis…
## # … with 1,894 more rows, and 26 more variables: Chemotherapy <chr>,
## # Radiotherapy <chr>, Tumour_size <dbl>, Tumour_stage <dbl>,
## # Neoplasm_histologic_grade <dbl>, Lymph_nodes_examined_positive <dbl>,
## # Lymph_node_status <dbl>, Cancer_type <chr>, ER_status <chr>,
## # PR_status <chr>, HER2_status <chr>, HER2_status_measured_by_SNP6 <chr>,
## # PAM50 <chr>, `3-gene_classifier` <chr>, Nottingham_prognostic_index <dbl>,
## # Cellularity <chr>, Integrative_cluster <chr>, Mutation_count <dbl>,
## # ESR1 <dbl>, ERBB2 <dbl>, PGR <dbl>, TP53 <dbl>, PIK3CA <dbl>, GATA3 <dbl>,
## # FOXA1 <dbl>, MLPH <dbl>
First we’ll create a simple scatter plot much like the ones we’ve created in previous sessions using R’s plot()
function. We’ll plot the expression of estrogen receptor alpha (ESR1) against that of the transcription factor, GATA3.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1))
We specified 3 things to create this plot:
In this case, the type of plot is a geom_point
, ggplot2’s function for a scatter plot, and the expression of the genes GATA3 and ESR1 (estrogen receptor alpha) are mapped to the x
and y
coordinates, i.e. the positions of points on the scatter plot.
Other aesthetics include the size, shape and colour of the points. It might seem a little surprising that the x and y coordinates are treated in the same way as we wouldn’t normally think about these as having aesthetic qualities but this is indeed the case with ggplot2.
Look up the geom_point
help page to see the list of aesthetics that are available for this geom.
?geom_point
If you scroll down to the aesthetics section in the help page for geom_point
, you’ll see that the x
and y
aesthetics are in bold face which tells us that these are required, i.e. you have to supply them, otherwise you’ll get an error message from ggplot.
Other aesthetics such as size, shape, colour and transparency (alpha
) are optional.
So what about those other aesthetics? Colours are usually fun – let’s try to use the colour
aesthetic.
We need to map a variable to a colour just like we did for x and y. We’ll use the ER status as an example.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, colour = ER_status))
What about colouring points based on a continuous variable?
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, colour = Nottingham_prognostic_index))
ggplot2 uses a colour scale for a continous variable but discrete colours for discrete or categorical values.
Size is not usually a good aesthetic to map to a variable. This is particularly the case where we have such a large number of observations.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, size = ER_status))
## Warning: Using size for a discrete variable is not advised.
Some aesthetics, such as size, are designed to be used with continuous variables. If you map these to a discrete variable as we have done here, then ggplot warns you that this isn’t such a good idea.
It would however be useful to be able to decrease the size of the points given that there are around 2000 in this data set. We can do so by setting the size to a single value rather than mapping it to one of the variables in the data set - this has to be done outside the aesthetic mappings, i.e. outside the aes()
bit.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, colour = Nottingham_prognostic_index), size = 0.5)
Some aesthetics can only be used with categorical variables, e.g. shape.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, shape = Survival_time))
Error: A continuous variable can not be mapped to shape
Here we set the shape based on the 3-gene classifier.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, shape = `3-gene_classifier`), size = 0.9)
## Warning: Removed 204 rows containing missing values (geom_point).
Note that some of the patient samples have not been classified and ggplot has removed those points with missing values for the 3-gene classifier.
It is usually preferable to use colours to distinguish between different categories but sometimes colour and shape are used together where we want to show which group a data point belongs to in two different categorical variables.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, colour = PAM50, shape = `3-gene_classifier`), size = 0.9)
## Warning: Removed 204 rows containing missing values (geom_point).
Transparency can be useful when we have a large number of points as we can more easily tell when points are overlaid, but like size, it is not usually mapped to a variable and sits outside the aes()
.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, colour = `3-gene_classifier`), size = 0.75, alpha = 0.5)
Colours are more commonly used than shapes, sizes or transparency.
Virtually every aspect of the plots we’ve created can be customized. We will learn how to change the colours used as well as other display parameters later in the course.
The “gg” in ggplot2 stands for “grammar of graphics”. This grammar is a coherent system for describing and building graphs.
The basic template is given in the summary box below. This template can be used to create any of a wide range of graph types with ggplot2.
ggplot2 grammar of graphics
ggplot(data = <DATA>) + <GEOM_FUNCTION>(mapping = aes(<MAPPINGS>))
ggplot()
creates the plot object.
Layers can be added by adding geoms such as geom_point()
using the +
operator that ggplot2 has overridden for this purpose.
The range of geoms available in ggplot2 can be obtained by navigating to the ggplot2 package in the Packages tab pane in RStudio (bottom right-hand corner) and scrolling down the list of functions sorted alphabetically to the geom_...
functions.
The METABRIC study redefined how we think about breast cancer by identifying and characterizing several new subtypes, referred to as integrative clusters. Let’s create a bar chart of the number of patients whose cancers fall within each subtype in the METABRIC cohort.
geom_bar
is the geom we need and it requires a single aesthetic mapping of the categorical variable of interest to x
.
ggplot(data = metabric) +
geom_bar(mapping = aes(x = Integrative_cluster))
The dark grey bars are a big ugly - what if we want each bar to be a different colour?
ggplot(data = metabric) +
geom_bar(mapping = aes(x = Integrative_cluster, colour = Integrative_cluster))
Colouring the edges wasn’t quite what we had in mind. Look at the help for geom_bar
to see what other aesthetic we should have used.
ggplot(data = metabric) +
geom_bar(mapping = aes(x = Integrative_cluster, fill = Integrative_cluster))
What happens if we colour (fill) with something other than the integrative cluster?
ggplot(data = metabric) +
geom_bar(mapping = aes(x = Integrative_cluster, fill = ER_status))
We get a stacked bar plot.
Note the similarity in what we did here to what we did with the scatter plot - there is a common grammar.
Let’s try another stacked bar plot, this time with a categorical variable with more than two categories.
ggplot(data = metabric) +
geom_bar(mapping = aes(x = Integrative_cluster, fill = `3-gene_classifier`))
What if want all the bars to be the same colour but not dark grey, e.g. blue?
ggplot(data = metabric) +
geom_bar(mapping = aes(x = Integrative_cluster, fill = "blue"))
That doesn’t look right - why not?
You can set the aesthetics to a fixed value but this needs to be outside the mapping, just like we did before for size and transparency in the scatter plots.
ggplot(data = metabric) +
geom_bar(mapping = aes(x = Integrative_cluster), fill = "blue")
Setting this inside the aes()
mapping told ggplot2 to map the colour aesthetic to some variable in the data frame, one that doesn’t really exist but which is created on-the-fly with a value of “blue” for every observation.
You may have noticed that ggplot2 didn’t just plot values from our data set but had to do some calculation first for the bar chart, i.e. it had to sum the number of observations in each category.
Each geom has a statistical transformation. In the case of the scatter plot, geom_point
uses the “identity” transformation which means just use the values as they are, i.e. not really a transformation at all. The statistical transformation for geom_bar
is “count”, which means it will count the number of observations for each category in the variable mapped to the x aesthetic.
You can see which statistical transformation is being used by a geom by looking at the stat
argument in the help page for that geom.
There are some circumstances where you’d want to change the stat
, for example if we already had count values in our table.
counts <- tibble(
`3-gene_classifier` = c("ER-/HER2-", "ER+/HER2- High Prolif", "ER+/HER2- Low Prolif", "HER2+"),
count = c(290, 603, 619, 188)
)
counts
## # A tibble: 4 x 2
## `3-gene_classifier` count
## <chr> <dbl>
## 1 ER-/HER2- 290
## 2 ER+/HER2- High Prolif 603
## 3 ER+/HER2- Low Prolif 619
## 4 HER2+ 188
ggplot(data = counts) +
geom_bar(mapping = aes(x = `3-gene_classifier`, y = count), stat = "identity")
Consider again the ggplot2 grammar:
ggplot(data = <DATA>) +
<GEOM_FUNCTION>(mapping = aes(<MAPPINGS>))
Why do we have the ggplot part and geom part joined by a “+” symbol?
The ‘+’ operator has been overridden by ggplot2 to add layers (geoms) and other components (scales, themes, etc.) to the plot.
We can have multiple geoms in the same plot. Each is a different layer.
Let’s create a plot with two geoms.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1)) +
geom_smooth(mapping = aes(x = GATA3, y = ESR1))
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
What is geom_smooth()
doing? Look up the help page.
Note that the shaded area surrounding blue line represents the standard error bounds on the fitted model.
It is important when breaking these ggplot statements across multiple lines to ensure that the +
is at the end of the line so that R knows you haven’t finished constructing your plot.
There is some annoying duplication of code used to create this plot. We’ve repeated the exact same aesthetic mapping for both geoms. We can avoid this by putting the mappings in the ggplot()
function instead.
ggplot(data = metabric, mapping = aes(x = GATA3, y = ESR1)) +
geom_point() +
geom_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
Let’s make the plot look a bit prettier by reducing the size of the points and making them transparent. We’re not mapping size
or alpha
to any variables, just setting them to constant values, and we only want these settings to apply to the points, so we set them inside geom_point()
.
ggplot(data = metabric, mapping = aes(x = GATA3, y = ESR1)) +
geom_point(size = 0.5, alpha = 0.5) +
geom_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
Aesthetics set in the ggplot
function are treated as global mappings for the plot and are inherited by all geoms added to the plot.
Let’s say we still want to colour the points by ER status.
ggplot(data = metabric, mapping = aes(x = GATA3, y = ESR1, colour = ER_status)) +
geom_point(size = 0.5, alpha = 0.5) +
geom_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
Well, that wasn’t expected, although it’s pretty neat. We only wanted to apply the colour aesthetic to the points.
We can add the colour aesthetic to the geom_point()
function instead of as a global mapping in the ggplot()
function.
ggplot(data = metabric, mapping = aes(x = GATA3, y = ESR1)) +
geom_point(mapping = aes(colour = ER_status), size = 0.5, alpha = 0.5) +
geom_smooth()
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
Or suppose you’ve spent a bit of time getting your scatter plot just right and decide to add another layer but you’re a bit worried about interfering with the the code you so lovingly crafted, you can set the inherit.aes
option to FALSE
and set the aesthetic mappings explicitly for your new layer.
ggplot(data = metabric, mapping = aes(x = GATA3, y = ESR1, colour = ER_status)) +
geom_point(size = 0.5, alpha = 0.5) +
geom_smooth(mapping = aes(x = GATA3, y = ESR1), inherit.aes = FALSE)
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
Box plots are a particular favourite of Wednesday lunchtime seminars.
ggplot(data = metabric, mapping = aes(x = ER_status, y = GATA3)) +
geom_boxplot()
See geom_boxplot
help to explain how the box and whiskers are constructed and how it decides which points are outliers and should be displayed as points.
How about adding another layer to display all the points?
ggplot(data = metabric, mapping = aes(x = ER_status, y = GATA3)) +
geom_boxplot() +
geom_point()
Ideally, we’d like these points to be spread out a bit. The geom_point
help points to geom_jitter
as more suitable when one of the variables is categorical.
ggplot(data = metabric, mapping = aes(x = ER_status, y = GATA3)) +
geom_boxplot() +
geom_jitter()
Well, that’s a bit of a mess. We need to reduce the spread or jitter and make the points smaller and transparent.
ggplot(data = metabric, mapping = aes(x = ER_status, y = GATA3)) +
geom_boxplot() +
geom_jitter(width = 0.3, size = 0.5, alpha = 0.25)
Displaying points in this way makes much more sense when we only have a few observations and where the box plot masks the fact, perhaps giving the false impression that the sample size is larger than it actually is. Here it makes less sense as we have very many observations.
Let’s try a colour aesthetic to also look at how estrogen receptor expression differs between HER2 positive and negative tumours.
ggplot(data = metabric, mapping = aes(x = ER_status, y = GATA3, colour = HER2_status)) +
geom_boxplot()
The next type of plot we’re going to look at is a line plot. Line plots are a common visualization for time series data but we don’t have data of this kind in the METABRIC data set so we’ll turn our attention to a more topical data set.
Every day the UK Government presents a series of plots showing data relating to the coronavirus (COVID-19) pandemic. Both the plots and the data are published on the Government’s website.
One of the plots shows the reduction in different types oftransport use over time in the UK in the week leading up to and since the lockdown restrictions were introduced in response to the pandemic.
Reading these data into R from the downloaded Excel spreadsheet requires a bit more care as the spreadsheet contains multiple sheets and each table has header lines and footnotes. The date column doesn’t have a column heading, so in the code below we’ve skipped that row as well and told read_excel()
what column names to use. We’ve also given it a heads-up about which type of data are in each column. Look up the help page for read_excel()
for more details about the arguments we’ve used below.
library(readxl)
transport_use <- read_excel("data/2020-04-26_COVID-19_Press_Conference_Data.xlsx",
sheet = "Transport use",
col_names = c("date", "transport_type", "percentage"),
col_types = c("date", "text", "numeric"),
skip = 4,
n_max = 186)
transport_use$percentage <- transport_use$percentage * 100
transport_use
## # A tibble: 186 x 3
## date transport_type percentage
## <dttm> <chr> <dbl>
## 1 2020-03-16 00:00:00 All motor vehicles 98
## 2 2020-03-17 00:00:00 All motor vehicles 89
## 3 2020-03-18 00:00:00 All motor vehicles 83
## 4 2020-03-19 00:00:00 All motor vehicles 82
## 5 2020-03-20 00:00:00 All motor vehicles 81
## 6 2020-03-21 00:00:00 All motor vehicles 73
## 7 2020-03-22 00:00:00 All motor vehicles 69
## 8 2020-03-23 00:00:00 All motor vehicles 69
## 9 2020-03-24 00:00:00 All motor vehicles 49
## 10 2020-03-25 00:00:00 All motor vehicles 42
## # … with 176 more rows
In this data set each row represents an observation of the current traffic volume for various modes of transport (motor vehicle, bus, train, etc.) since 16 March as a percentage of the volume measured during the first week of February.
So let’s get a feel for this data set. Firstly, what modes of transport are included and how many observations do we have for each?
table(transport_use$transport_type)
##
## All motor vehicles Bus (excl. London) National rail TfL - Bus
## 40 40 40 34
## TfL - Tube
## 32
We’ll focus solely on rail use to start with.
rail_use <- transport_use[transport_use$transport_type == "National rail", ]
rail_use
## # A tibble: 40 x 3
## date transport_type percentage
## <dttm> <chr> <dbl>
## 1 2020-03-16 00:00:00 National rail 77
## 2 2020-03-17 00:00:00 National rail 69
## 3 2020-03-18 00:00:00 National rail 59
## 4 2020-03-19 00:00:00 National rail 52
## 5 2020-03-20 00:00:00 National rail 44
## 6 2020-03-21 00:00:00 National rail 38
## 7 2020-03-22 00:00:00 National rail 35
## 8 2020-03-23 00:00:00 National rail 29.0
## 9 2020-03-24 00:00:00 National rail 24
## 10 2020-03-25 00:00:00 National rail 18
## # … with 30 more rows
There is something unfamiliar about the date
column that needs some explanation. Let’s check the type and class of date
.
typeof(rail_use$date)
## [1] "double"
class(rail_use$date)
## [1] "POSIXct" "POSIXt"
So the date
column is stored as a double and is a suitable continuous variable for a line plot but it’s also got some special properties, afforded to it by its POSIXct
class, that allows it to be treated as a date.
The POSIXct
class is how R represents dates, where POSIX is a standardization scheme in the world of computers, spanning multiple operating systems and programming languages, and the ct
part stands for calendar time. We won’t go into the details here but note that the numeric representation of a date, i.e. the double
value, is the number of seconds since 1 January 1970. For example, the date in our first row is:
rail_use$date[1]
## [1] "2020-03-16 UTC"
as.double(rail_use$date[1])
## [1]<PHONE_NUMBER>
We’re going to plot the volume of traffic on each date with each measurement represented as a point on our graph and observations on successive dates connected by a line. Looking at the geoms available in ggplot2 (see the list of functions available for ggplot2 by navigating to the ggplot2 package in the Packages tab in RStudio), it looks like geom_line
is the one we need.
The aesthetics section in the help page for geom_line
tells us we need an x and y mapping. Our x aesthetic will be date
and the y aesthetic will be percentage
.
ggplot(data = rail_use) +
geom_line(mapping = aes(x = date, y = percentage))
We can return to our original transport_use
table containing data for all transport modes and use another aesthetic, e.g. colour, to plot a line for each.
ggplot(data = transport_use) +
geom_line(mapping = aes(x = date, y = percentage, colour = transport_type))
Another aesthetic available for geom_line
is linetype
.
ggplot(data = transport_use) +
geom_line(mapping = aes(x = date, y = percentage, linetype = transport_type))
The geom for creating histograms is, rather unsurprisingly, geom_histogram()
.
ggplot(data = metabric) +
geom_histogram(mapping = aes(x = Age_at_diagnosis))
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
The warning message hints at picking a more optimal number of bins by specifying the binwidth
argument.
ggplot(data = metabric) +
geom_histogram(mapping = aes(x = Age_at_diagnosis), binwidth = 5)
Or we can set the number of bins.
ggplot(data = metabric) +
geom_histogram(mapping = aes(x = Age_at_diagnosis), bins = 20)
These histograms are not very pleasing, aesthetically speaking - how about some better aesthetics?
ggplot(data = metabric) +
geom_histogram(mapping = aes(x = Age_at_diagnosis), bins = 20, colour = "darkblue", fill = "grey")
Several of the variables in the METABRIC data set are categorical, i.e. they can take one of a limited set of values. Some of these have been read into R as character types (e.g. the 3-gene classifier), other as numerical values, e.g. tumour stage. We also have some binary variables that are essentially categorical variables but with only 2 possible values, e.g. ER status.
In many of the plots given above, ggplot2 has treated character variables as categorical in situtations where a categorical variable is expected. For example, when we displayed points on a scatter plot using different colours for each 3-gene classification, or when we created separate box plots in the same graph for ER positive and negative patients.
But what about when our categorical variable has been read into R as a continuous variable, e.g. Tumour_stage
, which is read in as a double type.
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, colour = Tumour_stage))
table(metabric$Tumour_stage)
##
## 0 1 2 3 4
## 4 475 800 115 9
Tumour stage has only 5 discrete states but ggplot2 doesn’t know these are supposed to be a restricted set of values and has used a colour scale to show them as if they were continuous. We need to tell R that these are categorical.
R has a special type for categorical variables called a factor. Let’s convert our tumour stage variable to a factor using the as.factor()
function.
metabric$Tumour_stage <- as.factor(metabric$Tumour_stage)
metabric[, c("Patient_ID", "Tumour_stage")]
## # A tibble: 1,904 x 2
## Patient_ID Tumour_stage
## <chr> <fct>
## 1 MB-0000 2
## 2 MB-0002 1
## 3 MB-0005 2
## 4 MB-0006 2
## 5 MB-0008 2
## 6 MB-0010 4
## 7 MB-0014 2
## 8 MB-0022 2
## 9 MB-0028 2
## 10 MB-0035 2
## # … with 1,894 more rows
R actually stores categorical variables as integers but with some additional metadata about which of the integer values, or ‘levels’, corresponds to each category.
typeof(metabric$Tumour_stage)
## [1] "integer"
class(metabric$Tumour_stage)
## [1] "factor"
levels(metabric$Tumour_stage)
## [1] "0" "1" "2" "3" "4"
ggplot(data = metabric) +
geom_point(mapping = aes(x = GATA3, y = ESR1, colour = Tumour_stage))
In this case the order of the levels makes sense but for other variables you may wish for more control over the ordering. Take the integrative cluster variable for example. We created a bar plot of the numbers of patients in the METABRIC cohort within each integrative cluster. Did you notice the ordering of the clusters? 10 came just after 1 and before 2. That looked a bit odd as we’d have naturally expected it to come last of all. R, on the other hand, is treating this vector as a character vector (mainly because of the ‘ER-’ and ‘ER+’ subtypes of cluster 4, and sorts the values into alphanumerical order.
metabric$Integrative_cluster <- as.factor(metabric$Integrative_cluster)
levels(metabric$Integrative_cluster)
## [1] "1" "10" "2" "3" "4ER-" "4ER+" "5" "6" "7" "8"
## [11] "9"
A look at the help page for as.factor
shows that we can create a factor using the factor()
function and specify the levels using the levels
argument.
metabric$Integrative_cluster <- factor(metabric$Integrative_cluster, levels = c("1", "2", "3", "4ER-", "4ER+", "5", "6", "7", "8", "9", "10"))
levels(metabric$Integrative_cluster)
## [1] "1" "2" "3" "4ER-" "4ER+" "5" "6" "7" "8" "9"
## [11] "10"
ggplot(data = metabric) +
geom_bar(mapping = aes(x = Integrative_cluster, fill = Integrative_cluster))
Let’s build a ggplot2 plot up in stages to understand what’s really going on.
plot <- ggplot(data = metabric)
What is the plot object we’ve just created?
typeof(plot)
## [1] "list"
length(plot)
## [1] 9
The plot object is a list containing 9 elements. It’s actually a special type of list.
class(plot)
## [1] "gg" "ggplot"
What are the 9 things in the list?
names(plot)
## [1] "data" "layers" "scales" "mapping" "theme"
## [6] "coordinates" "facet" "plot_env" "labels"
So far we’ve constructed ggplots from data, layers (geoms) and aesthetic mappings but do you notice the labels, scales, facet and theme elements? We’ll be looking at how to customize plots later, including changing the labels, altering the scales of axes, and applying a different visual theme.
The data
element is just the metabric tibble that we provided to the ggplot()
function.
plot$data
## # A tibble: 1,904 x 32
## Patient_ID Cohort Age_at_diagnosis Survival_time Survival_status Vital_status
## <chr> <dbl> <dbl> <dbl> <chr> <chr>
## 1 MB-0000 1 75.6 140. LIVING Living
## 2 MB-0002 1 43.2 84.6 LIVING Living
## 3 MB-0005 1 48.9 164. DECEASED Died of Dis…
## 4 MB-0006 1 47.7 165. LIVING Living
## 5 MB-0008 1 77.0 41.4 DECEASED Died of Dis…
## 6 MB-0010 1 78.8 7.8 DECEASED Died of Dis…
## 7 MB-0014 1 56.4 164. LIVING Living
## 8 MB-0022 1 89.1 99.5 DECEASED Died of Oth…
## 9 MB-0028 1 86.4 36.6 DECEASED Died of Oth…
## 10 MB-0035 1 84.2 36.3 DECEASED Died of Dis…
## # … with 1,894 more rows, and 26 more variables: Chemotherapy <chr>,
## # Radiotherapy <chr>, Tumour_size <dbl>, Tumour_stage <fct>,
## # Neoplasm_histologic_grade <dbl>, Lymph_nodes_examined_positive <dbl>,
## # Lymph_node_status <dbl>, Cancer_type <chr>, ER_status <chr>,
## # PR_status <chr>, HER2_status <chr>, HER2_status_measured_by_SNP6 <chr>,
## # PAM50 <chr>, `3-gene_classifier` <chr>, Nottingham_prognostic_index <dbl>,
## # Cellularity <chr>, Integrative_cluster <fct>, Mutation_count <dbl>,
## # ESR1 <dbl>, ERBB2 <dbl>, PGR <dbl>, TP53 <dbl>, PIK3CA <dbl>, GATA3 <dbl>,
## # FOXA1 <dbl>, MLPH <dbl>
This plot
list object is really only a specification for how ggplot2 should create the plot. ggplot2 only renders the plot when we ask it to by printing it out to the screen by typing print(plot)
or simply just plot
.
We haven’t added any layers yet so what does our plot look like at this point?
plot
ggplot2 doesn’t know what to plot yet as we haven’t added a layer (geom).
plot$mapping
## Aesthetic mapping:
## <empty>
plot$layers
## list()
Lets add an aesthetic mapping.
plot <- ggplot(data = metabric, mapping = aes(x = Nottingham_prognostic_index, y = ESR1, colour = ER_status))
plot
ggplot2 has automatically added scales for x and y based on the ranges of values for the Nottingham prognostic index and ESR1 expression. Still nothing has been plotted as we haven’t yet specified the type of plot (geom) to add as a layer.
plot$mapping
## Aesthetic mapping:
## * `x` -> `Nottingham_prognostic_index`
## * `y` -> `ESR1`
## * `colour` -> `ER_status`
plot$layers
## list()
Finally, let’s add a geom_point
layer to create a scatter plot.
plot <- plot + geom_point()
plot
plot$layers
## [[1]]
## geom_point: na.rm = FALSE
## stat_identity: na.rm = FALSE
## position_identity
We touched on statistical transformations earlier. The stat
associated with a geom_point
is stat_identity
which leaves values unchanged. In the case of a scatter plot, we already have the x and y values – they don’t need to be transformed, just plotted on the x and y axes.
In this session we have covered the following concepts:
Assignment: assignment3.Rmd
Solutions: assignment3_solutions.Rmd and assignment3_solutions.html


--- layout: post title: Presentation@Uni in Bremen date: 2007-12-05 11:45:52.000000000 -06:00 type: post parent_id: '0' published: true password: '' status: publish categories: - English - Projects - What??? tags: - bremen university - Geography - Germany - international co-work - presentation - university - urban economics meta: {} author: login: dreamessenceonthemove email<EMAIL_ADDRESS>display_name: darribas first_name: Daniel last_name: Arribas-Bel permalink: "/2007/12/05/presentationuni-in-bremen/" ---
Yesterday I gave my first presentation in english on geographical and urban economics. It was at the University of Bremen (Germany). Right now, I´m visiting my friend Fabian for a week, half of it in Hamburg and the other half one here in Bremen. Since he asked me to give such a speech, I couldn´t say no so I accepted and now I think it was a really good experience I should really be thankful to him about.
The presentation went in my view very well, it was in a very friendly environment and people even asked afterwards, which made me feel really fine. I hope it´s the first one of a long list of collaboration and co-work between Fabian and me from now on. Time will tell.
[You can check, download and use the presentation as long as you respect the CC license it is under, which basically imposes you to credit myseld whenever you use it, not to use it for a comercial purpose and to license everything you create from my presentation under the same or very close license. The .ppt is available in the downloads feature of this website, blue square on the left.]


You Are Hungry! is an app developed for the adventurous home cook who is always looking for new recipes...
Enter any ingredient, recipe name, or keyword and You Are Hungry! will display the top 10 results.
Automagically generated shopping list!? Yes, please! You Are Hungry! remembers your list so you never forget a thing.


Pick:
Downtime
Classroom materials
Tool development
Admin/Meetings
Onboarding
Troubleshooting
Custom:
Timestamp
Activity
Duration (m)
Activity
Time (m)


The <integrity-expansion-card> component is used for displaying expandable cards.
<integrity-expansion-card
title="French Id"
description="Default ID"
icon="person_outline"
[sections]="sections"
error="false"
[isDefault]="isDefault"
(bottomButtonClicked)="onBottomButtonClicked($event)">
</integrity-expansion-card>
export interface IExpansionCardSection {{ '{' }}
fields: Array<IExpansionCardSectionField>;
{{ '}' }}
export interface IExpansionCardSectionField {{ '{' }}
name: string;
values: Array<string>;
{{ '}' }}
| Attribute |
Required |
Value |
Description |
| title |
no |
text |
Title |
| description |
no |
text |
Description |
| icon |
no |
text |
The name of the material design icon |
| sections |
no |
IExpansionCardSection |
Sections displayed when the card is expanded. |
| error |
no |
text |
If the value is anything but '' or 'false', the color scheme and the description will turn red. |
| isDefault |
no |
text |
If the value is anything but '' or 'false', the card is marked as default |
| bottomButtonClicked |
no |
click event |
Click event triggered when the bottom button is clicked. |


Edit
Emergency Outdoor Patient
General Indoor Patient
Final Diagnosis Entry
Final Diagnosis
Diagnosis
Required
System Involved
Required


This package provides a logback appender that writes its log events to Cloudwatch.
The change log file shows the various features and bug fixes in each version.
CloudWatch Logback Appender home page.


Have a job that our community would be interested in? Please fill out this form.
{% if request.user.is_authenticated %}View your previously submitted job postings.
{% else %}If you have a Python.org login, please login and use this form to create a new job posting so it can be associated with your account for future edits.
If you have submitted jobs previously under your login, you can view them by logging in now.
{% endif %}


I am a web developer and I am currently learning at the Georgia Tech Coding Boot Camp.
I decided to start learning to further expand my knowledge on web developement and improve my career level. The goal is to eventually get into the
work field of a web
developer and land the ideal job.