DALEX: Descriptive mAchine Learning EXplanations
Machine Learning (ML) models are widely used and have various applications in classification
or regression. Models created with boosting, bagging, stacking or similar techniques are often
used due to their high performance, but such black-box models usually lack of interpretability.
DALEX package contains various explainers that help to understand the link between input variables and model output.
The single_variable() explainer extracts conditional response of a model as a function of a single selected variable.
It is a wrapper over packages 'pdp' and 'ALEPlot'.
The single_prediction() explainer attributes parts of a model prediction to particular variables used in the model.
It is a wrapper over 'breakDown' package.
The variable_dropout() explainer calculates variable importance scores based on variable shuffling.
All these explainers can be plotted with generic plot() function and compared across different models.
| Version: |
0.2.4 |
| Depends: |
R (≥ 3.0) |
| Imports: |
pdp, ggplot2, ALEPlot, breakDown, factorMerger, ggpubr |
| Suggests: |
gbm, randomForest, xgboost, testthat, dplyr |
| Published: |
2018-08-06 |
| Author: |
Przemyslaw Biecek [aut, cre] |
| Maintainer: |
Przemyslaw Biecek <przemyslaw.biecek at gmail.com> |
| BugReports: |
https://github.com/pbiecek/DALEX/issues |
| License: |
GPL-2 | GPL-3 [expanded from: GPL] |
| URL: |
https://pbiecek.github.io/DALEX/ |
| NeedsCompilation: |
no |
| Citation: |
DALEX citation info |
| Materials: |
NEWS |
| CRAN checks: |
DALEX results |
Downloads:
Reverse dependencies:
Linking:
Please use the canonical form
https://CRAN.R-project.org/package=DALEX
to link to this page.


Hello, World!
Hellow, World
Hello, World
Hello, World
Hello, World
This is a blockquote in Bootstrap4
This is a blockquote in Bootstrap4
This is a blockquote in Bootstrap4
This is a blockquote in Bootstrap4


Testing new operations¶
When adding new operations, it is a good idea to test them. Testing
should be done with the function nnvm.testing.check_function
. You
should provide it with the symbol representing the result of a
computation and a reference numpy implementation. By default, it will
also check analytical gradients against numerical gradients if
analytical gradients are implemented for your operation. You can also
pass a reference implementation for the gradients, but numerical
gradients will still be checked. Numerical gradient checking may be
switched off explicitly, but doing this is not a good idea generally.
Here is an example testing the logarithm operation:
import numpy as np
import nnvm
import nnvm.symbol as sym
from nnvm.testing.check_computation import check_function
x = sym.Variable("x")
y = sym.log(x)
def forward(x):
return np.log(x)
def backward(head_grads, x):
return [1. / x * head_grads]
dtype = "float32"
shape = {'x': (1, 3, 32, 32)}
check_function(y, forward, backward, in_range=(0.001, 2.0), dtype=dtype, shape=shape)
If you run the code above, you might get an AssertionError
in rare
cases. That’s why it is recommended to run new tests a lot of times.
for _ in range(10000):
check_function(y, forward, backward, in_range=(0.001, 2.0), dtype=dtype, shape=shape)
If you run the code above then sooner or later you will get an exception which may look like this:
AssertionError: Analytical and numerical grads wrt x differ too much
analytical grad = [
...
]
numerical grad = [
...
]
distance > atol*sqrt(n) + rtol*grad_norm
distance<PHONE_NUMBER>9765625 > 0.01*55.42562584220407 + 0.1*2167.70703125
It means that either you have a mistake in the FGradient
function or
the numerical error is too high. Generally, if you look at the printed
gradients and see that they differ only slightly or just in a single
position, then it is a numerical error. But if the gradients look
completely different, especially if many corresponding positions have
different signs, then it must be something wrong with the analytical
gradient implementation.
Then try to make this error reproducible, and also try to reduce the
shape of inputs, but not too much, a vector of 10 elements is a
reasonable choice. Also you won’t need reference functions forward
and backward
, and restricting the number of targets might also be a
good idea. Since the error may manifest itself only in rare cases, you
might want to run it in a loop.
shape = {'x': (10,)}
np.random.seed(42)
for _ in range(1000):
check_function(y, in_range=(0.001, 2.0), dtype=dtype, shape=shape,
numerical_grads=True, only_targets=['llvm'])
Running this code will result in the following:
check_function failed while checking gradients numerically, here is the main graph
Graph(%x, %head_grads_0) {
%x, shape=[10], dtype=0
%head_grads_0, shape=[10], dtype=0
%1 = log(%x), shape=[10], dtype=0
%3 = elemwise_div(%head_grads_0, %x), shape=[10], dtype=0
ret %1, %3, %head_grads_0
}
graph_attr_keys = [layout_inputs, dtype_num_unknown_nodes, dtype, shape_num_unknown_nodes, shape]
Generated inputs:
{'x': array([2.5660574e-01, 1.5313280e+00, 1.0232578e-03, 8.3371508e-01,
1.0454979e+00, 1.1021420e-01, 1.9461832e+00, 4.5302454e-01,
6.0909325e-01, 6.0858107e-01], dtype=float32), 'head_grads_0': array([0.4616029 , 0.00394617, 1.4589603 , 1.9337242 , 0.44936267,
1.3264314 , 1.4840508 , 1.6970023 , 0.84583575, 0.60655886],
dtype=float32)}
...
AssertionError: Analytical and numerical grads wrt x differ too much
analytical grad = [1.7988799e+00 2.5769596e-03 1.4257993e+03 2.3194065e+00 4.2980734e-01
1.2035031e+01 7.6254421e-01 3.7459390e+00 1.3886802e+00 9.9667716e-01]
numerical grad = [1.7948151e+00 1.9073486e-03 9.9268610e+02 2.3174286e+00 4.2915344e-01
1.1980057e+01 7.6198578e-01 3.7412643e+00 1.3866425e+00 9.9563599e-01]
distance > atol*sqrt(n) + rtol*grad_norm
distance<PHONE_NUMBER>1484375 > 0.01*3.1622776601683795 + 0.1*992.7716674804688
In this case the largest difference is in the 2nd position (starting
from 0) which corresponds to input value 1.0232578e-03
. This value
is too close to the singularity, so the numerical derivative gets too
imprecise. The solution is to shrink the range for x
, here, for
example, (0.002, 2.0)
turned out to be enough. Don’t forget to run
lots of tests, so that other people don’t get false positives.
for _ in range(100):
check_function(y, in_range={x: (0.002, 2.0)}, dtype=dtype, shape=(1, 3, 32, 32),
numerical_grads=True, only_targets=['llvm'])
If you need a more precise control over which values get passed to the
checking function, you can use values={x: ...}
:
x_val = np.array([1.2594858e+00, 1.0960974e-01, 1.4975418e+00, 6.3585603e-01,
1.2692513e-03, 1.0227472e+00, 9.4656967e-02, 5.5306298e-01,
1.4142460e+00, 1.2631655e-01], dtype=np.float32)
check_function(y, values={x: x_val}, dtype=dtype, shape=shape,
numerical_grads=True, only_targets=['llvm'])


Welcome to this demonstrator of our brand-new state of the art speech recognition technology
Test it, feed us with a few words
We are a team of 13 first year students at MINES ParisTech
We've been working for 3 weeks on speech recognition at the CMA. We've build from scratch an isolated spoken word recognition engine that works pretty well, and the tools to use it easily. This webapp is part of it.
Our project has been written with Python, and its source is hosted on our Git repository
You'll find our GitHub profiles on
our Git repository page.
The maintainer of that webapp can be contacted at
speechapp@wumzi.info.


The Basic Toolset
Gp.Basic.checkForHTML5()
Returns true if the browser appears to support HTML5 and false if it doesn't.
Gp.Basic.html5Message()
Checks to see if the browser supports HTML5 and if it doesn't, looks for an element in the
page with the id "gp-upgrade" and displays a message recommending that the user upgrade
their browser to the 21st century.
Note that this function is automatically called on document load meaning there will never be a reason to call it directly. To take advantage, you only need to put an element (such as a DIV or SPAN) in your document with the id "gp-upgrade" as follows:
Note that this function is automatically called on document load meaning there will never be a reason to call it directly. To take advantage, you only need to put an element (such as a DIV or SPAN) in your document with the id "gp-upgrade" as follows:

With that element in place, the rest is automatic. Honestly ... at this point none of these
websites are money making ventures for me so I have no interest in supporting someone who
won't accept a free browser upgrade in order to get an up to date web experience. I mean
really!

Email:
id - id of the element to add the email link to.
user - user name portion of the email address.
domain - domain name portion of the email address.
link - [optional] link text (defaults = email address).
To use this function, you first need an element in the page where the address will be placed
and that element must have an id.
user - user name portion of the email address.
domain - domain name portion of the email address.
link - [optional] link text (defaults = email address).

Next the function needs to be called. The arguments to the function are the element id, the
user name, the domain name, and the optional link text. As an example, if I wanted to send an
email to<EMAIL_ADDRESS>I would call:
Gp.Basic.emailLink("mail-link", "glenn", "gp_tools.com");
Or if I wanted something besides the email address as the link text, I would add that as a
fourth argument.
Gp.Basic.emailLink("mail-link", "glenn", "gp_tools.com", "Email me here.");
The result should look something like:
Email:
Gp.Basic.fixEmailLinks()
Looks for all elements in a page using the class "gp-send-mail" and for each element
found, inserts an email link into the element using custom data attributes specified on the
element itself. Like the previous function, the email is inserted in such a way that makes
it difficult for spam bots to find.
Note that this function is automatically called on document load meaning there will never be a reason to call it directly. To take advantage, you need to specify an element (usually a SPAN element) in your document for each email link in the page. Each of those elements must use the class "gp-send-mail". At a minimum, each element must contain a custom attribute for the user name and another custom attribute for the domain name. You can also specify an optional third custom attribute containing the link text. If you leave that last attribute off, the email address will be used.
So let's say you want put in an email link just like in the last function, you would need only the following HTML.
Note that this function is automatically called on document load meaning there will never be a reason to call it directly. To take advantage, you need to specify an element (usually a SPAN element) in your document for each email link in the page. Each of those elements must use the class "gp-send-mail". At a minimum, each element must contain a custom attribute for the user name and another custom attribute for the domain name. You can also specify an optional third custom attribute containing the link text. If you leave that last attribute off, the email address will be used.
So let's say you want put in an email link just like in the last function, you would need only the following HTML.

Or if you wanted an additional link but wanted to specify link text other than the email
address, you can add a custom attribute for that as in the following.

That's it. The function is called automatically on document load leaving the two elements to
display as follows:
Gp.Basic.insertCopyright()
Looks for an element with the id "gp-copyright" and if such an element is found,
inserts a copyright message into that element based on the year of today's date.
Note that this function is automatically called on document load meaning there will never be a reason to call it directly. To take advantage, you need an element (such as a DIV or SPAN in your document with the id "gp-copyright". Additionally, you need to specify who to attribute the copyright to. This can be done through an additional attribute on the element "data-who". So if I want to attribute a copyright to myself, I would put the following in my page:
Note that this function is automatically called on document load meaning there will never be a reason to call it directly. To take advantage, you need an element (such as a DIV or SPAN in your document with the id "gp-copyright". Additionally, you need to specify who to attribute the copyright to. This can be done through an additional attribute on the element "data-who". So if I want to attribute a copyright to myself, I would put the following in my page:

With that element in place, the rest is automatic. See the very bottom of this page to see
what the output looks like.
Gp.Basic.openWindow(url, width, height, scrollbars)
Allows for another browser window to be opened using a specified url.
Click Me
Before LightBox came along, I used to use this to popup full sized images from thumbnails.
url - url of the file to open in the new browser window.
width - width of new browser window.
height - height of new browser window.
scrollbars - [optional] display scrollbars ("true" or "false").
This function can be called from another script or can be called right in the page. I've
frequently used this function in the "onclick" handler for an HTML anchor. The link
below was written:
width - width of new browser window.
height - height of new browser window.
scrollbars - [optional] display scrollbars ("true" or "false").
Click Me
Click the link below and watch the new window open up.
Click Me
Before LightBox came along, I used to use this to popup full sized images from thumbnails.
Gp.Basic.randomImage(id, howmany, location, suffix)
The random image function allows the website developer to display one out of a collection of
images but have the specific image in the collection chosen at random every time the page is
reloaded.
id - id of the  element that will display the random image.
howmany - number of images in the collection to choose from.
location - location of the images (optional, default = same as page).
suffix - [optional] suffix of the image file (default = "jpg").
In order for this to work, the images must all reside in the same location, must be of the
same format (all of the file suffixes must match), and must follow a specific naming criteria.
The images must be named using the image element id followed by a dash and a 1-based index.
For example, if you have a collection of six images and the name you pass in is "picture",
then it will be assumed that your collection of images looks like:
howmany - number of images in the collection to choose from.
location - location of the images (optional, default = same as page).
suffix - [optional] suffix of the image file (default = "jpg").
picture-1.jpg
picture-2.jpg
picture-3.jpg
picture-4.jpg
picture-5.jpg
picture-6.jpg
Next, is the image placement. This is done by simply putting an IMG element in your page and
setting the element id to the common image name (minus any extra digits). Note that this is
crucial. If the id and the name do not match, nothing will display. Going back to the six
image collection shown above then, you would put the following in your page:
picture-2.jpg
picture-3.jpg
picture-4.jpg
picture-5.jpg
picture-6.jpg

Lastly you need to call the function. This can either be done inline within a


For this milestone, you'll be creating a design doc for your wiki formatting implementation.
This is expected to be completed as a group.
In this section, describe the problem you're trying to solve (formatting). Keep it brief: just a few sentences or less. Don't go into your proposal or implementation details.
In this section, describe a high level overview of how you intend to implement Wiki Formatting. Keep it just a couple paragraphs or less.
In this section, you get to describe the fine details on how you plan to implement the formatting requirements. Feel free to add subsections here as necessary to talk about individual functionalities.
This section should be the longest section of your design document. While small code snippets are permissible to discuss implementation, they should be generally backed by textual descriptions.
In this section, describe how your design mitigates dangerous HTML insertions. For example, prevents the following code snippet from being displayed as HTML:
<script>window.alert("Hacked!")</script>
In this section, describe alternative approaches (create one alternative approach per subsection), and why you decided not to use these approaches.
You must discuss at least two alternative approaches.
This section should be a bulleted-list of links or resources that may be useful to a reader looking to get more background on your document.
You must link at least one resource.
To submit your document, press File > Download > PDF
in Google Docs. Upload the PDF to your Cloud Console, and commit it as FormattingDesignDoc.pdf
in your wiki repository. Push the commit to GitLab to submit.
Discuss at least two alternative proposals in your alternatives considered section.
Don't allow HTML tags other than a limited subset of allowed tags.
Remember: to receive a grade, you must submit a peer feedback form indicating which work you did and which was done by your teammates. This will be sent to you shortly after the due date.


ColorPickerDelegate
@objc(HBColorPickerDelegate)
public protocol ColorPickerDelegate : NSObjectProtocol
Use ColorPickerDelegate
to handle the user’s response to ColorPickerViewController
.
-
Informs the delegate that the user has selected a color in the color picker. Optional.
Use this to update your user interface with the new color value, if suitable to your use case.
You should, at minimum, implement either this method or
colorPicker(_:didAccept:)
. If you don’t intend to implement this method, it is expected that you implementcolorPicker(_:didAccept:)
. If you implement this method and the user selects Cancel, this method will be called with the initial color passed in viaColorPickerConfiguration.color
to undo the selection.Declaration
Swift
@objc(colorPicker:didSelectColor:) optional func colorPicker(_ colorPicker: ColorPickerViewController, didSelect color: UIColor)
Parameters
colorPicker
The
ColorPickerViewController
instance that triggered the action.color
The
UIColor
selection the user made. -
Informs the delegate that the user has dismissed the color picker with a positive response, having selected the selected color. Optional.
You should, at minimum, implement either this method or
colorPicker(_:didSelect:)
.Declaration
Swift
@objc(colorPicker:didAcceptColor:) optional func colorPicker(_ colorPicker: ColorPickerViewController, didAccept color: UIColor)
Parameters
colorPicker
The
ColorPickerViewController
instance that triggered the action.color
The
UIColor
selection the user made. -
Informs the delegate that the user has dismissed the color picker with a negative response. Optional.
You usually do not need to handle this condition.
Declaration
Swift
@objc(colorPickerDidCancel:) optional func colorPickerDidCancel(_ colorPicker: ColorPickerViewController)
Parameters
colorPicker
The
ColorPickerViewController
instance that triggered the action.


Dakota Den
Pairing and Giving Feedback
September 28, 2014
Pairing Pairing with others to solve a problem is a skill required from any successful programmer. However, it does take some practice to utilitize them to their maximum potential. They are a great way to learn new methods. That's the most rewarding part for me. It's hard for me to learn from dry readings, but put me with a teacher/someone who can explain what they're doing, and I pick it up very fast. I have learned simpler methods and newer ways of looking at things just by listening and taking example from others. The Most frustrating part for me, however, is having to change how I work. Normally I quickly dive in and begin experimenting. With another person, I have to slow down, explain every detail, and can't do as much experimentation. Feedback When reading my feedback, I feel like I have a lot to work on! The feedback I recieved is very helpful, because it shows me how to become a better pairing partner. Next time I pair, I'm going to make sure and slow down. I need to better explain what I'm doing, that way my partner will be able to check my logic and off suggestions to keep my logic clear. Writing feedback tends to be hard for me. Unless there is something glaringly obvious I have a hard time giving someone suggestions. That might be because I am slightly timid, but I need to work on that anyway. Two birds! Overall, using pairing sessions and feedback is an excellent way to increase your programming skills.


Home
Trip Information
Designated Speeds
Map
Trip Map
Motor
General
Temperature Graph
About
Battery
General
Temperature Graph
About
CONTENT


group.cs242.beatblocks
Interfaces
ScoreUpdateListener
Classes
Beat
BeatBlockBoard
BeatBlockBoardView
BeatMap
BeatMapView
GameActivity
GameBoard
GameOverActivity
HelpActivity
Index
Song
StartScreenActivity


Tests the hide shortcut, which toggles visibility:hidden on the node and it's ancestors.
Bug 110641
parent
hidden
child


Expected (appeared in the first 10 predictions)
Somewhat predictable (appeared in the first 100 predictions)
Somewhat unpredictable (appeared in the first 1000 predictions)
Unexpected (didn't appear in the first 1000 predictions)
Hints:
- Hover over a word to show other predictions
- Click on an alternate prediction to replace the word in the text


It consists of two functions that you can use in your m-files,
Installation
where <full path to matlab> is replaced by the file system path on your computer.
Example Use
The following example MATLAB m-file code will load a file called 'all_aml_test.res' that
is in MATLAB's present working directory, reports the size of the data matrix, and then writes
the data back out in the odf format. MATLAB responses are shown in italics.
>>all_aml_test = loadGenePatternExpressionFile('all_aml_test.res')
all_aml_test =
data: [7129x35 double]
rowNames: [7129x1 java.lang.String[]]
columnNames: [35x1 java.lang.String[]]
rowDescriptions: [7129x1 java.lang.String[]]
columnDescriptions: [35x1 java.lang.String[]]
>> size(all_aml_test.data)
ans =
7129 35
>> writeGenePatternExpressionFile('all_aml_test_fromMATLAB', 'odf',all_aml_test.data, \
all_aml_test.rowNames, all_aml_test.columnNames,all_aml_test.rowDescriptions);
Function Definitions
function expressionDataset=loadGenePatternExpressionFile(path)
% Load a res, gct or odf file into a MATLAB structure
%
% Parameters
% path - full path to a res, gct or odf format expression file
%
% Return: A MATLAB structure with the following elements
% data - M by N matrix of doubles
% rowNames - M*1 array of Strings
% columnNames - N*1 array of Strings
% rowDescriptions - M*1 array of strings
% columnDescriptions - unless loading from a gct file
%
function writeGenePatternExpressionFile(path, format, data, rowNames, columnNames, rowDescriptions, colDescriptions, calls)
% Write a res, gct, mage or odf file with data provided.
%
% Parameters
% path - filename (incl path) to write to
% format - One of res, gct, odf, mageml
% data - M by N matrix of doubles
% rowNames - M*1 array of Strings
% columnNames - N*1 array of Strings
% rowDescriptions - M*1 array of strings
% columnDescriptions - unless loading from a gct filefrom a MATLAB
% matrix (if absent, columnNames will be used for this)
% calls - M*N matrix of ints for A/P calls (res format only)
%
% Return
% none.


Things to Fear
Description
Size
Weight
Speed
.38 Special
Five-inch barrel.
20 oz
Six rounds in four seconds.
Rhinoceros
Twelve feet, horn to tail.
2 tons
Thirty-five miles per hour in bursts.
Broad Axe
Thirty-inch blade.
12 lbs.
Sixty miles per hour on impact.


An Easy Linear Time Longest Palindromic Substring finding Algorithm
06 Dec 2014 Algorithms · C++I would like to discuss a simple and easy to understand algorithm for finding longest palindromic substring in linear time. I stumbled upon this during the Algorithms Lab Test. This is very similar to other algorithms but yet different.
/*
* File: main.cpp
* Author: abinashmeher999
*
* Created on 16 November, 2014, 2:13 PM
*/
#include <iostream>
#include <string>
#include <cmath>
#include <new>
#include <algorithm>
using namespace std;
/*This algorithm uses just O(n) extra space only
that too only one more integer array of length n.
With this algorithm we need to traverse the array only twice,
if we exclude the one needed to initialize all to 1.
So both time and space complexity wise, this seems good.*/
int longestpalsubstr(string A) {
//there are no nested 2 'for' loops in this function
//(except in printing the max substring but that too can be done
//in O(n))
int n = A.size();
int *Y = new int[n];
int temp = 1, max;
char t;
//initializes the array
for (int i = 0; i < n; i++) {
Y[i] = 1;
}
//print the given string
cout << "S = " << A << endl;
//calculates the length of same character substring after the
//alphabet including itself
//like for a,b,a, b,b,b, a, b,b,b, a,b,a
// 1,1,1, 3,2,1, 1, 3,2,1, 1,1,1
for (int m = n - 1; m > 0; --m) {
t = A.at(m);
Y[m] = temp; //which is equal to 1 initially
if (m - 1 < 0) break;
if (A.at(m - 1) == A.at(m)) {
++temp;
continue;
} else {
temp = 1;
}
}
if (A.at(0) == A.at(1)) {
Y[0] = Y[1] + 1;
}
//prints Y
cout << "Y = ";
for (int m = 0; m < n; m++) {
cout << Y[m] << "";
}
cout << endl;
//finds the maximum palindrome length that
//starts with the character at index k
for (int k = n - 2; k > 0; k--) {//traverses the array from the end
if (k + Y[k] < n) {
//checks if the index to be accessed is within n-1
if (A.at(k - 1) == A.at(k + Y[k])) {
//checks if, preceeding char == char at index(k+Y[k])
Y[k - 1] = Y[k] + 2;
//if yes increases Y[k-1] by 2
}
}
}
//there are exceptions, but it doesn't
//compromise with the final answer
// 0 1 2 3 4 5 6 7 8 9 10
//like S = a ,c,c,c,a,c,a,c,c,c,a
// Y = 11,9,7,5,3,1,5,3,1,1,1
//in this case for c in middle (index 5) it is 1
//(when Y by common sense should contain 3)
//but we still get the correct answer, so we cant say that
//for all cases Y contains the length of the largest
//palindrome starting from that index
//prints Y
cout << "After finding longest palindromic substring\nY = ";
for (int m = 0; m < n; m++) {
cout << Y[m] << ",";
}
cout << endl;
//finds maximum in Y
max = *max_element(Y, Y + n);
//for printing purposes only
cout << "Part II: Length = " << max << ". Substrings: ";
for (int i = 0; i < n; i++) {
if (Y[i] == max) {
for (int j = 0; j < max; j++) {
cout << A.at(i + j);
}
cout << " ";
}
}
cout << "\n";
return max;
}
int main() {
int max;
string A;
cout << "Enter the string" << endl;
cin >> A;
max = longestpalsubstr(A);
return 0;
}
comments powered by Disqus


Last two examples are as the previous, but add data-type-range-step="5":
data-type-range-step="5"
This one has the last value set to 51, instead of 50:


Overview
This weather app a programming example built on AngularJS 1.5.11. It uses the OpenWeatherApp API 0.1.6. It borrows the basic design of the Bing weather app on Windows desktop. I have tested it only on Chrome.
The app is functional and the code is fairly tight, but this was a quick demonstration project. Some of the first things I would do if this were a real-world project are: convert "wind" and "barometer" values into something more meaningful; various refactorings; test on multiple browswers.
Main Features
- One button calls both the current-weather API and the 5-day forecast API
- The user can input either a city name or a zip code. The app detects whether a zip code has been entered and forms its call to the api accordingly
- The user can also pick a city from a dropdown of previously saved cities
- Cities can be saved to the user's local storage
- The same city is not saved multiple times
- The "Save City" button is disabled when there is no city to save
Technical Points of Interest
- Integrates third-party weather icons, mapping the OpenWeather codes to the appropriate icons
- Modifies the incoming weather data for ease-of-use in the markup
- Implements routing
- Uses Angular Resource rather than $http
- Implements AngularJS components instead of controllers
- Is installable via
npm install
- Is runnable using
npm start
- Uses dynamically loaded webfonts
Technologies Uses
- AngularJS 1.5.11
- Bootstrap 3.3.7
- Angular Moment
- Angular Local Storage
- Angular Resource
- node and npm
- bower
- Coded in SublimeText3


Exit
Team Builder
level
Name
special
Phys
Ele
HP
Arm
Lead
Skill 1
Skill 2
Skill 3
Left
Select this Warrior
Right


I wanted to go to the party,
But I woke up late this morning, and it threw off my entire day.
And I'm so very sorry, but I can't make it now, there's just no way.
I wanted to go to the reunion,
But I got a flat tire, and I had to call for repairs.
They took so long and well the entire thing had me in tears.
I wanted to go to our dinner,
But my dog got sick, I spent hours cleaning it up.

I wanted to go to class,
But I got stuck in traffic, it was bizarre.
I thought it was safer to turn 'round the car.
I wanted to go to work,
But I slept though my alarm again.
And this happens every now and then.
I wanted to go hangout,
"No thanks, flake," they crowed.
It's not my fault though!


Example Collections
Our example collections are included to illustrate various aspects of how we organize data in the DAMS and methods we use to add data into the DAMS. Each collection will include some information about what particular aspects of the DAMS are being represented for that example. In addition, each collection includes sample data and an installation script.
Please note that every script will require the FIN Command Line Interface
fin-cli. Although lots of interaction with the [Fedora-LDP] can be performed
directly with a standard HTTP client, the fin-cli simplifies many components;
in particular authorization, access control, and some more complicated container
creation. The fin-cli is a node-js component and can be installed on most
operating systems with the command: npm install @ucd-lib/fin-cli
or sudo npm
install -g @ucd-lib/fin-cli
to install system-wide.
In addition to the organization, we also use these examples to illustrate various ervices that are available through our DAMS.
These collection describe the standards we use in how data should be added to the system. Each individual collection has it’s own README that documents some of the features of our DAMS. There are a few examples that should probably be done in order, Pets and Photos. After that, the examples can be looked at in pretty much any order.
-
Pets This is the first, most simple example of using the LDP. It introduces schema.org, and how we use that to define our collections and items. The items in our pets collection are born digital which simplifies some of organization of the data files. We also introduce a lot of the concepts that we use for all collections.
-
Photos This collection shows how physical items should be documented. This shows the layout for adding associated Digital data (in this case images) for the physical items.


Elion header koosneb top ja main menyyst.
{{>_components/headernavigation/_header-top-navigation}} {{>_components/headernavigation/_header-main-navigation}}
The component requires the header-navigation.css
and headernavigation.js
to be included (not yet generated)
find here app/partials/_components/headernavigation
Header navigation component main style file is app/assets/_header-navigation.scss
Header navigation component dependency


--- title: About ---
Canada
arturoComputes [at] gmail [dot] com
👨💻 I'm a computer scientist specialized in Machine Learning and Natural Language Processing
I'm also
🗺 a traveler,
🍪 a cook,
🍲 an avid eater,
📷 a photographer,
🎧 a podcast listener,
💉 an unexpected translator, science-based public health information spreader & information-access-in-different-languages advocate,
🚲 a cyclist,
⚽ a soccer player,
👅 a polyglot 🇲🇽 🇨🇦 🇫🇷 🇩🇪 🇯🇵 🔜 🧏,
🎪 an event organizer,
👂 and a good listener
🐍 Python is what I mostly code in, but I have experience with shell scripting, MATLAB, LaTeX and some JavaScript
🖥 Lately I've been using scikit-learn, TensorFlow, pandas, XGBoost and Jupyter/IPython
👉 You can read more about my background on LinkedIn
🕐 TL;DR: Before grad school, I was a Natural Language and Data Scientist at Awake Labs, a Speech Scientist at Nuance, a Research Assistant in TAGlab in the Computer Science department at the University of Toronto, and a Software Development intern at Psiphon
👨🎓 NAIST NLP master's student 2022-2024. Before, I did computer science at UofT, as well as a psychology major and a linguistics minor. I published one of my projects with Prof. Graeme Hirst on text classification in a medical setting


---
layout: post
title: "Quantum Phase Estimation and Hadamard test"
date: 2018-05-20
categories: twentyeighteen
---
Quantum Phase estimation is an important subroutine in quantum computing. It’s used for factoring, quantum simulation, and discrete logarithm. A version of Phase estimation called the Hadamard test is used to approximate the Jones polynomial (a significant expression in Knot theory). Quantum computers can estimate phases more efficiently than classical computers because quantum computers can exploit the Quantum Fourier transform; which requires $O(n^2)$ gates instead of $O(n*2^n)$ on classical computers. This post will cover Phase Estimation and Hadamard test including their implementations on a quantum computer. Quantum Phase estimation solves: Given a Unitary $\textit{U}$ and an eigenvector of $\textit{U}$ $\ket{\psi}$ such that $U\ket{\psi}$ = $e^{2 \pi i \theta}$ where $0 \leq \theta < 1$, find the eigenvalue $e^{2 \pi i \theta}$ of $\ket{\psi}$ or the phase $\theta$. This algorithm uses 2 registers. The first register contains $m$ qubits. The more $m$ qubits, the more accurate $\theta$'s estimation will be. The second register contains $\ket{\psi}$. Quantum Phase estimation first prepares the state $\ket{0}_{m} \ket{\psi}$ by intilizing the first $m$ qubits to $\ket{0}$ and encoding $\ket{\psi}$ in the second register. Hadamard gates are applied to each qubit in the first register $2^{m-1}$ controlled-U (cU) gates are applied to the second register, remember that $U \ket{\psi}$ = $e^{2 \pi i \theta}$ This equation can be written as Which is similiar to the Quantum Fourier transform The first register of $\ket{\varphi_{1}}$ is similar to QFT $\ket{x}$ (QFT $\ket{\theta}$). To get $\ket{\theta}$, the inverse of the Quantum Fourier transform (QFT in reverse) is applied to the first register. The state of the second register doesn't change during computation, so the final state of the system before measurement is $\ket{\theta_{0} \, \theta_{1} \, \theta_{2} ... \, \theta_{m} } \ket{\psi} $. Measurement of the first register will result in an approximation of $\theta$. Given a unitary
$U = \begin{bmatrix}
0 & 1 \\
1 & 0 \\
\end{bmatrix} $, and an eigenvector of $U$ (1, 1), with an eigenvalue of $\lambda = e^{2 \pi i \theta}$, find the phase ($\theta$). A calculation for the eigenvalues of U gives $\lambda_{1} = 1$ and $\lambda_{2} = -1$. So $\theta_{1} = 0$ and $\theta_{2} = \frac{1}{2}$. The phases can be calculated on a quantum computer where $\theta_{1}$ corresponds to the measured result $0$ and $\theta_{2}$ to $1$ because it's the only other option (using more qubits to estimate $\frac{1}{2}$ is not neccesary in this case). The eigenvalue can be approximated wih a single bit, so the first register will contain a qubit. The second register will also contain one qubit because $U$ is a one qubit gate (i.e X gate). To encode the eigenvector (1,1) into the second register, it has to be nomalized to $(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$. The Hadamard gate is applied to the first qubit resulting in $\frac{1}{\sqrt{2}}[(\ket{0} + \ket{1}$. The normalized eigenvector $\ket{\psi}$ is encoded using the Hadamard gate. The state of the system is Applying the cU gate The inverse QFT of this equation is calculated by applying the Hadamard gate to the first qubit. Measuring the first qubit gives $0$ as predicted by theory. To estimate $\theta_{2}$, another eigenvector of $U$ (-1, 1) normalized to $(-\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$ will be loaded into the second register. This is accomplished by the the Hadamard gate followed by the Z gate The remaining instructions for this program will be the same as the previous one.Quick calculations will show that the first register contains $\ket{\frac{1}{2}}$. These programs are implemented here.Introduction
Quantum Phase estimation
$\newcommand{\ket}[1]{\left|{#1}\right\rangle}$
$\newcommand\bra[1]{\langle{#1}|}$
Quantum Phase estimation example
Phase estimation implementation on a Quantum computer
phase_estimation_0 = Program(
H(0),
H(1),
CNOT(0, 1), #CNOT is another name for cX which is cU in this example
H(0),
)
print("Expected answer is 0")
result = qvm.run_and_measure(phase_estimation_0, [0], 1)
print(result)
phase_estimation_1 = Program(
H(0),
Z(0),
H(1),
CNOT(0, 1), #CNOT is another name for CX which is CU in this example
H(0),
)
print("Expected answer is 1")
result = qvm.run_and_measure(phase_estimation_1, [0], 1)
print(result)
The Hadamard test solves: Given a Unitary $U$ and a state $\ket{\psi}$, estimate $\bra{\psi} | U \ket{\psi}$. It prepares the state $\frac{1}{\sqrt{2}}(\ket{0} + \ket{1}) \ket{\psi}$ by appplying the hadamard gate to the first qubit, applies cU from $\frac{1}{\sqrt{2}}(\ket{0} + \ket{1})$ to $\ket{\psi} $ to get $\frac{1}{\sqrt{2}}(\ket{0} \ket{\psi} + \ket{1} U \ket{\psi})$. After the Hadamard gate is applied to the first qubit again, the probability of measuring $\ket{0}$ is \[\frac{1}{2} (1 + \text{Re} \bra{\psi} U \ket{\psi}) \] The probability of measuring $\ket{1}$ is \[\frac{1}{2} (1 - \text{Re} \bra{\psi} U \ket{\psi})\] The result we want to approximate is calculated by subtracting probabilities \[ \text{Re} \bra{\psi} U \ket{\psi} = \frac{1}{2} (1 + \text{Re} \bra{\psi} U \ket{\psi}) - \frac{1}{2} (1 - \text{Re} \bra{\psi} U \ket{\psi}) \] where $\text{Re} \bra{\psi} U \ket{\psi}$ is the real component of $\bra{\psi} U \ket{\psi}$. $\text{Im} \bra{\psi} | U \ket{\psi}$ is estimated by first preparing the state $\frac{1}{\sqrt{2}}(\ket{0} + i \ket{1})$ instead of $\frac{1}{\sqrt{2}}(\ket{0} + \ket{1})$. This is prepared by applying the Hadamard gate followed by the S gate. The steps involved in deriving expected values are here
Given a unitary $U = \begin{bmatrix} 0 & 1 \\ 1 & 0 \\ \end{bmatrix} $, and a state $\ket{1}$, estimate $\bra{1} | U \ket{1}$. $\bra{1} U \ket{1}$ = $\bra{1}\ket{0} = 0$.
Encoding $\ket{1}$ is fulfilled by applying the X gate on the second qubit. $\ket{0} \text{X}(\ket{0}) = \ket{0} \ket{1}$. The Hadamard gate is applied to the first qubit $H (\ket{0}) \ket{1}$ = $\frac{1}{\sqrt{2}}(\ket{0} + \ket{1}) \ket{1}$. Applying CU to the system \[CU [\frac{1}{\sqrt{2}}(\ket{0} + \ket{1}) \ket{1}] = \frac{1}{\sqrt{2}}(\ket{0} \ket{1} + \ket{1} U \ket{1}) = \frac{1}{\sqrt{2}}(\ket{0} \ket{1} + \ket{1} \ket{0}) \] Applying Hadamard to the first qubit results in: \[ H \otimes I (\frac{1}{\sqrt{2}}(\ket{0} \ket{1} + \ket{1} \ket{0})) = \frac{1}{2}\ket{00} + \frac{1}{2}\ket{01} - \frac{1}{2}\ket{10} + \frac{1}{2}\ket{11} \] This means that there is a 0.25 probability qubit 1 is 0 and 0.25 that it's 1 upon measurement. 0.25 - 0.25 = 0, the expected value.
hadamard_test0 = Program(
X(0),
H(0),
CNOT(0, 1),
H(0),
)
print("Expected value will be closer to 0 than 100 or -100")
result = qvm.run_and_measure(hadamard_test0, [0], 100)
print(get_Re(result))
The Hadamard test is probabilistic. It will give an expectation value that is close to 0 as is predicted by theory.
What if $\ket{\psi}$ is $\frac{1}{\sqrt{2}}(\ket{0} + \ket{1})$ instead of $\ket{0}$? $\bra{\frac{1}{\sqrt{2}}(\ket{0} + \ket{1})} U \ket{\frac{1}{\sqrt{2}}(\ket{0} + \ket{1})} = \bra{\frac{1}{\sqrt{2}}(\ket{0} + \ket{1})} \ket{\frac{1}{\sqrt{2}}(\ket{0} + \ket{1})} = 1 $. Executing this program on a quantum computer shows that the answer is 1.
hadamard_test1 = Program(
H(1),
H(0),
CNOT(0, 1),
H(0),
)
print("Expected value will 1")
result = qvm.run_and_measure(hadamard_test1, [0], 1)
print(get_Re(result))
Implementations of these Hadamard tests are here
Finding the eigenvalues of an operator is an important problem in Linear algebra. Quantum Phase Estimation and it's cousin the Hadamard test are important subroutines for quantum algorithms that leverage the Quantum fourier transform to perform operations more efficiently on quantum computers than classical computers. Phase estimation can be used in quantum simulation and factoring. The Hadamard test is used to solve the Jones polynomial; which is important in knot and topological quantum field theories. This post covered examples of how the Hadamard test and Phase Estimation algorithm work.
Discuss on Github


WITNESS LIST Funding Issues in Education (Interim) Committee April 8, 1998-8:30A AUF/PUF Bond Proceeds On: Cunningham, Wm. H. (UT System), Austin Lindsay, Richard (A&M System), College Station Scott, Tom (UT System), Austin Thompson, Barry B. (A&M System), College Station Capital Allocation Comparison On: Beck, Deborah (LBB), Austin Distribution of Available School Fd On: Parks, Ursula (LBB), Austin Formula Fding, A&M Service Agencies On: Calvert, Stanton C. (A&M System), Austin Wright, Eric (Senate Fiance Comm), Austin Formulas for Health Science Ctrs On: Scott, Tom (UT System), Austin Higher Ed Fund Formula/Allocation On: Brown, Don W. (THECB), Austin Elliott, Roger W. (THECB), Austin Infrastructure Formula On: Elliott, Roger W. (THECB), Austin Mgmt/Investment of PUF On: Cunningham, Wm. H. (UT System), Austin Murray, Dean (Permanent School Fund), Austin Ricks, Tom (UTIMCO), Austin Recs of Formula Adv Comm re:UFF On: Brown, Don W. (THECB), Austin Research Formula On: Butler, James G. (TAMUS, AG Program), College Station Calvert, Stanton C. (A&M System), Austin Special Item Review On: Frank, Nancy (Senate Finance Comm), Austin Std Fin Aid/Tut Exem/Waiver Prgms On: Brown, Don W. (THECB), Austin Cobb, Sharon (THECB), Austin Textbooks Costs/Elec Txb Pilot Prg On: Leos, Robert H. (TEA), Austin Smisko, Ann (TEA), Austin


Calculates the number of ways to choose k
items from n
items without repetition and
without order.
Number.isNaN()
to check if any of the two values is NaN
.k
is less than 0
, greater than or equal to n
, equal to
1
or n - 1
and return the appropriate result.n - k
is less than k
and switch their values accordingly.2
through k
and calculate the binomial coefficient.Math.round()
to account for rounding errors in the calculation.const binomialCoefficient = (n, k) => {
if (Number.isNaN(n) || Number.isNaN(k)) return NaN;
if (k < 0 || k > n) return 0;
if (k === 0 || k === n) return 1;
if (k === 1 || k === n - 1) return n;
if (n - k < k) k = n - k;
let res = n;
for (let j = 2; j <= k; j++) res *= (n - j + 1) / j;
return Math.round(res);
};


Build your own
Choose your size and toppings
Size
13" pie
18" pie
Meat Toppings
----
Pepperoni
Sausage
Bacon
Salami
Vegetable Toppings
----
Olives
Spinach
Pineapple
Onion
Peppers
Sumbit Order
Order:


Caesar Cipher
Enter the message you would like to encrypt/decrypt into the text box below and click the appropriate button to see the result. This cypher uses the ROT13 algorithm to encode/decode messages.
Encode
Decode


createvid.io
Please log in to CreateVid.io by clicking the button below. If you didn't just try to log in, please ignore this email.
Log In
If the button doesn't work for you, try copying and pasting this:
{{ code }}


AggregateError Objects
An AggregateError Object is an extended _NativeError_ object that encapsulates multiple errors.
NOTE: This is based on the same design for AggregateError in the Promise.any proposal.
The AggregateError Constructor
The AggregateError constructor:
- is the intrinsic object %AggregateError%
- is the initial value of the `AggregateError` property of the global object.
- creates and initializes a new AggregateError object when called as a function rather than as a constructor. Thus the function call `AggregateError(...)` is equivalent to the object creation expression `new AggregateError(...)` with the same arguments.
- is designed to be subclassable. It may be used as the value of an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified `AggregateError` behaviour must include a `super` call to the `AggregateError` constructor to create and initialize subclass instances with an [[ErrorData]] internal slot.
AggregateError ( _errors_, _message_ )
When the *AggregateError* function is called with arguments _errors_ and _message_, the following steps are taken:
1. If NewTarget is *undefined*, let _newTarget_ be the active function object; else let _newTarget_ be NewTarget.
1. Let _O_ be ? OrdinaryCreateFromConstructor(_newTarget_, `"%AggregateErrorPrototype%"`, « [[ErrorData]] »).
1. Let _errorsIterator_ be ? GetMethod(_errors_, @@iterator).
1. Let _errorsList_ be ? IterableToList(_errors_, _errorsIterator_).
1. Let _errorsArray_ be ! CreateArrayFromList(_errorsList_).
1. Perform ! CreateDataProperty(_O_, `"errors"`, _errorsArray_).
1. If _message_ is not *undefined*, then
1. Let _msg_ be ? ToString(_message_).
1. Let _msgDesc_ be the PropertyDescriptor { [[Value]]: _msg_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.
1. Perform ! DefinePropertyOrThrow(_O_, `"message"`, _msgDesc_).
1. Return _O_.
Properties of the AggregateError Constructor
The AggregateError constructor:
- has a [[Prototype]] internal slot whose value is the intrinsic object %Error%.
- has the following properties:
AggregateError.prototype
The intial value of `AggregateError.prototype` is the intrinsic object %AggregateErrorPrototype%.
This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.
Properties of the AggregateError Prototype Object
The AggregateError prototype object:
- is an ordinary object.
- is not an Error instance and does not have an [[ErrorData]] internal slot.
- has a [[Prototype]] internal slot whose value is the intrinsic object %ErrorPrototype%.
AggregateError.prototype.constructor
The initial value of `AggregateError.prototype.constructor` is the intrinsic %AggregateError% object.
AggregateError.prototype.message
The initial value of `AggregateError.prototype.message` is the empty String.
AggregateError.prototype.name
The initial value of `AggregateError.prototype.name` is `"AggregateError"`.
AggregateError.prototype.errors
The initial value of `AggregateError.prototype.errors` is *undefined*.
Properties of AggregateError Instances
AggregateError instances are ordinary objects that inherit properties from the AggregateError prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. The only specified uses of [[ErrorData]] is to identify Error, AggregateError, and _NativeError_ instances as Error objects within `Object.prototype.toString`.


PgUS Policies
PostgreSQL Policies
terms & conditions
By visiting our website and using our servers you agree to comply with the terms and conditions of this Acceptable Use Policy.
You may not use our website in connection with any activity that involves:
- Violates any law or government regulation, or promotes or facilitates such by third parties;
- Violates any rule or regulation of Visa, Mastercard, American Express, Discover or any other electronic funds transfer network (each, a "Card Network")
- Is fraudulent, deceptive, unfair or predatory


Man arrested after woman seriously injured in Newton Mearns house as cops probe 'disturbance'
The 41-year-old woman was raced to hospital.
by Kathleen SpeirsA man has been arrested after a woman was left seriously injured in East Renfrewshire.
Police swooped on a house in Castle Road at around 10pm on Sunday, following reports of a 'disturbance' inside a house.
A 41-year-old woman was rushed to hospital for serious injuries.
Medics say her injuries are not believed to be 'life-threatening'.
A 37-year-old man has been arrested in connection with the incident.
Police officers were still on the scene this morning.
A spokesman from the force told the Record: "We can confirm that a 37-year-old man has been arrested in connection with a disturbance within a house on Castle Road in Newton Mearns.
"The incident was reported shortly after 10.05pm on Sunday, December 8.
"A 41-year-old woman suffered serious injuries during the incident and was taken to hospital for treatment.
"Her injuries are not believed to be life-threatening.
"The incident was contained to within the property and there was no wider risk to the public.
"Inquiries are ongoing."


Clicking the following button should enlarge the surface and the image.
In the first Test: The image should not be cropped on the right and the background of grid should be red.
In the secondd test: the cavas should stay the same size, the image is increased and scrollbars appear
second test with overflow=auto
That's all Folks!


Danger Laser Falcon is a group of four graduate students operating out of the Center for Emerging Media Design and Development at Ball State University.
In our work, we try to make things informative and interesting, while still remaining fun.
Of course, because we're a rather new group, we don't have a lot of work to show off yet, but trust us, watch this space for even more awesome stuff in the months/years/decades/centuries to come!
If you're interested in our projects, or just want to say hi, send us a message, we'd love to hear from you!


WITNESS LIST Redistricting Committee September 22, 2000-10:30A Redistricting On: Beck, B.M. (Self) Burrows, Bell County Judge Jon (Self) Carlson, Pat (Tarrant County Republican Party) Carroll, Jimmy (Self) Christie, Gaylon (Self and Killeen Chamber of Commerce) Connell, Ted (Self) English, Mayor Pro Tem George (City of Temple) Fairbrother, William (Self) Gibson, McLennan County Commissioner Lester L. (Self) Howard, Robert (Self and Travis County Libertarian party) Jaecks, Milam County Commmissioner Dale (Self) Klussmann, Wallace (Self) Laster, Justice of the Peace E. Jean (Self) Latham, Fred (Self) Manning, Joan (Copperas Cove ISD Board of Trustees) Marshall, Jr., Mayor of Temple Keifer (Self) Masset, Royal (Texans For Fair Redistricting) Mikus, Jr., Jerry J. (Self) Mills, T. J. (Self) Oldham, Dale (Self and Republican National Committee) Overbey, Kirk (Self) Prewitt, W. A. "Buck" (Self) Reinhardt, Chuck (Self) Sager, Alan (Self and Travis County Republican Party) Sari, Ilona (Self) Sparks, Mayor of Hamilton Ray (Self and Hamilton County and City of Hamilton) Stem, Robert (Falls County District Judge) Summers, Milam County Judge Frank (Self) Vernon, Alexander (Self) Villarreal, McClennan County Justice of the Peace Fernando (Self) Willsey, Russ (Cities of West, Mart, and McGregor) Wright, Caldwell County Judge H. T. (Self) Registering, but not testifying: On: Benson, David E. (Mayor of Pasadena Johnny Isbel) Carssow, Jim (Self and Cedar Park Chamber of Commerce) Clennan, Kirk D. (Cedar Park Economic and Community Development Corp.) Dean, Harold (Cedar Park Chamber of Commerce)


Open RD Using: SB account External Deposit Mutual funds Account
Customer ID
RD ID
Term
Interest%
Amount


{# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -#} {% extends "manage_project_base.html" %} {% set active_tab = 'releases' %} {% block title %}Manage '{{ project.name }}' release{% endblock %} {% block main %}
| Filename, size | Type | Python version | Upload date | |
|---|---|---|---|---|
|
{{ file.filename }}
{% if file.size %}({{ file.size|filesizeformat() }}){% endif %} |
{{ file.packagetype|format_package_type }} | {{ file.python_version if file.python_version != 'source' else 'None' }} | {{ file.upload_time|format_date() }} | {{ confirm_modal(title, "Project name", project.name, slug, confirm_button_label=confirm_button_label, index=loop.index, extra_fields=extra_fields, extra_description=extra_description) }} |
Learn how to upload files on the Python Packaging User Guide
Warning {% if files %} Deleting will irreversibly delete this release along with {{ files|length() }} {% trans count=files|length %} file {% pluralize %} files {% endtrans %} {% else %} Deleting will irreversibly delete this release. {% endif %} You will not be able to re-upload a new distribution of the same type with the same version number. Consider making a new release or a post release instead.
{{ confirm_button("Delete release", "Version", release.version) }}| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | {{ file.sha256_digest }} |
|
| MD5 | {{ file.md5_digest }} |
|
| BLAKE2-256 | {{ file.blake2_256_digest }} |


NOTEPLAYER.JS
Installation:
You may import the code into an existing node.js project or import it directly into your HTML code
- Node module import
# local install to your project npm install --save-dev noteplayer
// import module into your js code var np = require('noteplayer')
- plain JS import
The module is instanciated in the object np, which you can use right away<!-- minified version, not human friendly, 55kb--> <script type="text/javascript" src="notePlayer.min.js"></script> <!-- uncompressed version, human friendly, 416kb --> <script type="text/javascript" src="notePlayer.js"></script>
np.buildFromName("C4").play()
Constructors
There are several ways to instanciate the class:
buildFromFrequency(freq,[audioContext])
Builds a notePlayer from a specific frequence. audioContext is created if not provided.
n = np.buildFromFrequency(440); //will return a A4 n = np.buildFromFrequency(439); //will return a A4 n = np.buildFromFrequency(460); //will return a A#4
buildFromKeyNb(noteKeyNb, [audioContext])
Builds a notePlayer from a specific piano key number audioContext is created if not provided
n = np.buildFromKeyNb(49); //will return a A4
buildFromName(noteName, [audioContext])
Builds a notePlayer from a specific musical note name audioContext is created if not provided
n = np.buildFromName("A4") //will return a A4
Methods
play([callback])
Plays the note
n = np.buildFromName("A4") o = n.play(function(){ console.log("end play") })
The note will be played for a given duration (random by default, or using setDuration() ). The function however returns the oscillator itself, which you can use to call for stop() should you want to stop the sound at an earlier time (courtesy of Jag)
Setters:
setAudioContext(audioContext)
setDestinationNode(node)
setDuration(duration)
setVolume(volume)
setVerbose(bool)
setAttack(duration)
setRelease(duration)


| Path: | vendor/plugins/rspec/README |
| Last Update: | Fri Feb 01 09:21:08 -0500 2008 |
RSpec is a Behaviour Driven Development framework with tools to express User Stories with Executable Scenarios and Executable Examples at the code level.
RSpec ships with several modules:
Spec::Story provides a framework for expressing User Stories
Spec::Example provides a framework for expressing code Examples
Spec::Matchers provides Expression Matchers for use with Spec::Expectations and Spec::Mocks.
Spec::Expectations supports setting expectations on your objects so you can do things like:
result.should equal(expected_result)
Spec::Mocks supports creating Mock Objects, Stubs, and adding Mock/Stub behaviour to your existing objects.
The simplest approach is to install the gem:
gem install -r rspec #mac users must sudo
If you prefer to build the gem locally, check out source from svn://rubyforge.org/var/svn/rspec/trunk. Then do the following:
rake gem gem install pkg/rspec-0.x.x.gem (you may have to sudo)
In order to run RSpec‘s full suite of specs (rake pre_commit) you must install the following gems:
Once those are all installed, you should be able to run the suite with the following steps:
Note that RSpec itself - once built - doesn‘t have any dependencies outside the Ruby core and stdlib - with a few exceptions:
See rspec.rubyforge.org for further documentation.


--- layout: page title: Objectives permalink: /objectives/ ---
Create every game with such passion and determination, so that every player can feel how much work was put into every little detail
Find inspiration in games from the past and bring it into the present, so that the new generations can feel what we felt years ago
Learn, imagine and create. Always learning and trying to find new ways of putting everything into practice.
Listen the music of the past, the present and the future. Feel it and pass it to the player
Port every game into every platform.
Spread the love for Video Games everywhere and make the community grow. Also, make new friends in the process


Lets get you connected! this is a test of word wrapping in this box
Lets get this party started! this is a test of word wrapping in this box


|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
| Interface Summary | |
|---|---|
| AlbumData | Data interface for album feeds and entries. |
| AtomData | A common interface for all of the methods that match between entry and feed. |
| CommentData | Shared comment data object, this contains all setters/getters of fields that are specific to a comment. |
| Extensible | Basic interface for all extendable objects. |
| GphotoData | Data interface for all of the photos data items. |
| MediaData | An interface for anything that supports mediarss content to implement, provides helpful get and set methods for getting and setting mediarss elements. |
| PhotoData | Base data object for photo feeds and entries, this interface contains the methods that all photo objects must provide. |
| TagData | Basic extension to include tag-specific data, this is the shared interface for all tag objects in the Picasaweb GData api. |
| UserData | An interface for the user data objects. |
| Class Summary | |
|---|---|
| AlbumEntry | Entry for album kinds, contains album metadata. |
| AlbumFeed | Feed for an Album in our google photos api. |
| CommentAuthor | Comment author, contains commentor name and image. |
| CommentEntry | Entry for comment kinds, contains comment metadata. |
| ExifTags | A photo's exif tags. |
| GphotoAccess | Access level for an album, either public or unlisted. |
| GphotoAccess.Value | Access level. |
| GphotoAlbumCanonicalTitle | Canonical name of the album this entity is in. |
| GphotoAlbumDescription | Album description of the album this entity is in. |
| GphotoAlbumId | The album ID that the entity is contained in. |
| GphotoAlbumTitle | Title of the album this entity is in. |
| GphotoBytesUsed | The number of bytes used by the album. |
| GphotoChecksum | An opaque client checksum. |
| GphotoClient | An opaque client string for extra photo information. |
| GphotoCommentCount | The number of comments on the album. |
| GphotoCommentsEnabled | True if the album allows commenting. |
| GphotoCrowdedLength | Number of results included after crowding. |
| GphotoEntry<E extends GphotoEntry<E>> | The base entry class for Picasaweb data. |
| GphotoExifTime | The unix timestamp from the exif information. |
| GphotoFeaturedDate | Datetime in unix timestamp format for when the photo was featured. |
| GphotoFeed<F extends GphotoFeed> | This class customizes the generic MediaFeed class to define a feed of GphotoEntries. |
| GphotoHeight | The height of a photo in pixels. |
| GphotoId | The photos system id for the element. |
| GphotoImageVersion | The version of the image bytes. |
| GphotoLocation | The textual location of the album. |
| GphotoMaxPhotos | The maximum number of photos allowed per album. |
| GphotoName | The canonical name of the album. |
| GphotoNickname | The nickname of a user. |
| GphotoOriginalVideo | The original video info field. |
| GphotoPhotoId | The photo ID that the entity is contained in. |
| GphotoPhotosLeft | The number of photos that can be uploaded to this album. |
| GphotoPhotosUsed | The number of photos that have already been uploaded. |
| GphotoPosition | The position of a photo in its album. |
| GphotoQuotaLimit | The maximum available quota. |
| GphotoQuotaUsed | The currently used quota. |
| GphotoRotation | The rotation of a photo in degrees. |
| GphotoRssLink | Link to the rss feed. |
| GphotoShowLink | Flag if contact should appear in gallery page. |
| GphotoSize | The size of a photo in bytes. |
| GphotoSnippet | Snippet of matching text for search results. |
| GphotoSnippetType | Type of snippet included in search results. |
| GphotoStarred | If viewer starred the photo and total number of stars. |
| GphotoStreamId | The stream ID of a stream the photo belongs to. |
| GphotoSubscribed | Flag if user will receive update emails from a contact. |
| GphotoThumbnail | The thumbnail for a user portrait or album cover. |
| GphotoTimestamp | A datetime in unix timestamp format. |
| GphotoTruncated | Truncated value of search results. |
| GphotoType | Type of element. |
| GphotoUsername | The username of a photos user. |
| GphotoVersion | The version of the entity. |
| GphotoVideoStatus | The video status field. |
| GphotoVideoUrl | The url to the video source of the photo. |
| GphotoViewCount | The number of views for this image. |
| GphotoWeight | The number of items this tag appears on. |
| GphotoWidth | The width of a photo in pixels. |
| KmlSnippet | Simple value element for kml snippets. |
| Namespaces | Namespace definitions related to Picasa Web Albums Data API. |
| PheedImageUrl | Photo image source. |
| PheedThumbnail | Photo thumbnail. |
| PheedVideoUrl | Video source. |
| PhotoEntry | Entry for photo kinds, contains photo metadata. |
| PhotoFeed | Feed for a Photo in our google data api. |
| TagEntry | Entry for tag kinds, contains tag metadata. |
| UserEntry | Entry for user kinds, contains user metadata. |
| UserFeed | Feed for a User in our google photos api. |
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |


What is the difference between documentation of a software component of EPICS V4, and its specification. Will there be a difference?
What are the documentation standards?
There already are several separate mercurial projects. Will each keep it's own set of documentation?
We have a combination of Java, C++, and Python. Java and Pythgon each have documentation standards. As far as I know C++ does not.
For java pvDataJava, etc use the eclipse javadoc generator to produce html documentation. I think channelFinder and pvManager both use maven to produce the documentation. What will be the standard? What are the standards for project and package overviews?
What about documentation guidelines for C++?
What is the status?
Source files carry license, or refer to a license? This goes with documentation stndards above.
GW: Suggest all source carries a standard header but that it is functional - it describes the file, authorship and modifications their authors and dates. It only should refer to a license page elsewhere.
There are already quite a few separate projects. If each service is a separate project there will be even more. This compatiblity problems must be addressed.
There seems to be agreement on the following
MK: But what about y and z? There are at least two issues.
GW: Suggest major, minor, dot. MAJOR is not forward compatible, minor is not backward compatible. Don't make it depedent on network protocol specifically, nor introspection specifically. There will be anumber of things in each class.
MK: Is it ready to be declared normative document?
GW: Is it ready to be published as a FPWD - we voted yes. Is it normative? - The way I use "Normative" indicates intention more than readiness. A standard is normative if you intend it to be. Normative means basically a formal spec. If we say a pvData "is" normative - we are making a statement about the documentation, openness, and formality of its specification.
To help motivate the next sections lets consider some use cases. Others (GW, GS, BD) should suggest some. E.g.
For each use case discuss:
Topics include:
Need to make everyone clear on the use cases of services, which motivates then the architecture.
To make this managable first consider services based on magnets and bpms.
Some topics are:
Other services to discuss?
How is data made network available. We already have a combination of WEB services, caV3 and pvAccess. Is this it?
Presently both the core "support for" services, ie org.epics.pvService.rpc, and essentially prototype frameworks for services, and services themeselves, are all 3 in org.epics.pvService! Need to spearate core, from frameworks, from services.
A suggestion was made that standard types be provided as pvManager types.
What does this mean?
Take VDouble for example.
Is this what defines VDouble?
public interface VDouble extends Scalar<Double>, Alarm, Time, Display {} ... public interface Scalar<T> { T getValue(); } public interface Alarm { AlarmSeverity getAlarmSeverity(); AlarmStatus getAlarmStatus() } ....
Or is VDouble defined via metadata syntax?
structure VDouble double value alarm alarm timeStamp timeStamp display display
GW: Alarm and timestamp are controls ideas, they have no place in defining any kind of double used at a high level, any more than theweb service your bank offers encodes timestamp and alarm when it sends you the amounts of transactions.
And why would standard types be defined in terms of pvManager anyway? Surely it's pvManager's job to understand the normative aggregate types and normative functional types, not the other way around.
Five basic data types which come from the epicsV3 DBR types are enum, timeStamp, alarm, display, and control. Both pvManager and pvData (called properties) provide alternate ways to package what is in the DBR types defined in EPICS V3. But they do it in different ways.
What other standard data types will the charter define?
It looks like are least statistics, table, and image.
What about others?
GW: I think we need to define a taxonomy: type (Field, PVField), display
"V


Through using a vacuum bag,my objective for rotation 7 was to make my own skateboard and decorating it with stickers printed by Roland GS-24.
This is my finished product!
At first, I had to use Vacuum-Bagging-Techniques in order to assemble my boards. I had to work with Walker because I had to assemble the boards in a short period of time before the glue solidified. After gluing the parts together, I had to pump out the air from the bag. Then, I had to smoothen the edges and surface of my board so that it doesn't have a rough surface. I have used the two machines above in the picture to smoothen my board. The last step for completing my skateboard was to add stickers for decorations. I have used my techniques that I learned from rotation 6 and decided to past a Supreme sticker on my skateboard. As a final touch, I have coated my board with the SPAR Urethane.
From this rotation, I realized how simple it could be to make a skateboard of my own. Not only can I build skaeboard out of the wood, but I can also make any furnitures such as wooden chairs or desks by going through the same process as making the skateboard. Furthermore, I noticed that it was easy to smoothen the surface of a wood by utilizing the wood cutters. However, it was pretty hard for me to properly use the wood cutters. I actually ended up cracking the base of my skateboard. Yet, I was able to fix the crack by adding super glue and using the clamp.


{{ define "main" }} {{ partial "hero.html" . }} {{ partial "aboutSection.html" . }} {{ partial "awardsSection.html" . }} {{ partial "skillSection.html" . }} {{ partial "namesosekiSection.html" . }} {{ partial "newsSection.html" . }} {{ end }}


{% extends "layouts/main.html" %} {% set smallSearch = true %} {% set pageName = "About" %} {% block page_title %}About – {{ settings.title }}{% endblock %} {% block body_class %}about{% endblock %} {% block content %}
{{ settings.title }} helps you understand how organisations use data. It guides you through making requests to change how data about you is used.
We're currently focussing on covering fintech organisations. We'll be expanding our coverage in the future.
This website uses a new and open dataset of machine-readable privacy notices. Developers can use our API to integrate this dataset with their application.
Learn how to use the API on GitHub
We’re looking for partners to expand the organisations we cover. You can help by converting a text privacy notice into a machine-readable privacy notice, or by contributing your organisation's privacy notice.
Start a contribution with the form or request an organisation by email
We'd love your feedback on Data Rights Finder. Get in touch at {{ settings.contact_email }}.
This project is maintained by IF and Open Rights Group with funding from the Information Commissioner’s Office.


Bite Size Bayes¶
Copyright 2020 Allen B. Downey
License: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
Review¶
In the previous notebook I presented Theorem 4, which is a way to compute the probability of a disjunction (or
operation) using the probability of a conjunction (and
operation).
\(P(A ~or~ B) = P(A) + P(B) - P(A ~and~ B)\)
Then we used it to show that the sum of the unnormalized posteriors is the total probability of the data, which is why the Bayes table works.
We saw several examples involving dice, and I used them to show how prediction and inference are related: the Bayes table actually solves the prediction problem on the way to solving the inference problem.
Bayesville¶
In this notebook we’ll consider a famous example where Bayes’s Theorem brings clarity to a confusing topic: medical testing.
Joe Blitzstein explains the scenario in this video from Stat110x at HarvardX.
(You might have to run the following cell to see the video.)
from IPython.display import YouTubeVideo
YouTubeVideo('otdaJPVQIgg')
I’ll paraphase the problem posed in the video:
In Bayesville, 1% of the population has an undiagnosed medical condition. Jimmy gets tested for the condition and the test comes back positive; that is, the test says Jimmy has the condition.
The test is 95% accurate, which means
If you give the test to someone with the condition, the probability is 95% that the test will be positive, and
If you give it to someone who does not have the condition, the probability is 95% that the test will be negative.
What is the probability that Jimmy actually has the condition?
Because the test is 95% accurate, it is tempting to say that the probability is 95% that the test is correct and Jimmy has the condition.
But that is wrong. Or maybe I should say it’s the right answer to a different question. 95% is the probability of a positive test, given a patient with the condition. But that’s not what the question asked, or what Jimmy wants to know.
To Jimmy, the important question is the probability he has the condition, given a positive test. As we have seen, and as Joe explains in the video:
\(P(A|B) ≠ P(B|A)\)
We can use a Bayes table to answer Jimmy’s question correctly.
Bayes table¶
I’ll use two strings to represent the hypotheses: condition
and no condition
.
The prior for condition
is the probability a random citizen of Bayesville has the condition, which is 1%.
The prior for no condition
is the probability that a random citizen does not have the disease, which is 99%.
Let’s put those values into a Bayes table.
import pandas as pd
table = pd.DataFrame(index=['condition', 'no condition'])
table['prior'] = 0.01, 0.99
table
| prior | |
|---|---|
| condition | 0.01 |
| no condition | 0.99 |
The data is the positive test, so the likelihoods are:
The probability of a correct positive test, given the condition, which is 95%.
The probability of an incorrect positive test, given no condition, which is 5%.
table['likelihood'] = 0.95, 0.05
table
| prior | likelihood | |
|---|---|---|
| condition | 0.01 | 0.95 |
| no condition | 0.99 | 0.05 |
Once we have priors and likelihoods, the remaining steps are always the same. We compute the unnormalized posteriors:
table['unnorm'] = table['prior'] * table['likelihood']
table
| prior | likelihood | unnorm | |
|---|---|---|---|
| condition | 0.01 | 0.95 | 0.0095 |
| no condition | 0.99 | 0.05 | 0.0495 |
And the total probability of the data.
prob_data = table['unnorm'].sum()
prob_data
0.059000000000000004
Then divide through to get the normalized posteriors.
table['posterior'] = table['unnorm'] / prob_data
table
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| condition | 0.01 | 0.95 | 0.0095 | 0.161017 |
| no condition | 0.99 | 0.05 | 0.0495 | 0.838983 |
The posterior for condition
is substantially higher than the prior, so the positive test is evidence in favor of condition
.
But the prior is small and the evidence is not strong enough to overcome it; despite the positive test, the probability that Jimmy has the condition is only about 16%.
Many people find this result surprising and some insist that the probability is 95% that Jimmy has the condition.
The mistake they are making is called the base rate fallacy because it ignores the “base rate” of the condition, which is the prior.
Put a function on it¶
At this point you might be sick of seeing the same six lines of code over and over, so let’s put them in a function where you will never have to see them again.
def make_bayes_table(hypos, prior, likelihood):
"""Make a Bayes table.
hypos: sequence of hypotheses
prior: prior probabilities
likelihood: sequence of likelihoods
returns: DataFrame
"""
table = pd.DataFrame(index=hypos)
table['prior'] = prior
table['likelihood'] = likelihood
table['unnorm'] = table['prior'] * table['likelihood']
prob_data = table['unnorm'].sum()
table['posterior'] = table['unnorm'] / prob_data
return table
This function takes three parameters:
hypos
, which should be a sequence of hypotheses. You can use almost any type to represent the hypotheses, including string,int
, andfloat
.prior
, which is sequence of prior probabilities, \(P(H)\) for each \(H\).likelihood
, which is a sequence of likelihoods, \(P(D|H)\) for each \(H\).
All three sequences should be the same length.
Here’s a solution to the previous problem using make_bayes_table
:
hypos = ['condition', 'no condition']
prior = 0.01, 0.99
likelihood = 0.95, 0.05
make_bayes_table(hypos, prior, likelihood)
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| condition | 0.01 | 0.95 | 0.0095 | 0.161017 |
| no condition | 0.99 | 0.05 | 0.0495 | 0.838983 |
Exercise: Suppose we take the same test to another town, called Sickville, where the base rate of the disease is 10%, substantially higher than in Bayesville. If a citizen of Sickville tests positive, what is the probability that they have the condition?
Use make_bayes_table
to compute the result.
# Solution
hypos = ['condition', 'no condition']
prior = 0.1, 0.9
likelihood = 0.95, 0.05
make_bayes_table(hypos, prior, likelihood)
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| condition | 0.1 | 0.95 | 0.095 | 0.678571 |
| no condition | 0.9 | 0.05 | 0.045 | 0.321429 |
With a higher base rate, the posterior probability is substantially higher.
Exercise: Suppose we go back to Bayesville, where the base rate is 1%, with a new test that is 99.5% accurate.
If a citizen of Bayesville tests positive with the new test, what is the probability they have the condition?
Use make_bayes_table
to compute the result.
# Solution
hypos = ['condition', 'no condition']
prior = 0.01, 0.99
likelihood = 0.995, 0.005
make_bayes_table(hypos, prior, likelihood)
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| condition | 0.01 | 0.995 | 0.00995 | 0.667785 |
| no condition | 0.99 | 0.005 | 0.00495 | 0.332215 |
With an accuracy of 99.5%, the positive test provides stronger evidence, so it is able to overcome the small prior.
The Elvis problem¶
Here’s a problem from Bayesian Data Analysis:
Elvis Presley had a twin brother (who died at birth). What is the probability that Elvis was an identical twin?
For background information, I used data from the U.S. Census Bureau, Birth, Stillbirth, and Infant Mortality Statistics for the Continental United States, the Territory of Hawaii, the Virgin Islands 1935 to estimate that in 1935, about 1/3 of twins were identical.
Exercise: Use this base rate and a Bayes table to compute the probability that Elvis was an identical twin.
Hint: Because identical twins have the same genes, they are almost always the same sex.
# Solution
hypos = ['identical', 'fraternal']
prior = 1/3, 2/3
likelihood = 1, 0.5
make_bayes_table(hypos, prior, likelihood)
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| identical | 0.333333 | 1.0 | 0.333333 | 0.5 |
| fraternal | 0.666667 | 0.5 | 0.333333 | 0.5 |
Summary¶
In this notebook, we used Bayes’s Theorem, in the form of a Bayes table, to solve an important problem: interpreting the result of a medical test correctly.
Many people, including many doctors, get this problem wrong, with bad consequences for patients. Now that you know about the “base rate fallacy”, you will see that it appears in many other domains, not just medicine.
Finally, I presented the Elvis problem, which I hope is a fun way to apply what you have learned so far. If you like the Elvis problem, you might enjoy this notebook where I dig into it a little deeper.
In the next notebook I’ll introduce the probability mass function (PMF) and we’ll use it to solve new versions of the cookie problem and the dice problem.


Working with data
Data is/are? **10 days until https://t.co/n4ju7Of6aM! pic.twitter.com/R0cHOuTpz5
— PHD Comics (@PHDcomics) April 29, 2017
Manipulate datasets
As seen during the previous lesson, there are some datasets that are always available on R, or other that are included in specific packages.
For example, in the previous lesson, we worked with mtcars, beav2 and hflights.
However, in the most common real case scenario, we will need for reading and writing our own data, maybe starting from some sort of tables.
Read and write files
In R, it is possible to acquire dataset in different ways, not only through packages. One of the simplest and most intuitive ways is reading from a file. There are many formats that can contain data. The simplest and most widespread are in the .csv file (comma-separated values) or the .tsv (tab-separated values).
One of the most used command to read files is read.table()
, which reads the content of a tabular file and saves it as a data frame. Let’s take a practical example.
Let’s consider the dataset body temperature that contains the data about the human body temperature for some patients. We can download the dataset in the most convenient folder (for example, data) and we can read it using read.table()
and specifying the path to the file.
BodyTemperature <- read.table(file = "../data/BodyTemperature.txt", header = TRUE, sep = " ")
The first argument of read.table()
is the path to the file. Then, we can indicate if there are headers, i.e., the first row contains the name of the of the variables. Another argument is the separator, which is the symbol or character used in the file to delimit the different elements of a line. The default separator of read.table()
is Space but it is possible to indicate different ones. If the file had been a csv (comma separated values), we could have indicated sep =", "
. Likewise, we could have used the read.csv()
function which considers the comma as the default separator. If the values were separated by semicolons we could have used read.csv2()
and read.delim()
if separated by tab (\t).
The function read.csv
also accepts url as an argument. In this way, R will download the dataset by itself and save it in the indicated variable.
(BodyTemperature <- read.csv(url('http://extras.springer.com/2012/978-1-4614-1301-1/BodyTemperature.txt'), sep=" "))
In a similar way to the read.table()
command, we can use write.table()
to write a data frame (or a variable) in a file. Also in this case, we can use write.csv
for writing comma-separated values file. For example, the following command writes the dataset downloaded from the internet to the data folder as a csv file.
write.csv(BodyTemperature, "./data/BodyTemperature.txt")
Explore the data
Once we read or download our dataset, we can start analyzing the content. Often the datasets are accompanied by descriptions that explain the content and it is a good rule to read them.
We can access head or the tail of a dataset, using the head()
and tail()
commands. We can even visualize the entire dataset in an R Studio window using the View()
command. The dim()
returns the dataset dimension and the command names()
returns of the column names.
The str()
command returns information about the structure of the dataset. In R Studio, the equivalent of this command is accessible in the Environment window. All these functions are always a good starting point for understanding the data you are dealing with.
Another handy function is summary()
. This function returns the minimum, maximum, mean, and quantiles of the numerical variables. We specified numeric since a data frame could contain non-numeric variables. For example, in the case of BodyTemperature, the first column is the categorical variable of the patient’s sex.
Other useful functions are mean()
and sd()
which return us the mean and standard deviation of a vector argument. Analogously, the IQR()
and range()
functions return the interquartile range and the range of a vector.
A useful command to apply functions designed for scalar or vector to the elements of an array or matrix is apply()
. This function is also useful for applying functions along a single dimension. The lapply()
and sapply()
variants work similarly for lists. Another command for data manipulation is round()
which rounds a value or a vector to the nearest integer, or by indicating the number of decimal places, rounds up to the indicated decimal digits.
Other useful features are sort()
, which sorts the elements of a vector, unique()
which removes repeated entries from an array or data frame. Functions like any()
and which()
check if a condition is satisfied. The first returns TRUE
if at least one element verifies the condition, whereas which()
returns the index of the elements that satisfy the condition.
Let’s look at some examples with the BodyTemperature
dataset.
Merge datasets
We have widely seen how to work and manipulate data. However, an important function that allows data to be grouped has not been explained in class: it is aggregate()
. This command allows you to apply a function to a subset of the data, following a precise pattern. Let’s look at some examples.
Another useful command is merge()
which allows the user to merge data frames according to a specific variable. if we are sure that our observations are “aligned”, we can obtain the same result,by using use the commands rbin()
and cbind()
.
Factors
Sometimes some categorical variables are saved as numeric variables. Let’s consider the dataset birthwt (birth weight) in the MASS package. We can note that some variables, although numerical, represent categories: for example, smokers or not, or hypertensive or not. However, if we use the summary()
function, we see that they are treated as numerical variables. The as.factor()
converts numeric variables to categorical variables.
birthwt1 <- birthwt
birthwt1$race <- as.factor(birthwt1$race)
From the description of the variables in the R Studio Environment window, we can see that after the assignment, race is indicated as a factor, no longer integer. If we call summary()
, the results for this variable are different than before.
The table()
function builds a contingency table among the combination of factors. levels()
returns the level attributes of a variable (use the help to see what prop.table()
does). Using levels()
it is also possible to assign or vary the level attributes. Let’s use this function to change the levels of race.
Missing data
Often data may contain unreliable values, due to errors in a few lines or missing values. This is a significant problem, both because, if not recognized in advance, these values can influence our results, and because there are no standard protocols to deal with these cases.
Some elements may be missing they are usually reported with NA (not available). R has a dedicated function to find these elements: is.na()
. This function returns boolean values to indicate whether the content is NA or not. Similarly, na.omit()
returns the argument without the rows containing NA.
In a similar way, the is.nan()
command checks if the content is NaN (not a number). There are also the functions is.infinite()
and is.finite()
that check for Inf/-Inf
values.
Probability distributions in R
R allows us to access many probability distributions through specific functions that are contained in the stast package, which must then be loaded.
We can access the distributions through functions that recall their names, for example with norm, binom and pois, just to name a few, we access the normal, binomial and Poisson distributions. To this name is added a prefix, which serves to specify the density function (d), the distribution (p), and the function that returns the quantiles (q) or the one that generates random numbers according to the distribution (r ).
You can access the list of all the distributions of R by searching distribution in the help.
Let’s do some practice
It’s always time for pizza!
Download the dataset at the link, which contains the reviews of pizza restaurants in NY. This exercise is inspired by this video.
Explore and prepare the dataset
- How many records are collected in the dataset? What is the information?
- How many restaurants and records are in the dataset? How many variables?
- What is the maximum number of votes? And the minimum?
- According to the last number of your matricola(university registration number) select the data of the following pizzerias:
| Last number | Pizzeria1 | Pizzeria2 |
|---|---|---|
| 1 | Kiss My Slice | Big Slice Pizza |
| 2 | Mariella | Spunto |
| 3 | Rivoli Pizza | Joe’s Pizza |
| 4 | Pizza Italia | New York Pizza Suprema |
| 5 | Williamsburg Pizza | John’s of Bleecker |
| 6 | Bleecker Street Pizza | Vinny Vincenz |
| 7 | Highline Pizza | Famous Original Ray’s |
| 8 | Cavallo’s Pizza | Pizza 33 |
| 9 | Luna Pizza | Roio’s |
| 0 | Bella Napoli | Ben’s of SoHo 14th Street |
Your new dataset must contain only the data about these 2 restaurants. You should perform the following analyses on this new dataset.
Manipulate the dataset
- Add a new column with the number of total votes of each restaurant.
- Create a new column with the relative frequency of the answers. Round the value to the third decimal.
- Create a new column where you transform the review into numbers, where 0 is Never Again and 4 is Excellent.
- Compute the mean review for the two pizzerias in your dataset. Which one is the best?
- Plot the number of votes at the varying of the score.
- Choose one of the two restaurants. If we approximate its distribution of votes with a Poisson distribution with parameter equal to the mean rate, are we close to the data distribution?
Solution
Titanic
Consider the Titanic dataset (description).
- Read the dataset and analyze the variables. Are all the variables type correct?
- What is the mean age of the passengers? And the quantiles?
- What is the mean price of the ticket? And the standard deviation?
- Who is the passenger with more children aboard? How many?
- How many passengers survived? What is the survival probability?
- What is the survival probability in the various classes?
© 2017-2019 Federico Reali


| DOSE: |
3 hits |
oral |
LSD |
(blotter / tab) |
It has been almost 4 months since my first LSD experience. Although I have tried many other substances in my short 15 year old life once or twice, such as Ethyl Ether, ketamine, GHB, MDMA, and of course Weed, nothing compared to my first LSD experience.
Anyways, it started when one of my friends (let's call him D) told me he had bought a half a sheet of acid. I was quite excited and bought 5 hits off him instantly. As it was his first time too, so we decided to try it together. We also thought it would be a good idea to have a sitter, since we had read about so many bad trips. So we got his girlfriend, who did not want to try LSD to sit for us.
It was a week before we got a chance to do it. D's parents were going to a funeral up in Québec city. D did know the person who had died so his parents let him stay home for the week end. So at about 2 on saturday I got to D's place. He and his girlfriend were already there, in his basement. I dropped 3 of the hits I had bought from him, and he dropped 3 too. We then waited almost 45 minutes for the effects to come on. Most of that time was spent with D complaining about how he had only 12 hits left in his half sheet.
Then suddenly at 45 minutes things seemed to get brighter. We thought the trip was comming on, so I pulled out a pink floyd CD and started to listen to it. I don't know how long we were listening but after a while it seemed as if the music was somehow controlling the flow of time, and when the music was slow, like it usually was, time went slow, and when it sped up time sped up. After a while I asked D's girl for the time and she told me it had only been 10 minutes since we started to listen to the music. I was confused at this and looked around the room. Everything seemed normal and I was pissed I was not hallucinating. So I went to go to get a glass of water from the kitchen.
That is when I saw it. As I got up the chair D was sitting in seemed to move and hug D. It scared me and I tried to pull D out of the chair. He didn't know what I was doing and looked at me blankly with pupils too big to be human. His girlfriend (I'm gonna call her A for the rest of the story) was laughing at us and I couldn't figure out why. So I asked her and she told me we had been staring at each other for like 5 minutes. This ammused me and I laughed too. So we were all in good moods when we went into the kitchen to watch all the small trippy objects move and come alive. D later told me he had seen a soup can turn into a mouse and laugh at him. We stood there for almost an hour tripping.
Then I blacked out. It was just momentary and random, and when I awoke I was still standing, but everything had changed. I was so refreshed and it thought I had been 'awoken' for the first time into reality. I was sure that everything before that was a dream and I had just 'awoke' from it. Also I could see things so much clearer. It was as if everything made sense now. I could see the personality of everybody around me. I could see why they did everything they had done. I remember thinking A was the perfect human being. So cheery and caring. Then I looked at myself, my past present and future. I could see it all in an instant. I realized y I had started to take drugs in the first place, and things like y I had not asked that girl out in grade 8. It all made sense. The whole universe was weaved into a huge web of knowledge that I could touch at any time, and explore in seconds.
I tried to explain this to D and A but they did not understand what I was talking about. They thought it was funny, and for a second I realized it was, and laughed with them. We returned to his basement and listened to music and I remember telling them how Pink Floyd and Bob Dylan must have loved LSD. We also watched things change shape and move, 'Plot against us' as D called it. He did not enjoy the trip as much as I did, and was paranoid that his house was going to eat him or something. It didn't really make sense. And it was the only thing I could not figure out. The mind of a drugged up 15 year old did not seem to matter at the time so I forgot about it.
D's paranoia eased off as the night continued and he began to enjoy all the sounds and images. After a long time of having so much fun, A told us it was 12 pm. I was shocked it was so late and thought only a couple hours had gone by since we had dropped the acid. Then I began to sink into 'sleep' again. See at that very moment my knowledge of everything began to slip away into the 'blackness', as if I was falling 'asleep' again. Then suddenly, I felt it. I was being pulled down into the 'blackness' that was my life before LSD. I was scared and my friends later told I was screaming and raving about some blackness that seemed to cover my legs, and was moving to my head. This is the part of my trip I remember the most of. I was scared and dropped to the floor and lay in a ball. I could feel the 'blackness' covering me, and in moments, it covered my head and again I passed out.
When I woke up I looked around too see D and A laughing at me. They said I was screaming about being sucked into something for 10 minutes and then had said 'Meh, it's all good.' and got up calmly. They were also a little pissed, cause I scared them, but it didn't matter. I was still hallucinating but I could not see all the knowledge I had had during my trip when I was 'awake'. D decided we should try to sleep, because he was suddenly feeling quite tierd. So we stretched out on the couchs and the floor in his basement. Well I jumped on the only couch in the room before they could stop me, so they slept on the floor haha. ;)
After a good night's sleep I awoke to feel quite refreshed. Although I was sad I had lost the answers to everything, and had fallen back into 'sleep' again, I was happy to have experienced it once in my life. D wanted to try some more the next day, but I said no. I didn't want to do anymore until I thought hard about whethere it was a good substance or not.
Since then I have taken LSD about 15 times (lost track a while ago).  It's a personal choice if you want to trip or not.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


{% load define_action %} {% assign ""|add:source_type|add:" "|add:year as source_text %} {% assign "Learn more about the MTEF in the "|add:source_type|add:" as PDF" as pdf_text %} {% assign "Dataset Guide for "|add:source_type as guide_text %} {% assign "Learn more about the MTEF in the "|add:source_type|add:" as PDF" as excel_text %}
Budgeted and actual expenditure/allocations for a department can increase or decrease from year to year. Changes in expenditure for a department can be because of changes in the activities of the department, because of changes in priorities between departments, because of cost efficiencies or because of increases in the price of goods and services due to inflation.
The chart shows the department’s actual expenditure for past years, and budgeted expenditure for the current year and the upcoming three years of the medium-term expenditure framework (MTEF). By adjusting these numbers to take inflation into account, it is possible to determine if a department’s expenditure is really increasing or decreasing in real terms, as compared to the rest of the economy.
Previous financial years indicate actual expenditure while upcoming financial years indicate estimated expenditure:
| Year | Phase |
|---|---|
| {{ item.financial_year }} | {{ item.phase }} |


> Accidents in last 5 years
> Tickets in last 5 years
> DUI in last 5 years
> Suspensions in last 10 years


Feather Icons
activity
airplay
alert-circle
alert-octagon
alert-triangle
align-center
align-justify
align-left
align-right
anchor
archive
at-sign
award
aperture
bar-chart
bar-chart-2
battery
battery-charging
bell
bell-off
bluetooth
book-open
book
bookmark
box
briefcase
calendar
camera
cast
circle
clipboard
clock
cloud-drizzle
cloud-lightning
cloud-rain
cloud-snow
cloud
codepen
codesandbox
code
coffee
columns
command
compass
copy
corner-down-left
corner-down-right
corner-left-down
corner-left-up
corner-right-down
corner-right-up
corner-up-left
corner-up-right
cpu
credit-card
crop
crosshair
database
delete
disc
dollar-sign
droplet
edit
edit-2
edit-3
eye
eye-off
external-link
facebook
fast-forward
figma
file-minus
file-plus
file-text
film
filter
flag
folder-minus
folder-plus
folder
framer
frown
gift
git-branch
git-commit
git-merge
git-pull-request
github
gitlab
globe
hard-drive
hash
headphones
heart
help-circle
hexagon
home
image
inbox
instagram
key
layers
layout
link
link-2
linkedin
list
lock
log-in
log-out
mail
map-pin
map
maximize
maximize-2
meh
menu
message-circle
message-square
mic-off
mic
minimize
minimize-2
minus
monitor
moon
more-horizontal
more-vertical
mouse-pointer
move
music
navigation
navigation-2
octagon
package
paperclip
pause
pause-circle
pen-tool
percent
phone-call
phone-forwarded
phone-incoming
phone-missed
phone-off
phone-outgoing
phone
play
pie-chart
play-circle
plus
plus-circle
plus-square
pocket
power
printer
radio
refresh-cw
refresh-ccw
repeat
rewind
rotate-ccw
rotate-cw
rss
save
scissors
search
send
settings
share-2
shield
shield-off
shopping-bag
shopping-cart
shuffle
skip-back
skip-forward
slack
slash
sliders
smartphone
smile
speaker
star
stop-circle
sun
sunrise
sunset
tablet
tag
target
terminal
thermometer
thumbs-down
thumbs-up
toggle-left
toggle-right
tool
trash
trash-2
triangle
truck
tv
twitch
twitter
type
umbrella
unlock
user-check
user-minus
user-plus
user-x
user
users
video-off
video
voicemail
volume
volume-1
volume-2
volume-x
watch
wifi-off
wifi
wind
x-circle
x-octagon
x-square
x
youtube
zap-off
zap
zoom-in
zoom-out


{% extends "base.html" %} {% block title %}About{% endblock %} {% block main_content %}
NOTE: This site is still in early development. Please check back soon!
QuestMaker integrates with FitBit and makes exercise more rewarding by enabling users to easily create and participate in quests with their friends. In its simplest form, a quest is a series of milestones that users reach as they cover more distance over time. For users with FitBits, daily progress is updated automatically; for those without, manual entry is easy.
The idea for this application comes from the Walk to Rivendell Challenge, which provides a series of waypoints for Frodo's walk across Middle Earth. Since its inception in 2003, many people have made the whimsical trek across Tolkien's Middle Earth by manually charting their mileage each day and sharing their progress with friends. QuestMaker personalizes and automates this process, allowing you to focus your energies on outwalking the rest of your friends competitors fellowship!
A quest adds shared context and tangible goals to an activity that, in isolation, would be pretty boring. Exercise-for-the-sake-of-exercise gets old. Compare climbing 200 flights of stairs alone to climbing a mountain with your friends -- isn't it more fun when you're going somewhere, together? With QuestMaker, you always are, even when you're not.
To get started in QuestMaker, you can simply clone an existing quest and invite your friends. In the future, you will also be able to create your own quests.
{% endblock %}