Fonts
and Text......................................................................................................................................................... 1
Fonts and Text Contents.............................................................................................................................. 1
Fonts and Text..................................................................................................................................................... 2
Glyph Definitions.................................................................................................................................................. 2
The EM Square...................................................................................................................................................... 3
Converting TrueType
fonts to Macromedia Flash (SWF) glyphs........................................................................ 3
Kerning and Advance
Values................................................................................................................................. 4
DefineFont and
DefineText................................................................................................................................... 4
A Text Example..................................................................................................................................................... 5
The DefineFont Tag............................................................................................................................................... 5
The DefineText Tag............................................................................................................................................... 6
Text Records.......................................................................................................................................................... 6
Text Record Type 1
Text Style Change Record................................................................................................. 6
Text Record Type 0
Glyph Record.................................................................................................................... 7
Glyph Entry.......................................................................................................................................................... 8
Mapping to Native Fonts...................................................................................................................................... 8
DefineFont2........................................................................................................................................................... 9
Kerning Record.................................................................................................................................................... 10
Macromedia Flash File Format (SWF) SDK
Examples................................................................. 11
Edit Text Fields................................................................................................................................................... 11
Macromedia Flash File Format (SWF) SDK
Examples................................................................. 12
Flash text has been designed to be completely device independent. Text is guaranteed to look exactly the same on every device, regardless of which fonts are installed on the client machine. The Macromedia Flash File Format (SWF) achieves this by including the exact shape of every letter, number (or other text character) used in the movie. These character shape definitions are called glyphs.
Defining each and every glyph increases the size of a Macromedia Flash (SWF) file, particularly if the font is complex. However, it is a necessary tradeoff. At design time, Flash knows nothing about the capabilities of the client device, therefore glyphs must always be included in the Macromedia Flash (SWF) file, even if the desired font is already on the client machine.
To guarantee text is reproduced correctly, Macromedia Flash (SWF) also includes the exact position of every character in a text block. Again, this adds to the file size, but allows sophisticated text layout effects (like kerning and text wrapping) without requiring a complex layout engine built into the Flash player.
Glyphs are defined once in a standard coordinate space called the EM square. The same set of glyphs are used for every point size of a given font. To render a glyph at different point sizes, the Macromedia Flash player scales the glyph from EM coordinates to point-size coordinates.
Macromedia Flash fonts do not include any hinting information for improving the quality of small font sizes. However, antialiasing dramatically improves the legibility of down-scaled text. Macromedia Flash text remains legible down to about 12-points (viewed at 100%). Below that, text may appear fuzzy and blurred. In any case, it is rare for Macromedia Flash movies to be used for large bodies of text with small point sizes.
TrueType fonts can be readily converted to Macromedia Flash (SWF) glyphs. A simple algorithm can replace the Quadratic B-splines (used by TrueType) with Quadratic Bezier curves (used by Macromedia Flash (SWF)).
Example:
To the left is the glyph for the TrueType letter 'b' of
Monotype Arial. It is made up of curved
and straight edges. Squares indicate
on-curve points, and crosses indicate off-curve points. The black circle is the reference point for
the glyph. The blue outline indicates
the bounding-box of the glyph.
The EM square is an imaginary square that is used to size and align glyphs. The EM square is generally large enough to completely contain all glyphs, including accented glyphs. It includes the fonts ascent, descent, and some extra spacing to prevent lines of text from colliding.
Macromedia Flash (SWF) glyphs are always defined on an EM square of 1024 by 1024 units. Glyphs from other sources (such as TrueType fonts) may be defined on a different EM square. To use these glyphs in Macromedia Flash (SWF), they
should be scaled to fit an EM square of 1024.
TrueType glyphs are defined using Quadratic B-Splines, which can be easily converted to the Quadratic Bezier curves used by Macromedia Flash (SWF).
A TrueType B-Spline comprises one on-curve point, followed by many off-curve points, followed by another on-curve point. The mid-point between any two off-curve points is guaranteed to be on the curve. A SWF Bezier curve comprises one on-curve point, followed by one off-curve point, followed by another on-curve point.
To the left is a four point B-Spline. P0 and P3 are on-curve points. P1 and P2 are successive off-curve points.
This curve can be represented as two Quadratic Bezier curves by inserting a new point M, at the mid-point of P1,P2. The result is two Quadratic Bezier curves; P0,P1,M and M,P2,P3.
The complete procedure for converting TrueType glyphs to Macromedia Flash (SWF) glyphs is as follows:
1.
Negate the y-coordinate. (In TrueType the y-axis points up, in Macromedia Flash (SWF) the
y-axis points down)
2.
Scale the x and y co-ordinates from the EM square
of the TrueType font, to the EM square of the SWF glyph (always 1024)
3.
Insert an on-curve (anchor) point at the mid-point
of each pair of off-curve points.
Kerning defines the horizontal distance between two glyphs. This distance may be smaller or larger than the width of the left-hand glyph. Some kerning pairs are more aesthetically pleasing if they are moved closer together.
Macromedia Flash (SWF) stores kerning information as an advance value. That is, the horizontal advance from one glyph to another. Macromedia Flash (SWF) stores an advance value for every character in a text block.
In the example to the right, the A glyph overlaps the V glyph. In this case the advance is narrower than the width of the A glyph.
Fonts and text are defined using two tags:
1. The DefineFont tag defines a set of glyphs.
2. The DefineText tag defines the text-string that is displayed in the font.
The DefineFont tag defines all the glyphs used by subsequent DefineText tags. DefineFont includes an array of SHAPERECORDs, which describe the outlines of the glyphs. (These shape records are the same records used by DefineShape to define non-text shapes) To keep file size to a minimum, only the glyphs actually used in the text block are included in the DefineFont tag. For example, to display the word hello, only the glyphs h, e, l, and o are defined.
The
DefineText tag
stores the actual text string(s) to be displayed. It also includes the bounding box of the text object, a
transformation matrix, and style attributes such as color, and point size.
DefineText
contains an array of TEXTRECORDs, of which there are
two types:
·
Type 0 Glyph
Information.
A Type 0 Record contains an array of indices into the
glyph table of the current font.
Characters are not referred to by their ASCII or Unicode values, but by
an index into the glyph table. Type 0
Records also include the advance value for each character in the text string.
·
Type 1
Style Information.
A Type 1 Record
selects the current font, color, and point size, as well as the position of
next character in the text. These styles apply to all characters that follow,
until another Type 1 record changes the styles. The array of text records always begins with a Type 1
record to set the initial position and style.
Note: The DefineFont tag
must always come before the DefineText tag that refers to it.
Suppose you want to display the text bob in the Arial font, with a point size of 24.
First, you must define the glyphs with a DefineFont tag. The glyph table has two SHAPERECORDs; At index 0 is the shape of a lower-case b (see diagram). At index 1 is the shape of a lower-case o. (The second b in bob is a duplicate, and is not required). DefineFont also includes a unique ID so it can be selected by the DefineText tag.
Next you define the text itself with a DefineText tag. The first text record must be a Type 1 record. It sets the position of the first character, selects the Arial font (using the unique ID), and sets the point size to 24, so the font is scaled to the correct size. (Remember that glyphs are defined in EM coordinates the actual point size is part of the DefineText tag).
The second text record is a Type 0 record. It contains an array of GLYPHENTRYs. Each glyph entry contains an index into the fonts shape array. In this example, the first glyph entry has index 0 (which corresponds to the b shape), the second entry has index 1 (the o), and the third entry has index 0 (b again). Each GLYPHENTRY also includes an advance value for accurately positioning the glyph.
The
diagram below illustrates how the DefineText tag interacts with the DefineFont
tag:
The DefineFont tag defines the shape outlines of each glyph used in a particular font. Only the glyphs that are used by subsequent DefineText tags are actually defined.
The FontId uniquely identifies the font. It can be used by subsequent DefineText tags to select the font.
The offset table and shape table are used together. These tables have the same number of entries, and there is a one-to-one ordering match between the order of the offsets, and the order of the shapes.
The offset table points to locations in the shape table. Each offset entry stores the difference (in bytes) between the start of the offset table and the location of the corresponding shape:
Location of ShapeRecord[n] =
StartOfOffsetTable + OffsetTable[n]
Because the ShapeTable immediately follows the OffsetTable, the number of entries in both tables can be inferred by dividing the first offset by two:
Shape count = OffsetTable[0] / 2
(See class FDTDefineFont in the Macromedia Flash File Format (SWF) SDK)
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 10 |
|
FontId |
UI16 |
ID for this character |
|
OffsetTable |
UI16[nGlyphs] |
Array of shape offsets |
|
ShapeTable |
SHAPE[nGlyphs] |
Array of shapes |
The DefineText tag
defines a block of text. It describes
the font, size, color, and exact position of every character in the text
object.
(See class FDTDefineText
in the Macromedia Flash File Format (SWF) SDK)
|
DefineText |
||
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 11 |
|
TextId |
UI16 |
ID for this character |
|
TextBounds |
RECT |
Bounds of the text |
|
TextMatrix |
MATRIX |
Matrix for the text |
|
TextGlyphBits |
NglyphBits = UI8 |
Bits in each glyph index |
|
TextAdvanceBits |
NadvanceBits = UI8 |
Bits in each advance value |
|
TextRecords |
TEXTRECORD[zero
or more] |
Text records |
|
TextEndOfRecordsFlag |
UI8 = 0 |
Always set to zero |
The TextBounds field is the rectangle that completely encloses all the characters in this text block.
The TextGlyphBits field defines the number of bits used for the TextGlyphIndex field in each GLYPHENTRY record.
The TextAdvanceBits field defines the number of bits used for the TextGlyphAdvance field in each GLYPHENTRY record.
Text Records come in two flavors; Type 0 and Type 1. The first bit of the TEXTRECORD determines the type.
(See class FTextRecord in the Macromedia Flash File Format (SWF) SDK)
|
TEXTRECORD |
||
|
Field |
Type |
Comment |
|
TextRecordType |
UB[1] |
0 = glyph record 1 = text style record |
A Type 1 Record sets text styles for subsequent characters. It can be used to select a font, change the text color, change the point size, or insert a line break. The new text styles apply until another type 1 record changes the styles.
The array of text records always
begins with a type 1 record to set the initial position and style.
(See class FTextChangeRecord
in the Macromedia Flash File Format (SWF) SDK)
|
TEXTRECORDTYPE1 (Text Style Change Record) |
||
|
Field |
Type |
Comment |
|
TextRecordType |
UB[1] = 1 |
1 if text state change
record |
|
TextReserved |
UB[3] |
Reserved always 0 |
|
TextHasFont |
HasFont = UB[1] |
1 if text font specified |
|
TextHasColor |
HasColor = UB[1] |
1 if text color specified |
|
TextHasYOffset |
HasYOffset = UB[1] |
1 if Y offset specified |
|
TextHasXOffset |
HasXOffset = UB[1] |
1 if X offset specified |
|
TextFontID |
If hasFont UI16 |
Font ID for following text |
|
TextColor |
If hasColor RGB If this record is part of a
DefineText2 tag then RGBA |
Font color for following text |
|
TextXOffset |
If hasXOffset SI16 |
Font X offset for following
text |
|
TextYOffset |
If hasYOffset SI16 |
Font Y offset for following
text |
|
TextHeight |
If hasFont UI16 |
Font height for following
text |
The
TextFontID field is used to select a previously defined font. This ID uniquely identifies a DefineFont tag
earlier in the Macromedia Flash (SWF) file.
The TextHeight field defines the point size of the font in twips. For example, a point size of 50 is equivalent to a TextHeight of 1000. (50 * 20 = 1000).
The TextXOffset field
defines the offset from the left of the TextBounds rectangle to the reference
point of the glyph. Typically, the
reference point is on the baseline, near the left side of the glyph (see example glyph diagram). The TextXOffset is generally used to
create indented text, such as right-justified text. If there is no TextXOffset
specified, the offset is assumed to be zero.
The TextYOffset field
defines the offset from the top of the TextBounds rectangle to the reference
point of the glyph. Typically, the
reference point is on the baseline, near the left side of the glyph (see example glyph
diagram). The TextYOffset is generally used to insert line breaks, by
moving the text position to start of a new line.
The Type 0 Text Record defines the actual characters in a text string. Characters are referred to by an index into the current fonts glyph table, not by an ASCII or Unicode value. A Type 0 Text Record contains a group of characters that all share the same text style, and are on the same line of text.
(See class FTextGlyphRecord in the Macromedia Flash File Format (SWF) SDK)
|
TEXTRECORDTYPE0 (Glyph Record) |
||
|
Field |
Type |
Comment |
|
TextRecordType |
UB[1] = 0 |
0 if text glyph record |
|
TextGlyphCount |
nGlyphs = UB[7] |
Number of glyphs in record |
|
TextGlyphEntries |
GLYPHENTRY[nGlyphs] |
Glyph entry see below |
The TextGlyphCount field defines the number of characters in this string, and the size of the GLYPHENTRY table.
The GLYPHENTRY structure describes a single character in a line of text. It is comprised of an index into the current fonts glyph table, and an advance value. The advance value is the horizontal distance between the reference point of this character, and the following character.
(See class FGlyphEntry in the Macromedia Flash File Format (SWF) SDK)
|
GLYPHENTRY |
||
|
Field |
Type |
Comment |
|
TextGlyphIndex |
UB[nGlyphBits] |
Glyph index into current
font |
|
TextGlyphAdvance |
SB[nAdvanceBits] |
X advance value for glyph |
Macromedia Flash (SWF) also supports the use of native fonts. Rather than
using the glyph outlines in the DefineFont tag, fonts can be rendered using the
client machines font engine. Since
most native font engines include hinting techniques, they may produce better
results at very small point sizes.
The DefineFontInfo tag defines the mapping of a Flash font to a native font. It includes the font name, font style bold, italic, or plain, and the encoding scheme used ANSI, Unicode or ShiftJIS. It also defines a mapping of glyph indices to character codes. Thus if a were the first character in your DefineFont tag, the DefineFontInfo tag would map index zero to the character code for a.
(See class FDTDefineFontInfo in the Macromedia Flash File Format (SWF)
SDK)
|
DefineFontInfo |
||
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 13 |
|
FontId |
UI16 |
Font ID this information is
for |
|
FontNameLen |
NameLen = UI8 |
Length of font name |
|
FontName |
UI8[nameLen] |
Name of the font |
|
FontFlagsReserved |
UB[2] |
Reserved bit fields |
|
FontFlagsUnicode |
UB[1] |
Unicode character codes |
|
FontFlagsShiftJIS |
UB[1] |
ShiftJIS character codes |
|
FontFlagsANSI |
UB[1] |
ANSI character codes |
|
FontFlagsItalic |
UB[1] |
Font is italic |
|
FontFlagsBold |
UB[1] |
Font is bold |
|
FontFlagsWideCodes |
WideChars = UB[1] |
if 1 codeTable is UI16s
else UI8s |
|
CodeTable |
if wideChars = 1
U16[nGlyphs] |
Glyph to code table |
The DefineFont2 tag
extends the functionality of DefineFont. Enhancements include:
·
32-bit
entries in the OffsetTable, for fonts with more than 64K glyphs.
·
Mapping
to native fonts, by incorporating all the functionality of DefineFontInfo.
·
Ascent,
descent and leading information.
·
An
advance table that defines the advance for each glyph (in EM square
coordinates).
·
A
bounds table that defines the bounding-box of each glyph (in EM square
coordinates).
·
A
table of kerning pairs that defines the distance between pairs of glyphs.
(See class FDTDefineFont2 in the Macromedia Flash File Format (SWF)
SDK)
|
DefineFont2 |
||
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 48 |
|
FontId |
UI16 |
Font ID for this
information |
|
FontFlagsHasLayout |
UB[1] |
Has font metrics/layout
information |
|
FontFlagsShiftJIS |
UB[1] |
ShiftJIS encoding |
|
FontFlagsUnicode |
UB[1] |
Unicode encoding |
|
FontFlagsAnsi |
UB[1] |
ANSI encoding |
|
FontFlagsWideOffsets |
UB[1] |
If 1, uses 32 bit offsets |
|
FontFlagsWideCodes |
UB[1] |
If 1, font uses 16-bit codes, otherwise font uses 8 bit codes |
|
FontFlagsItalic |
UB[1] |
Italic Font |
|
FontFlagsBold |
UB[1] |
Bold Font |
|
FontFlagsReserved |
UB[8] |
Reserved Flags |
|
FontNameLen |
NameLen = UI8 |
Length of name |
|
FontName |
UI8[NameLen] |
Name of Font |
|
FontGlyphCount |
UI16 |
Count of Glyphs in font
nGlyphs |
|
FontOffsetTable |
If FontFlagsWideOffsets is
1, UI32[nGlyphs] else UI16[nGlyphs] |
|
|
FontCodeOffset |
If FontFlagsWideOffsets is
1, UI32 else UI16 |
Byte count from start of
the FontOffsetTable to start of FontCodeTable |
|
FontShapeTable |
SHAPE[nGlyphs] |
|
|
FontCodeTable |
If FontFlagsWideCodes is 1,
UI16[nGlyphs] else UI8[nGlyphs] |
|
|
FontAscent |
If FontFlagsHasLayout is 1, |
|
|
FontDescent |
If FontFlagsHasLayout is 1, |
|
|
FontLeading |
If FontFlagsHasLayout is 1, |
|
|
FontAdvanceTable |
If FontFlagsHasLayout is 1, |
|
|
FontBoundsTable |
If FontFlagsHasLayout = 1, |
Not used in Flash Player 4 |
|
FontKerningCount |
If FontFlagsHasLayout is 1, |
Not used in Flash Player 4 |
|
FontKerningTable |
If FontFlagsHasLayout is 1, |
Not used in Flash Player 4 |
A Kerning Record
defines the distance between two glyphs in EM square coordinates. Certain pairs of glyphs appear more
aesthetically pleasing if they are moved closer together, or farther apart. The
FontKerningCode1 and FontKerningCode2 fields are the character
codes for the left and right characters.
The FontKerningAdjustment field is a signed integer that defines
the offset from the advance value of the left-hand character. The distance between two characters can be
calculated like this:
Distance
= FontAdvanceTable[ord(FontKerningCode1)] + FontKerningAdjustment
(See class FKerningRec in
the Macromedia Flash File Format (SWF) SDK)
|
KERNINGRECORD |
||
|
Field |
Type |
Comment |
|
FontKerningCode1 |
If FontFlagsWideCodes is 1, UI16 else UI8 |
The character code of the left hand character. |
|
FontKerningCode2 |
If FontFlagsWideCodes is 1, UI16 else UI8 |
The character code of the right hand character. |
|
FontKerningAdjustment |
SI16 |
Adjustment relative to advance values. |
Note:
FontBoundsTable, FontKerningCount and FontKerningTable are not used in the
Macromedia Flash Player.
DefineText2
The DefineText2 tag
is almost identical to the DefineText tag. The only difference is that Type 1 Text Records contained
within a DefineText2 tag use an RGBA value (rather than an RGB value) to define
TextColor. This allows transparent
characters.
(See class FDTDefineText2 in the Macromedia Flash File Format (SWF)
SDK)
|
DefineText2 |
||
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 33 |
|
TextId |
UI16 |
ID for this character |
|
TextBounds |
Bounding box of the text |
|
|
TextMatrix |
Transform Matrix |
|
|
TextGlyphBits |
NglyphBits = UI8 |
Bits in each glyph index |
|
TextAdvanceBits |
NadvanceBits = UI8 |
Bits in each advance value |
|
TextRecords |
TEXTRECORD[zero
or more] |
Text records |
|
TextEndOfRecordsFlag |
UI8 = 0 |
Always set to zero |
The Macromedia Flash File Format (SWF) SDK contains C++ examples that demonstrate how to create fonts and text in SWF:
·
FExampleFont.cpp uses the low-level
manager to create a simple two-glyph font with the letters b and o, and a
text object with the string bob.
·
HFExampleFont.cpp uses the high-level
manager to create a font with the glyphs F, L, A, S, and H. The glyphs are added to the HFFont object
and associated with ASCII/Unicode equivalents.
A text object is created by referencing the glyphs by their
ASCII/Unicode values.
As well as static text, Macromedia Flash (SWF) (version 4) also supports editable text fields. A text field is similar to an input field in an HTML form, but it has all the typographic controls of Macromedia Flash text. Unlike HTML, a text entry box in a Macromedia Flash movie can be any color, font, size or style.
A text field is associated with a variable name where the contents of the text field are stored. The Macromedia Flash movie can perform some action based on the contents of the variable. For example, a search button could send the contents of a text field to a web server (using a GetURL action) which would display the search results.
The DefineEditText tag defines a TextField.
(See class FDTDefineEditText in the Macromedia Flash File Format (SWF) SDK)
|
DefineEditText |
||
|
Field |
Type |
Comment |
|
Header |
RECORDHEADER |
Tag ID = 37 |
|
TextId |
UI16 |
ID for this character |
|
Bounds |
RECT |
Rectangle that completely
encloses the text field. |
|
HasText |
HasText = UB[1] |
0 = text field has no
default text 1 = text field initially displays
the string specified by InitialText |
|
WordWrap |
WordWrap = UB[1] |
0 = text will not wrap and
scroll sideways. 1 = text will wrap
automatically when the end of line is reached. |
|
Multiline |
Multiline = UB[1] |
0 = text field is one line
only. 1 = text field is
multi-line and will scroll automatically. |
|
Password |
Password = UB[1] |
0 = characters are
displayed as typed. 1 = all characters are
displayed as an asterisk. |
|
ReadOnly |
ReadOnly = UB[1] |
0 = text editing is enabled 1 = text editing is
disabaled. |
|
HasTextColor |
HasTextColor = UB[1] |
0 = use default color 1 = use specified color
(TextColor) |
|
HasMaxLength |
HasMaxLength = UB[1] |
0 = length of text is
unlimited. 1 = maximum length of
string is specified by MaxLength. |
|
HasFont |
HasFont = UB[1] |
0 = use default font. 1 = use specified font
(FontID) and height (FontHeight) |
|
Reserved |
UB[2] |
Reserved for future use |
|
HasLayout |
HasLayout = UB[1] |
0 = no margins, indents or leading 1 = use specified margins, indents, and leading. |
|
NoSelect |
NoSelect = UB[1] |
0 = selections enabled 1 = selections
disabled |
|
Border |
Border = UB[1] |
0 = text field is drawn
without border. 1 = text field is drawn
with border. |
|
Reserved |
UB[2] |
Reserved for future use |
|
UseOutlines |
UseOutlines = UB[1] |
0 = |
|
FontID |
IF HasFont UI16 |
Font ID for text |
|
FontHeight |
IF HasFont UI16 |
Height of font in twips |
|
TextColor |
IF HasTextColor RGBA |
Color of text |
|
MaxLength |
IF HasMaxLength UI16 |
Text is restricted to this
length |
|
Align |
IF HasLayout U8 |
0 = Left |
|
LeftMargin |
IF HasLayout UI16 |
Left margin in twips |
|
RightMargin |
IF HasLayout UI16 |
Right margin in twips |
|
Indent |
IF HasLayout UI16 |
Indent in twips |
|
Leading |
IF HasLayout UI16 |
Leading in twips. |
|
VariableName |
Name of the variable where
the contents of the text field are stored. |
|
|
InitialText |
IF HasText STRING |
Text that is initially
displayed in the text field, before it is edited. |
Note: Fonts used by DefineEditText must be defined using DefineFont2, not DefineFont.
The Macromedia Flash File Format (SWF) SDK contains C++ examples that demonstrate how to create editable text fields in SWF:
·
FExampleEditText.cpp uses the low-level
manager to create a single-line editable text field, which contains the text
start initially. The
FDTDefineEditText object does not define any outlines (glyphs), it uses the
default font built into the Macromedia Flash Player.


|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
| Class Summary | |
|---|---|
| DOMParser | Generic methods used for XML parsing in general. |
| JavaRapPreProcessing | This class provides the conversion features needed to process both training and test data with
JavaRap and stores their results so that they can be used by JavaRapRunner
afterwards. |
| SalsaParser | This class provides a conversion from a Salsa/Tiger annotated file to an inline annotated file. |
Package used for Preprocessing the ACR results and to convert Salsa/Tiger.
ELAC's components PMM and ML expect the presence of corpora in MMAX2 format which have already
been processed by JavaRap and BART (LingPipe will be executed on the fly). The directory
containing the MMAX2 files should therefore also contain the results
of those two systems. This is done to save runtime as BART and JavaRap tend to be quite time
consuming.
To achieve this, we implemented a preprocessing package, which does the following:
./Basedata/javarap/
./Markables/.*response_level.xml
|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |


so maney car doors. big car doors. smale car doors. nice car doors. cool car door.
big doors. gold doors. smale doors. wood doors. metal doors. cool doors.


Press n or j to go to the next uncovered block, b, p or k for the previous block.
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| index.js |
|
100% | 3/3 | 100% | 0/0 | 100% | 0/0 | 100% | 3/3 |
| liner.js |
|
100% | 14/14 | 100% | 8/8 | 100% | 1/1 | 100% | 14/14 |
| parse.js |
|
100% | 12/12 | 100% | 0/0 | 100% | 1/1 | 100% | 12/12 |
| parser.js |
|
99.15% | 233/235 | 96.27% | 129/134 | 95.65% | 22/23 | 99.54% | 218/219 |
| preprocess.js |
|
100% | 74/74 | 98.08% | 51/52 | 100% | 7/7 | 100% | 68/68 |
| stringifier.js |
|
93.22% | 55/59 | 78.57% | 33/42 | 100% | 12/12 | 94.34% | 50/53 |
| stringify.js |
|
100% | 4/4 | 100% | 0/0 | 100% | 1/1 | 100% | 4/4 |
| tokenize.js |
|
88.14% | 156/177 | 80.49% | 66/82 | 50% | 1/2 | 89.66% | 156/174 |


World Wide Web Access Statistics
All Accesses by Domain for IUSOCS
November 1999
Requests Received During Summary Period 21
Bytes Transmitted During Summary Period 599609
Average Requests Received Daily 10
Average Bytes Transmitted Daily 299804
There were no accesses from this domain.
Requests Received During Summary Period 56
Bytes Transmitted During Summary Period 643965
Average Requests Received Daily 4
Average Bytes Transmitted Daily 49536
Requests Received During Summary Period 23
Bytes Transmitted During Summary Period 317484
Average Requests Received Daily 12
Average Bytes Transmitted Daily 158742
Requests Received During Summary Period 118
Bytes Transmitted During Summary Period 1875372
Average Requests Received Daily 7
Average Bytes Transmitted Daily 104187
Requests Received During Summary Period 17
Bytes Transmitted During Summary Period 309867
Average Requests Received Daily 6
Average Bytes Transmitted Daily 103289
Requests Received During Summary Period 60
Bytes Transmitted During Summary Period 1282042
Average Requests Received Daily 10
Average Bytes Transmitted Daily 213674


Automatic generation produced by ISE Eiffel
-- Generated by ISE Eiffel --
For more details: www.eiffel.com


Yue Zhou (Joe)
Web Developer
I am an enthusiastic and high-achieving developer, who regards building high-quality and valuable web systems as the very essence of my career. I have exceptional technical and analytical skills, with experience in web development. I love to combine bunch of suitable technologies to realise some amazing ideas and taking the project to the next stage.
Home
- The Pie Chart illustrates changes in the ………
- The graph/ table shows/ indicates/ illustrates/ reveals/ represents/ elucidates/ depicts that ………
- It can be seen from the graph/ table that ………………
- As is illustrated by the graph/ table…………..
- Some Terms that are used for GRAPHS :-
FOR DECREASE/ FALL :- Dramatic fall, Gradual fall, Marked fall, Rapid fall, Moderate fall, Significant fall, Slight fall, Sharp fall, Sudden fall, Decreased at an astounding rate, Plummeted, decline/ dropped with slight fluctuations, Downward trend.
FOR INCREASE :- Gradual Increase, Marked Increase, Moderate Increase, Sharp increase, Significant increase, Steady Increase, Steep Increase, Reached at highest level, Improvement, Recovery, Recovered slightly or strongly, Upward trend.
- Overall this represents a huge increase in the number of ………..
- The Bar Chart illustrates the number of ………
- The year 2011 saw the most dramatic developments …
- There was also a significant growth in the number of ……..
- There was a dramatic increase in ……..
- Prices rose steadily…………
- The 2 pie charts give information about ……..
- It is immediately obvious that there some things are significantly different between the two charts.
- There has been a notable increase in …….
- There are some similarities, however,……….
- It is interesting to note that ……..
- The rate of decline of X appears to be slowed
- There was also a fall in the number of ……..
- The X increased slightly in 2000 but it dropped again in 2002
- The overall trend has been a positive one.
- The overall sales trend is an upward trend.
- Experienced a dramatic fall in numbers
- Although the trend was downwards overall.
- This figure is double that of X and three times that of Y
- However this trend changes considerably in 2008
- Sales figure rose significantly throughout this time
- The figure began to rise more significantly in 2000
- The vertical axis represents the X and the horizontal axis represents the Y
- Overall the chart indicates that there were greater fluctuations .
- In brief there were marked differences in …………..
- From the graph it is generally obvious that …………..
- The curve gradually increases to reach ……..
- This is followed by gradual decline in ……………….
- Then there is sharp rise in ……………..
- In summer time the curve gradually decrease to reach its lower limit
- There is a slight fall in ………………
- There was dramatic rise in…………
- Market fluctuated considerably
- After that however there was a gradual decline in ……….
- This table clearly presents and compares ………..
- In this analysis we will examine 3 pie charts ……….
- The diagram provides an overview of ……………
- The table show 2 sets of related information
- The overall trend shows fluctuation with slight increased towards the end of the period.
- The table gives the breakdown of …………….
- It is noticeable that ……….
- A similar pattern can be seen in X
- The given line graph illustrates information on the number of………
- In fact there is considerable fluctuation in the ………….
- Although there have been fluctuation in this trend ………
- The most obvious trend in this graph is that ………….
- The most outstanding feature of the graph is that ………..
- However for the next few years the sales declined steadily
- Some areas remained relatively unchanged.
- The most striking feature of the graph is …………
- There was not a noticeable difference between ……….
- Another outstanding fact is that ……………………..
- There had been a considerable growth in the …………….
- In 1998, however, the sales of company X marginally overtook the sales of company Y.
- Aged 7 to 14 years registered the second highest figure of around ……………
- To put in a nutshell, it is apparent that ……………
- An astounding 98% of the population lived in X city.
- It was closely followed by …………….
- There was a steep decline in the sales till 2004 with slight fluctuations.
- The sales of company X and Y were more or less at a parallel level.
- Pizza was the most favorite food in the age bracket of 18-25 years.
- Based on the statistics, it is estimated that ……………..
- In conclusion, considerable variations can be seen in all age groups.
- The most striking/ outstanding feature of the graph is that ………………….
- The pie chart elucidates that ……………………….
- A cursory glance at the graph is adequate enough to see that the Rap music is the most favorite genre of music among the youngsters and has a lion’s share of music lovers.
- The sales of the company X were almost 3 times as compared to company Y sales in the year 2002.
- The bar graph gives a clear picture of the ……………………………..
- Overall there had been an increasing trend in …………………….
- The sales plummeted from 30% to a marginal 5%.
- A glance at the graph reveals that ……………………
- After 2009, the rate started climbing at an even pace.
- Both the ratios kept closer to each other during the most part.
- Both the rates kept fluctuating throughout the period.
- The line graph portrays an interesting study of the ………………………
- Overall, it is apparent from the graph that ……………………………………
- The multiple bar graph elucidates that …………………
- It is evident from a quick glance at the graph that …………………..
- Overall it had a “ lion’s share “ as compared to its counterparts.


Loading...


runtime.m.cgoCallers (field)
13 uses
runtime (current package)
cgocall.go#L138: mp.cgoCallers[0] = 0
proc.go#L760: mp.cgoCallers = new(cgoCallers)
proc.go#L4485: if atomic.Load(&mp.cgoCallersUse) == 0 && mp.cgoCallers != nil && mp.cgoCallers[0] != 0 {
proc.go#L4486: for cgoOff < len(mp.cgoCallers) && mp.cgoCallers[cgoOff] != 0 {
proc.go#L4489: copy(stk[:], mp.cgoCallers[:cgoOff])
proc.go#L4490: mp.cgoCallers[0] = 0
runtime2.go#L522: cgoCallers *cgoCallers // cgo traceback if crashing in cgo call
traceback.go#L708: if iscgo && gp.m != nil && gp.m.ncgo > 0 && gp.syscallsp != 0 && gp.m.cgoCallers != nil && gp.m.cgoCallers[0] != 0 {
traceback.go#L716: cgoCallers := *gp.m.cgoCallers
traceback.go#L717: gp.m.cgoCallers[0] = 0
The pages are generated with Golds v0.2.7-preview. (GOOS=darwin GOARCH=amd64)


Sorry, something has gone wrong. You have slipped into an alternate reality where this page does not exist, the colour scheme is better, and the velociraptor is king.


ATTENTION: BENEFICIARY This is to officially inform you that we have verified your contract /inheritance file and discovered reasons why you are yet to receive your payment. It is because of irregularities and complications discovered on your payment file by our technical experts in respect to your contract / inheritance payment requirements which have just been duly rectified. Meanwhile, we have been informed that you are still dealing with impostors and non recommended officials in the bank. Such acts must stop for security reasons if you wish to receive your payment. Since we have decided to bring a solution to your problem, right now we have arranged your payment through our atm swift card payment this is the latest instruction by our president Chief, Olusegun Obasonjo (GCFR)federal republic of Nigeria. Below is the arrangement... The swift card center will send you an ATM CARD which you will use to withdrew your money from any atm machine in any part of the world, but the maximum is one thousand dollars per day, so if you would like to receive your fund through this way do let us know by contacting the card payment center Dr Hassan Ali on E-mail<EMAIL_ADDRESS>and Prof.Charles c. Soludo, Governor Central Bank of Nigeria on email for more information:(profsoludocbn60@yahoo.com).Tel;234-8055158993. And also send the following information to swift card center: 1 phone and fax number, 2 address where you want them to send the card through DHL courier service (p.o box not accepted) 3 your full name and total amount you are expecting. Instead of losing your fund.Please indicate to the card center the total sum you are expecting and for your information you have to stop any further communication with any institution or office until you receive the ATM CARD. Call CBN Governor as soon as you receive this important message on his direct number:234-8055158993 for more direction on this regards and also update him for further instruction and directives.Note:because of impostors,we hereby issue you our code of conduct tag number which is (105)so you must have to indicate this code when contacting the card payment center. We await your urgent response. THANKS, DR.USMAN ABUBAKAR DIRECTOR OF FOREIGN REMITTANCE CENTRAL BANK OF NIGERIA.


Please check your schedule often. Any changes to due dates, solutions to some of the assigned problems, as well as MATLAB
code shown in class throughout the semester will be posted to that page:
Late submission is subject to a 10% penalty for each day late. After three days, late submissions can only get 30% points. Students are strongly advised that any act of cheating will result in a score of 0 for the entire assignment and repeat offences will be reported to the Office of the Dean of Students and will result in an automatic F grade. You are encouraged to discuss problems and ideas but the final solution or code must be your own.
Grading policy: Homework assignments 10%, Lab assignments 10%, Quiz 10%.
The class material builds on itself and getting behind is a huge no-no. Getting behind will hinder your progress on the following assignments and impede your understanding of the lectures. Don’t do this!
Although you are encouraged to discuss ideas with others, your programs are to be completed independently and should be original work. Whenever you obtain significant help (from other students, students in other classes, etc.) you should credit those who helped you in your work, e.g. “The idea to remove the outliers before running my regression model for the third time came from a discussion with my roommate’s sister, Alice P. Hacker, who took this class, like, two semesters ago.” Any assistance that is not given proper citation will be considered a violation of the Honor Code. The following three activities are among what will be considered to be Honor Code violations:


DR. NO A film review by James Berardinelli Copyright 1996 James Berardinelli
RATING (0 TO 10): 7.4 Alternative Scale: *** out of ****
United Kingdom, 1962 Running Length: 1:51 MPAA Classification: PG (Violence, sexual innuendo) Theatrical Aspect Ratio: 1.75:1
Cast: Sean Connery, Joseph Wiseman, Jack Lord, John Kitzmiller, Ursula Andress, Bernard Lee, Lois Maxwell Director: Terence Young Producers: Harry Saltzman and Albert R. Broccoli Screenplay: Richard Maibaum, Johnanna Harwood, and Berkely Mather based on the novel by Ian Fleming Cinematography: Ted Moore Music: Monty Norman U.S. Distributor: United Artists
Barring a television adaptation of CASINO ROYALE in the 1950s (not to be confused with the 1967 movie of the same name), 1962's DR. NO was the first opportunity fans of Ian Fleming's James Bond had to watch the intrepid superspy in action. However, producers Harry Saltzman and Albert Broccoli wanted their movie to appeal to a wider audience than just Fleming's readers. To that end, they altered the 007 of the novels to better fit the screen. Bond became more suave and witty, and less cold-blooded. Nevertheless, the hero of DR. NO is still grittier than he would become by GOLDFINGER (released only two years later), and bears little resemblance to the version of Bond essayed by Roger Moore beginning in 1973.
Although many have rightly commented that DR. NO (the movie) is one of the closest cinematic interpretations of any Bond novel in tone and plot, Sean Connery was not among Fleming's choices to play 007 (the author stated his preference to be David Niven). That didn't stop the public from immediately embracing Connery, and, after just one movie in what was to become cinema's longest-running series, he was regarded as the definitive Bond. Today, even after four others have taken the role, stalwart Connery fans view George Lazenby, Roger Moore, Timothy Dalton, and Pierce Brosnan as impostors.
Story-wise, DR. NO isn't all that different from most of the other Bond plotlines, although it is a little more "bare bones". When a British agent assigned to Jamaica disappears, M (Bernard Lee) sends 007 to the Caribbean to look into the situation. Upon arrival, Bond is immediately the target of a would-be assassin, and, as his investigation leads him closer to the truth, attempts on his life become more frequent. After joining forces with CIA operative Felix Leiter (Jack Lord), Bond enlists the aid of boat owner Quarrel (John Kitzmiller) to take him to Crab Key Island, which is ruled by the mysterious Dr. No (Joseph Wiseman). Once there, in addition to meeting a scantily-dressed young woman named Honey Ryder (Ursula Andress), 007 learns why no one ever returns from Crab Key.
With the exception of the big explosion during the film's finale, DR. NO is a low-key adventure. There are no gadgets, forcing Bond to rely on his ingenuity (in one scene, when he needs to breathe while submerged, he uses hollowed-out reeds as air tubes). The single car chase is reasonably straightforward. And, for the only time in the series, 007 is unmistakably brutalized, appearing bloody, beaten, and disheveled as a result. Regardless, he still defeats the villain and gets the girl.
Many elements of the "Bond formula" are present in their infancy. Maurice Binder does the opening titles, although they lack the flair of his later contributions. The "James Bond theme", co-created by Monty Norman and John Barry (although exactly who is responsible for the bulk of the piece remains a topic of contention to this day), peppers an otherwise unmemorable score. M and Moneypenny make their screen debuts (Q first appeared in the next film, FROM RUSSIA WITH LOVE), and the first -- and perhaps best-remembered -- Bond girl, Ursula Andress, sets a standard that hasn't wavered in more than thirty years. All-in-all, DR. NO is a successful, if not superlative, motion picture. While it may appear tame by the standards of the later productions, it's an entertaining look back in movie history at a project that developed into a worldwide phenomenon.
- James Berardinelli<EMAIL_ADDRESS>The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


This function is used to load the counts needed to compute the ICTPD from a database in OMOP CDM format.
getDbIctpdData(connectionDetails, cdmDatabaseSchema, oracleTempSchema = cdmDatabaseSchema, cdmVersion = "5", exposureOutcomePairs, exposureDatabaseSchema = cdmDatabaseSchema, exposureTable = "drug_era", outcomeDatabaseSchema = cdmDatabaseSchema, outcomeTable = "condition_era", controlPeriodStart = -1080, controlPeriodEnd = -361, riskPeriodStart = 1, riskPeriodEnd = 30, censor = FALSE)
| connectionDetails | An R object of type |
|---|---|
| cdmDatabaseSchema | Name of database schema that contains OMOP CDM and vocabulary. |
| oracleTempSchema | For Oracle only: the name of the database schema where you want all temporary tables to be managed. Requires create/insert permissions to this database. |
| cdmVersion | Define the OMOP CDM version used: currently supports "5". |
| exposureOutcomePairs | A data frame with at least two columns:
|
| exposureDatabaseSchema | The name of the database schema that is the location where the exposure data is available. If exposureTable = DRUG_ERA, exposureSchema is not used by assumed to be cdmSchema. Requires read permissions to this database. |
| exposureTable | The tablename that contains the exposure cohorts. If exposureTable <> DRUG_ERA, then expectation is exposureTable has format of COHORT table: COHORT_DEFINITION_ID, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE. |
| outcomeDatabaseSchema | The name of the database schema that is the location where the data used to define the outcome cohorts is available. If exposureTable = CONDITION_ERA, exposureSchema is not used by assumed to be cdmSchema. Requires read permissions to this database. |
| outcomeTable | The tablename that contains the outcome cohorts. If outcomeTable <> CONDITION_OCCURRENCE, then expectation is outcomeTable has format of COHORT table: COHORT_DEFINITION_ID, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE. |
| controlPeriodStart | start of the control period - can be set between -99999 and 0, default is -1080. |
| controlPeriodEnd | end of the control period - can be set between -99999 and 0, default is -361. |
| riskPeriodStart | start of the risk period - can be set between 0 and 99999, default is 1. |
| riskPeriodEnd | end of the risk period - can be set between 0 and 99999, default is 30. |
| censor | a flag indicating wether the method should censor the observation period at the end of exposure or not. Available input is 0 or 1 with default = 0. |
An object of type ictpdData
containing counts that can be used in the
calculateStatisticsIc
function.
# NOT RUN { library(SelfControlledCohort) connectionDetails <- createConnectionDetails(dbms = "postgresql", user = "joe", password = "secret", server = "myserver") exposureOutcomePairs <- data.frame(outcomeId = c(196794, 196794, 312648), exposurId = c(1501700, 1545958, 1551803)) ictpdData <- getDbIctpdData(connectionDetails, cdmDatabaseSchema = "cdm_schema.dbo", exposureOutcomePairs = exposureOutcomePairs) ictpdResults <- calculateStatisticsIC(ictpdData) ictpdResults # }


Blackjack
Want To play a round
Cards:
New Cards:
You select:
Sum:
Start Game
New Card
You Select
Total:
Per: $


We exchange solutions!
- engage best-of-breed partnerships
- enhance extensible action-items
- visualize intuitive partnerships
- visualize synergistic schemas
- drive rich networks
- integrate leading-edge networks
- target global e-tailers
- enhance compelling convergence
- strategize e-business convergence
- redefine web-enabled synergies
- enable one-to-one schemas


Steve Martin was hilarious on "Saturday Night Live". Eddie Murphy was hilarious on "Saturday Night Live". Therefore, we know both of these men can be hilarious.  Anyway, we know these men have potential. However, it seems their movie careers are always a bit shaky. For every Dr. Dolittle, Eddie Murphy follows up with a Holy Man. But, Bowfinger is a great follow-up. It capitalizes on the strengths of each actor and makes for an all out funny film. Now, most of you have read my review for Austin Powers: The Spy Who Shagged Me. In my opinion, it is the best comedy of the summer. I gave it four stars out of a possible four stars. My review of Bowfinger is three and a half stars out of a possible four star rating. Just to reiterate my Powers review, I do not necessarily mean that this is an epic film. Bowfinger, like The Spy Who Shagged Me, is a comedy. It does not need Oscar-caliber acting, only a clever script and believable acting. Now on with my review. Bowfinger is hilarious. If you have any idea of the movie industry, you will be laughing throughout the film. It combines a clever script with knockout humor.  Either way, Bowfinger is a very funny and enjoyable experience. Steve Martin wrote the script and stars in Bowfinger. He plays Bobby Bowfinger, a struggling filmmaker who tries to act the posh life of a Hollywood movie man. However, he fails miserably. He thinks he strikes gold when his accountant gives him a script entitled, Chubby Rain. Right from the get-go, the movie makes fun of the typical Hollywood blockbuster. It moves on with Bobby Bowfinger trying to give the script to a studio. He finds a studio executive, played by Robert Downey Jr., who thinks it is a joke and will only make the film if Bobby can get Kit Ramsey, the hottest star in Hollywood, to take the lead role in Chubby Rain. So, Bowfinger tries to get Ramsey by trying to act "ghetto" and fails miserably. But, Bowfinger cannot let his cast down, so he tells them Ramsey accepted the role. What is his plan? To get his actors to run up to Ramsey and say their lines without Ramsey knowing. Let's just say comedy ensues. Steve Martin is great in this film. Not only does he mock Hollywood, but also he creates clever jokes and funny one-liners that do not necessarily spoof the movie industry. This makes it a unique film because it does not rely on spoof jokes to carry it through all ninety-six minutes. Eddie Murphy is back with a vengeance in Bowfinger. He does double duty as Kit Ramsey and Jiff, Ramsey's look alike and brother. He plays both roles superbly, with a sharp contrast.   Murphy plays both roles with wit and charm. His Jiff character falls short at the end, but his role as Kit is terrific. This film probably would have been a bust if not for Murphy. We believe that Murphy believes aliens are after him, which makes the film even funnier. The supporting cast is great, as well. They do not get in the way that much, and feed off the humor of Martin and Murphy. Christine Baranski plays a diva, and is funny despite a lack of screen time. Jamie Kennedy plays Martin's right hand man, and does it with flair. He does not go over the edge and just sets up Martin's humor. The only member of the supporting cast who does not do that well is Heather Graham. She starts off as a wishful actress, leaving Ohio for Hollywood and asking, "Where do I become an actress?" once she gets off the bus. But, she then becomes some sleeping around actress who just wants more lines. The transition is hardly believable, and keeps Bowfinger from becoming an even better comedy. Overall, Bowfinger is a must-see. Besides, Austin Powers: The Spy Who Shagged Me, Bowfinger is the best comedy of the year. It is witty, clever and most of all, unique. It does not rely on spoof jokes, but clever jokes as well. And it is aided by the sharp and hilarious performances by Steve Martin and Eddie Murphy. You will not see Murphy and Martin at the Academy Awards, but you will see them entertaining audiences for the last few weeks of the summer. Four Stars out of Four Stars The Movie Page- http://jump.to/moviepage Reviews, Previews, News and So Much More!
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


smoke surgical plume laser evacuation {border-style px;} #ffffff;} filter procedures suction particles particulate evacuator matter Table masks Surg Surgical air capture exposure electrosurgical hazards size care infectious tubing used Figure evacuators health px; unit {font-family AORN chronic devices font-size protection ventilation Dermatol depending double; efficient exhaust generated guidelines measures minimum odor room standard team Laser Smoke border-color border-width charcoal clinic dermatology different efficiency electrocautery filters filtration good greater held plume. protective rate reduction risk safe setting solid; source systems tissue use {font-style {font-weight DNA General HEPA Indian Standard available bacteria benzene, bold carbon chemicals comparison contaminants courier; education em; environment following high-filtration human importance in-line include infection internal noxious offer padding produced pt;} pump recommended site smoke: toxic transmission ventilation, wall


Before Change
@ In, None
@ Out, d, dict, stateful dictionary
d = copy.copy(self.__dict__)
// set up a seed for the next pickled iteration
if self.reseedCopies:
rand = randomUtils.randomIntegers(1,int(2**20),self)
d["random seed"] = rand
return d
def __setstate__(self,d):
After Change
@ In, None
@ Out, d, dict, stateful dictionary
d = supervisedLearning.__getstate__(self)
eng=d.pop("randomEng")
randCounts = eng.get_rng_state()
d["crow_rng_counts"] = randCounts
return d
def __setstate__(self,d):


--- layout: archive title: Zulip Chat Archive permalink: /stream/113489-new-members/topic/On.20the.20side.20of.20logic.html ---
Hi everyone: The manual online has this example among the problems at the very end of chapter 3:
example : P ∨ ¬P := sorry
and states classical reasoning is needed. I came up with the following:
variable P : Prop local attribute [instance] classical.prop_decidable example : P ∨ ¬P := begin by_contradiction h, push_neg at h, apply h.left, exact h.right, end
but am wondering if someone with a stronger foundation in logic could comment: is there a more first-principles proof than this?
A simpler proof would just use classical.em
. If you really want to prove it from first principles then you would probably have to somehow derive it from propext
, quot.sound
and classical.choice
(all of which the built-in classical.em
depends on)
Also, watching a Coq video inspired me to try this:
-- prove Peirce <-> em def peirce := ∀ P Q : Prop, (( P → Q ) → P ) → P def lem := ∀ P : Prop, P ∨ ¬P theorem peirce_imp_em : peirce → lem := begin unfold peirce, intros pei P, by_contradiction npOnp, have H1 := pei (P ∨ ¬P), have H2 : P ∨ ¬P → P ∨ ¬P, from self_to_self (P ∨ ¬P),
but I'm having trouble completing this proof because of what appears to be not enough knowledge of Lean. Anyone can help?
@Donald Sebastian Leung Right, using classical.em is very easy because it is totally equivalent. But it's not very illuminating.
Dan Stanescu said:
Donald Sebastian Leung Right, using classical.em is very easy because it is totally equivalent. But it's not very illuminating.
True - the first principles proof would probably need all 3 of those axioms as I mentioned above (which I have not attempted to prove).
The answer kind of depends on what "first principles" you want to start from. If your first principles are "the axioms of Lean including its version of choice," the argument can be seen here: https://github.com/leanprover-community/lean/blob/master/library/init/classical.lean
It's not trivial to follow.
@Rob Lewis Great, I'll take a look. I'm just wondering what the authors of the manual meant by a proof at that point.
Dan Stanescu said:
Also, watching a Coq video inspired me to try this:
-- prove Peirce <-> em def peirce := ∀ P Q : Prop, (( P → Q ) → P ) → P def lem := ∀ P : Prop, P ∨ ¬P theorem peirce_imp_em : peirce → lem := begin unfold peirce, intros pei P, by_contradiction npOnp, have H1 := pei (P ∨ ¬P), have H2 : P ∨ ¬P → P ∨ ¬P, from self_to_self (P ∨ ¬P),but I'm having trouble completing this proof because of what appears to be not enough knowledge of Lean. Anyone can help?
I've probably done this in Coq before since I completed Chapter 6 of Logical Foundations quite a while ago but I can't remember off the top of my head. Anyway, if you decide to attempt that exercise then you should completely avoid classical reasoning
My suggestion is to show ¬¬(P ∨ ¬P)
without using classical reasoning, then use one of the various classical axioms (e.g. Peirce) to show that this implies P ∨ ¬P
.
Dan Stanescu said:
Rob Lewis Great, I'll take a look. I'm just wondering what the authors of the manual meant by a proof at that point.
Honestly, I have no idea :) the easier exercise is to prove it using classical.by_contradiction
(avoiding classical.em
and any of the tactics that will use classical logic implicitly).
In your tactic proof, by_contradiction
is fine, but push_neg
is cheating.
In fact, tactics aren't introduced at all until chapter 5, so the intended proof should probably be in term mode.
To clarify: by "cheating" I don't mean that it's using classical logic, I mean that it's doing some reasoning you may want to practice.
Thanks to all! I did get hooked to tactics before term mode because of my initial contact with Lean being through some YouTube videos, but I should turn back to term mode.
@Anne Baanen Either way I still have trouble producing in Lean the required term to which I could apply Peirce. Nevertheless, thanks for the advice!
I did get hooked to tactics before term mode ...
Understandable, IMO constructing a proof using tactics is much more pleasant than doing it in term mode, especially when you get to use black magick automation :wink: It sometimes makes me wonder how it feels to be an Agda developer ...
Dan Stanescu said:
...because of my initial contact with Lean being through some YouTube videos...
Oh wow. What YouTube videos are driving people here? I keep meaning to put up some simple 5 minute videos doing basic stuff but somehow never seem to get around to it.
Definitely do that!
I was introduced to LEAN by your talk "The Future of Mathematics" which hit first page on /r/programming, and later the article on chalkdust.
Something like https://wwwf.imperial.ac.uk/~buzzard/lean_together/lean_intro.mp4 demonstrating different aspects of lean would be nice. I want to show everyone else how cool lean is but my competency is not quite there yet!
ha ha if you get competent then you can make the videos yourself :-) There are some professional video people at Imperial who I want to work with but unfortunately they want to make professional videos and I just want to knock up some random rough and ready thing.
That's something I have considered. I find, in addition to the formal abstracts project, the promise of using lean for education is very interesting.
I wonder if it is possible to use lean as a back-end for some kind of user-friendly graphical interface for learning proofs that wouldn't require any programming.
There is already something like this in Coq I believe?
Kevin Buzzard said:
There is already something like this in Coq I believe?
Yeah, probably GeoCoq/GeoProof or something like that
But it's specific to geometry, I believe
I was thinking about something @Patrick Massot told me about.
Really nicely done, GUI where you can pull in things like induction
etc
I couldn't find anything thus far, ProofGeneral looks like something but it's not specific to Coq, plus it runs inside Emacs
@Kevin Buzzard I started by looking at some videos by Zachary Goldstein. There's a big lack of videos on Lean. Apart from those, the only other ones were Scott Morisson's install guide and a talk about proving compilers correct I think.
Kevin means https://www.edukera.com/
That's true. I'm not sure if there's a point in spending too much effort if lean 4 is on the way and contains breaking changes
Thanks @Patrick Massot, I'll have a look :)
Patrick Massot said:
Kevin means https://www.edukera.com/
Just out of interest, how much of what Coq can do can this GUI do? Would I be able to, for example, define my own inductive data type?
No.
You can only do exercises, and only the exercises that were created by the creators of this site.
Aha, I see
Interesting nonetheless
At least last time I checked, teachers using this website couldn't create any new exercise.
Speaking of GUIs teaching the fundamentals of proof, it reminds me of The Incredible Proof Machine
Basically, it reduces propositional logic and its inference rules to connecting components in a circuit
Tried recently to talk my colleagues in the philosophy department into looking at Lean, which I think would be a great benefit to students, and got feedback of this kind:
We are using Lemmon’s natural deduction system, which has only ten primitive rules and a particular way of keeping track of dependencies. For example, our rule of conditional proof (conditionalization) has, in contrast to many others, a built-in formal relevance condition that is expressed in dependency numbers. Would Lean be able to mimic such a rule?
I don't think there is any problem. Since I'm not at all familiar with Lemmon's system (apart from Wikipedia) though and pretty new to Lean as well, is there someone with a solid background in formal logic who could comment on whether Lean would have trouble there or not?
the #explode
command will attempt to print proof terms in such a tabular format
You can also pretty explicitly enumerate and reference named items using term mode/structured proofs.
example (a b c : Prop) : (a → b) → (b → c) → a → c := assume h1 : a → b, assume h2 : b → c, assume h3 : a, have h4 : b, from h1 h3, show c, from h2 h4
The exact definition of "relevance condition" they're using is probably something more involved, maybe you can get them to send you an example?
Jesse Michael Han said:
the
#explode
command will attempt to print proof terms in such a tabular format
Where is #explode
hiding? It looks like my Lean installation (version 3.4.2) can't find it.
import tactic def x := 3 #explode mul_add
The def is to work around the fact that you can't have a #something
directly after the imports.
import tactic.explode
would also work
The first time I see this, but if I only have import tactic
it doesn't work. It does work if I have:
import tactic.explode def x := 3 #explode mul_add
I don't know what works in 3.4.2, I tend to keep up to date with Lean and mathlib. The new tooling makes this really easy. Just go into the root directory of your project folder and type leanproject up
. I was doing this with 3.7.something
I'm a little confused with versions. The Lean GitHub page seems to say that 3.4.2 is the latest version (obviously not true, so I don't know what I'm doing wrong there) and doing update-mathlib
just keeps the same 3.4.2 version without a leanproject
command.
You are using a frozen repo and frozen tooling.
Lean 3 development now happens over at https://github.com/leanprover-community ; there is a non-MS community fork.
here is where to start.
MS are developing Lean 4 and have lost interest in supporting Lean 3 any more, so some of the amazing people here on this chat are doing the bug fixes etc.
I think it should be made much clearer on the fork README that this is a community fork and in active development.
@Wojciech Nawrocki don't you think that the README on the community fork need a serious update? It should be made clear that the fork is not MS-endorsed but that it is in active development.
Oh -- I guess this is kind of there in the "IMPORTANT" coment :-)
Would it be normal to say the current release number at the top of the README? "3.7.2c" or whatever?
I think both the community fork README and Leo's README are pretty clear already.
In particular, Leo's version does mention the community fork very visibly.
I think it would help to have the current version in the readme as well, to put the 3.4.2 in context
OK. I misread the "important" comment on the commuity fork as saying "This is 3.4.2 and it will not change any more"
That was what prompted my comment.
there should also be a link to leanprover/lean
repo somewhere on the readme. I am surprised to see that leanprover-community/lean
is not actually a fork according to github
Maybe the very first line of the README should make it clear that this is a fork of the official repo, whatever Github claims, and that the current version is whatever it is.
I think the "Important:" comment should lead with the community version. Something like:
Lean 3.7.2 Community Edition
Important: This fork is maintained and updated by the Lean community. The last official release for Lean 3.x is Lean 3.4.2, which can be found here. The Lean developers are currently developing Lean 4.
I made lean#158 for this.
Many thanks!
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


Welcome to Information Retriever powered by Aztec™ ♥
You can request infomation through this window after login in using below button
login
Drop comments!
We would like to have your comments.
send
thanks for staying tuned! ♥ Aztec
Acess to information is your right feel free to request.


Triggered when a new download is created.
Events of this type are no longer delivered, but it's possible that they exist in timelines of some users. You cannot create webhooks that listen to these events.
| Key | Type | Description |
|---|---|---|
download |
object |
The download that was just created. |
download


Default action for Multi-Tab Close icon:
Close all tabs
Close other tabs
Close all tabs and open a new tab
Close all tabs to the right
Close all tabs to the left
Close all empty tabs (except active empty tab)
Note: pinned tabs are never harmed


Online Campus Crime Reporting
This web page is provided as a special service for those who want to report criminal activity occurring at The University of Zimbabwe campus or the immediate area surrounding the campus, and is not meant to replace the normal crime reporting process. Please do not report emergency or crisis information, or situations requiring an immediate response by way of Public Safety through this form. Anonymous crime reports of crime are accepted.


"Ideas worth sharing!"
Global Conference
TEDx Talks
2021
A joyful celebration believing in the value of openness and sharing, creating a positive change with people from over 80 countries is takign place in January, in korea
2021.01.15(FRI) ~ 16(SAT)
@ National Museum of Korea, Art Center Nabi and more
Main Program
Lecture
Listen to the speakers from various countries about the messages of sharing and opening.
Forum
Listen to the speakers from various countries about the messages of sharing and opening.
Workshop
Listen to the speakers from various countries about the messages of sharing and opening.
Feedback
Listen to the speakers from various countries about the messages of sharing and opening.
Tickets
Listen to the speakers from various countries about the messages of sharing and opening.
Join the TED talks 2021
See the whole program
Featured Speakers
Yochai Benkler
Berkman Professor for Entrepreneurial Legal Studies at Harvard Law School
Benkler studies commons-based peer production, and published his seminal book The Wealth of Networks in 2006.
Kilnam Chon
Kilnam CHon helped bring the internet to Asia and is an outspoken advocate for the open web and digital commons. in 2012 he was inducted into the inaugural class of the Internet Society's(ISOC) internet hall of fame.
SohYeong Noh
Director of Art centre Nabi and a board member of CC Korea
As the main venue for the new media art production in Korea, Nabi promotes cross-disciplinary collaboration and understanding among science technology, humanities and the arts.
Julia Leda
President of Young Pirates of Europe
European integration, political democracy and participation of youth through online as her major concern. Reda's report outlining potential changes to EU copyright law was approved by the Parliament in July.
Lila Tretikov
Executive Director of the Wikimedia Foundation
Lila Tretikov is the Executive Director of Wikimedia Foundation, the non-profit organization that operates Wikipedia. Wikipedia is freely available in 290 languages and used by nearly half a billion people around the world.
Ryan Merkley
Executive Director of the Wikimedia Foundation
Ryan had been leading open-source projects at the Mozilla Foundation such as the open source movement.
Partners


Protocol error while connecting to Bazaar server.
Consult Nginx error log for details.
OK, return to my Red Pitaya.


nips nips2001 nips2001-14 nips2001-14-reference knowledge-graph by maker-knowledge-mining
Source: pdf
Author: Stuart N. Wrigley, Guy J. Brown
Abstract: A model of auditory grouping is described in which auditory attention plays a key role. The model is based upon an oscillatory correlation framework, in which neural oscillators representing a single perceptual stream are synchronised, and are desynchronised from oscillators representing other streams. The model suggests a mechanism by which attention can be directed to the high or low tones in a repeating sequence of tones with alternating frequencies. In addition, it simulates the perceptual segregation of a mistuned harmonic from a complex tone. 1
[1] Anstis, S. & Saida, S. (1985) Adaptation to auditory streaming of frequency-modulated tones. J. Exp. Psychol. Human 11 257-271.
[2] Bregman, A. S. (1990) Auditory Scene Analysis. Cambridge MA: MIT Press.
[3] Brown, G. J. & Cooke, M. (1994) Computational auditory scene analysis. Comput. Speech Lang. 8, pp. 297-336.
[4] Carlyon, R. P., Cusack, R., Foxton, J. M. & Robertson, I. H. (2001) Effects of attention and unilateral neglect on auditory stream segregation. J. Exp. Psychol. Human 27(1) 115-127.
[5] Darwin, C. J., Hukin, R. W. & Al-Khatib, B. Y. (1995) Grouping in pitch perception: Evidence for sequential constraints. J. Acoust. Soc. Am. 98(2)Pt1 880-885.
[6] Joliot, M., Ribary, U. & Llinás, R. (1994) Human oscillatory brain activity near 40 Hz coexists with cognitive temporal binding. Proc. Natl. Acad. Sci. USA 91 11748-51.
[7] Mondor, T. A. & Bregman, A. S. (1994) Allocating attention to frequency regions. Percept. Psychophys. 56(3) 268-276.
[8] Moore, B. C. J. (1997) An introduction to the psychology of hearing. Academic Press.
[9] Spence, C. J., Driver, J. (1994) Covert spatial orienting in audition: exogenous and endogenous mechanisms. J. Exp. Psychol. Human 20(3) 555-574.
[10] Wang, D. L. (1996) Primitive auditory segregation based on oscillatory correlation. Cognitive Sci. 20 409-456.
[11] Wang, D. L. & Brown, G. J. (1999) Separation of speech from interfering sounds based on oscillatory correlation. IEEE Trans. Neural Networks 10 684-697.


Places We've Been!
Enter a destination you've been to:
What landmarks does this place have?
What activities did you do?
Extra notes:
Submit
Places:
Landmark:
Activities:
Notes:


Lecturer: Diana Skrzydlo (Skryzlo)
Office Hours: MF 3:30-5 in M3 3106 & W 11:30-12:30 in M3 3144
What is probability?
The likelihood of an event occuring
Definitions to set up a probability model
Review Question:
What is essential to the classical definition of probability?
Outcomes are equally likely
Example
Experiment: Roll a 6-sided die repeatedly
Trial: One roll
Outcomes: 1, 2, … , 5, 6
= {1, 2, 3, 4, 5, 6} (most versatile)
= {even, odd} (also works)
Example
A = “a 1 is rolled” -> A = {1}
B = “the number is odd” -> B = {1, 3, 5}
Note: events consisting of one sample point are simple events, otherwise they are called compound events On any trial, if the outcome is in the event A, we say A has occurred.
E.g. if a 1 is rolled -> A occurs, B occurs
3 is rolled -> B occurs, A does not
6 is rolled -> neither occur
is a function that maps events in a sample space to numbers such that
Recall
P(A) is the probability that A occurs. A is a subset of S. If A is compound, its prob is the sum of the probs of the simple events that make up A.
Two basic counting rules:
“with replacement” - is possible to obtain the same result more than once. Then it’ll have choices. M spaces, k options.
A permutation is an ordering of k objects selected from n objects without replacement. Let n = number of objects. K spaces. The order matters! = “n to k factors” =
Also
Tip, if computing a certain permutation is hard, try 1 - opposite of what you want to find. Eg. Find P(of at least one repeat) turns into 1 - P(no repeats) which is easier.
A combination is a selection of k objects from n objects without replacement. The order does NOT matter. E.g. drawing a hand of cards. Denoted by N choose K (I forget how to this) Pascal triangle - n choose k is the kth entry in the nth row.

Example:
A box of 10 computer chips containing 3 defective ones in the box. Four of the chips are tested. What is the probability that 1 is found defective?
Solution:
W/o rep & don’t care about order.
The whole time, we don’t care about order. (i.e. we don’t need to worry if the defective one is first, last or etc)
Note: “1 if found” means exactly 1. Not at least one.
Can be arranged where and is number of type k.
Recall - event -> subset of S for any event A,
Rules for probabilities
If an event A is contained in another event B (A subset B) Then,
thus,
A_bar , A^c, A^’, -> NOT A. Aunion B = or. A intersect B = and.
Bar{aunionB} = a_bar and b_bar
bar{aintersectB} = a_bar or b_bar
P(a union B) = P(A) + P(B) - P(AB)
applies when events are independent of each other (don’t affect one another)
Recall: Independent: P(AB) = P(A)P(B)
Conditional prob of A given B: P(A|B) =
Last time we had
A = small = 3
C = total = 8
P(A|C) = 1/5
P(A) = 1/6
C occuring makes A more likely.
P(C|A) = 1/6, P(C) = 5/36
A occurring makes C more likely. Dependence is a two-way relationship
Alternative defn of independence. P(A|B) = P(A)
knowing B occurred has no effect on the probability of A occurring. P(B|A) = P(B)
Example:
Diana has 2 kids. Each independently has 0.5 chance of having red hair. At least one has red hair. What is the probability the other does? Let A = at least one red
| Kid 1 | Kid 2 | |
|---|---|---|
red |
0.25 | 0.25 |
not red |
0.25 | 0.25 |
P(A) = 0.75
P(both|A) = P(both and A) / P(A) = 0.25/0.75 = 1/3
If we rearrange the definition of conditional prob, we get:
P(AB) = P(B)P(A|B)
P(AB) = P(A)P(B|A)
Intuitively, think of “checking” whether A occurred. If it did, “check” whether B occurred (knowing A did). (or you check B first, then A) Works for both dependent and independent events.
Extends nicely to multiple events P(ABC) = P(B)P(C|B)P(A|BC)
The order doesn’t matter as long as each probability is conditional on what we know.
Let be a collection of events that are mutually exclusive cover the sample space
(break S up into k disjoint pieces) This is a partition of S
e.g. A and A_bar is a partition of size 2.
For any event B in S, we can express it as B =
So P(B) = using product rule
Example:
Three people A,B,C are writing code together. A produces twice as much as B or C
1% of A’s code has errors
2% of B’s
5% of C’s
What is the probability that a random line of code has errors?
Let E = line has error
A = line written by A
B = line written by B
C = line written by C
We want P(E)
Using the partition {A, B, C}, P(A) = 0.5 , P(B) = P(C) = 0.25
We have P(E|A) = 0.01
P(E|B) = 0.02
P(E|C) = 0.05
So
We found P(E) = 0.0225 using law of total prob. We would like to know, if we find an error, whose fault is it?
We had to reverse the direction of the conditioning: we have P(E|author). We want P(author|E).
also written as
For this example:
Example
Your spam filter has 90% detection rate but 1% false positive rate. Suppose 25% of messages are spam
Let S = “message is spam” P(S) = 0.25 P(S’) = 0.75
I = “Identified as spam”
P(I/S) = 0.9 -> P(I’|S) = 0.0
photo here<>
Supervised learning -> give some training data
Unsupervised learning -> no training data
Bayesian Classifier
P(Category 1 | evidence) =
3 doors. 1 door is revealed to be a dud. Do you switch doors?
Yes
Bayes’ Rule:
P(A|B) =
Product rule + law of total prob. A and A’ is a partition
Def. A random variable (rv) is a function that maps points in a sample space to Real numbers
The values that the rv can take on are called the RANGE of the rv. By convention, we call rvs X,Y,Z and the values, x,y,z
We are interested in finding the prob. that a rv X takes on one of it’s particular values. ie P(X =x) (outcome is a sample point that maps to x)
There are two types of rvs, discrete -> finite or countably infinite range vs continuous -> incountably infinite range
More than one rv can be defined on the same S
eg roll 3 fair 6-sided dice.
X = sum on 3 dice {3, … , 18}
Y = avg value {1, … , 6}
Z = the 3 digit number created by the dice
W = the product of the 3 {1, 2, … , 216}
U = number of 3s {1,2,3}
etc
Def. The probability factor (pf) of a discrete rv X is f(x) = P(X = x) and is only defined for x range of X. f(x) if x does not belong in range is undefined or 0.
- Properties of f(x)
- for all x range of f(x) . Why? it’s a probability
- The events “X = x” are mutually exclusive for each x
Def. The cumulative distribution function (cdf) of the rv X is F(x) = P(X x) and is defined for ALL Real x.
Recall: Random variable (X) maps sample points to Real numbers
Probability function f(x) = P(X=x) x range
Cumulative distribution function F(x) = P() x
Example:
| x | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| f(x) | 125/216 | 75/216 | 15/216 | 1/216 |
| F(x) | 125/216 | 200/216 | 215/216 | 1 |
Let’s graph it to show what happens at other Real values of x.
Relationship between F and f
f(x) = the size of the jump in F(x) at the point x = F(x) - F(x-1) <- which is the next smallest value in range
We can use F(x) to find = P()
Let X be a rv on the range {a, a+1, …, b} where & a,b where each value is equally likely. Then we say X has a discrete uniform distribution on [a , b] in other words, “X~DU[a,b]” . X has a DU distribution of [a,b]
e.g.
Find the pf f(x) = P(X = x) = c must be constant since all equal
We need
Find the cdf
Example
You are looking through a linked list of 100 items for one particular item. Let X = # of comparisons to find it. Claim: X ~ DU [1, 100]
Set up: we have N objects -> r “successes”, N-r “Failures”
We choose n without replacement
Let X = “# of S’s chosen”
eg. if x=# of winning numbers on a lotto 6/49 ticket
X ~ Hyp(N,r,n)
N=49, r = 6, n =6
Find the pf f(x) = P(X=x) = P(we get x S’s and n-x F’s)
range of x?
lower bound: , possible to run out of F’s so remaining will all be S’s
upper bound x \leq n (all 5’s), x \leq r (could run out of S’s)
so the range of X is messy and depends on the relationship btwn N, r, and n.
Also, there is no closed form expression for F(x). You have to add up the f(x) values which is computationally intensive when N is large.
Example:
You have 10 cards - 7 treasure, 3 non-treasure.
Draw 5 without replacement. Let X = “# of treasure cards”. X ~ Hyp(N=10, r=7, n=5)
f(x) = P(X = x) = for x = 2,3,4,5
All the values of f(x) will add up to 1
(proven using Hypergeometric series result)
Set up: Bernoulli trials - independent trials, 2 outcomes on each (S or F), P(S) = P is constant for all trials
We do n trials.
Let X = # of S in n trials
(You can imagine it as a Hypergeometric selecting with replacement instead of without.)
We write X ~ Bin(n, p)
Eg. Flip a fair coin 10 times, x = # heads, X ~ Bin (n = 10, p = 0.5)
Find the pf f(x) = P(X=x) = P(we get x S’s and n-x F’s) = p^x(1-p)^(n-x)j
Recall:
X~Hyp(N, r, n)
X = # S’s in n objects w/o rep
X~Bin(n,p)
Example:
Want to send a 4-bit message. Each bit is independently flipped (0->1 or 1->0)
Probability = 0.1
P(message received correctly?)
Let X = # of bits flipped
X~Bin(4, 0.1)
P(X=0) =
Now add 3 “parity bits” to the message which allows the receiver to detect and fix up to 1 error.
Let Y = # bits flipped ~Bin(7, 0.1)
P(Y=0) + P(Y=1) are both ok.
(ie. n << N) then it doesn’t make a big difference to the probabilities if you sample with or without replacement. If we did it with replacement the number of S’s we get
X~Bin(n,p=)
So when N is large and n is small, we can use a Bin(n, ) to approximate a Hyp(N,r,m). (when is less than 0.05)
recall: Negative Binomial (5.5)
Bernoulli trials (indep, S or F P(S)=p) X = # of F’s before the Kth S is obtained
pf and examples of NB
Geometric rv (5.6)
How to tell when to use distributions
| Bin | NB |
|---|---|
| -know # trials(n) | -know # successes(k) |
| -? successes modelled by X | -? trails modelled by k+x |
We write
range
We can show that
But there is no closed form expression for
Example:
A startup is looking for 5 investors. Each investor will independently say yes with probability 0.2. Founders will ask investors one at a time until they get 5 yes. Let X=total # of investors asked. Find f(x) and f(10).
Let Y = # who say no (Y+5=X)
So
(nothing to do with hypergeometric)
Special case of NB with k=1.
X= # of F’s before obtaining the first S in Bernoulli trails
X~Geo(p)
range: {0, 1, 2, …}
no orderings to worry about since it’s just FFFF….FS (x F’s)
Easy to show using infinite geometric series formula
| Discrete Uniform | Hypergeometric | Bin | NB | Geometric | Poisson | |
|---|---|---|---|---|---|---|
| pf f(x) | ||||||
| range | {a, a+1, .. ,b} | weird! | 0,…,n | 0,1,… | 0,1 … | 0,1,2,… |
| cdf F(x) | no closed form | no | no | |||
| when to use? | - counting # S | Bin with large n, small p (approx) |
f(x)
When to use? = Bin with large n, small p (approx)
range 0,1,2,…
Recall: uniform, hypergeometric, binomial, NB, geometric
Poisson dist from Bin (5.7)
Poisson process (5.8)
We say X has a Poisson distribution with parameter ( if for
Easy to show since
The Poisson is a limiting case of the Binomial when n-> and p->0 such that the product np remains constant
Let np =
then,
So if we have a Bin(n,p) with large n and small p, we can approx if with a Poisson rv with parameter . Guideline: and works well!
Example:
Roll up the Rim - “1 in 9 cups win!” You buy 100 cups (treat as independent). Find prob you get 10 or fewer winning cups.
X= # winning
So:
Try Poisson approx
Not a great approx since was a bit too high to be “close to 0”
Clicker question
Suppose you type at exactly 90 words pm and on each word have a 1% chance of making an error. After 1 minute, what is the probability you have made NO errors?
0.405 -> from bin. 0.407 -> from poisson
You can also use Poisson when by instead modelling the number of F’s instead of S’s.
Consider “events” occurring randomly throughout time/space according to 3 conditions:
E.g. emails into an inbox
Cars through an intersection
Births in a large population
Imagine we observe a Poisson process (with rate ) for t units of time.
Let X = # of events that occur.
X is a discrete rv with no maximum.
It turns out that:
X ~ Poi( = Xt)
ie. for x = 0, 1, 2
Proof: See course notes
Add one more column to your chart!
| Poisson
f(x) | |
When to use? = Bin with large n, small p (approx)
range 0,1,2,…
When NOT to use?
We can specify a maximum
If it makes sense to ask how many time the event did not occur
Example:
requests to a web server follow the conditions of a Poisson process with rate 100 per minute.
Find prob of 1 request in 1 sec. 90 requests in 1 min.
Let X = # requests in 1 sec
X ~ Poi( or )
Let Y = # requrests in 1 min
Y ~ Poi()
P(Y=90) =
Many problems may combine more than one distribution together. Your task is to identify the distribution needed, depending on the perobability requested.
Example: Server requests 100/min
A 1-second period is “quiet” if it contains no requests.
a) Find the Prob of a “quiet” second.
X=# requests in 1 sec. X~Poi()
P(X = 0) =
b) Prob of 10 “quiet” seconds in a minute (60 non-overlapping sec)
Let Y = # “quiet” in 60 sec.
Y~Bin(60,0.189)
P(Y=10) =
c) Prob of having to wait 30 non-overlapping sec to get 2 “quiet”
Let Z = # non-quiet sec before 2 “quiet”
Z ~ NB(2, 0.189)
P(Z = 28) =
d) Given (c), the prob there is 1 “quiet” sec in the first 15 sec.
P(1 Q in 15 sec | wait 30 for 2 Q)
Use binomial for 1st prob. Geometric for 2nd.
Let X = # of kids in a family
To summarize the data, we can use:
1. A frequency distribution
| x | frequency |
|---|---|
| 1 | 10 |
| 2 | 14 |
| 3 | 10 |
| 4 | 1 |
| 5 | 2 |
2. a frequency histogram (different graph here because I was lazy and didn’t want to draw one in ms paint)
3. A single number representing the average or sample mean
4. median - the middle value: 2 in this case
5. mode - most common/frequent value (in this case, 2)
Expectation of a r.v. (7.2)
We had the sample mean of the kids be
We can replace the observed relative frequency with a theoretical probability of the r.v. equally x -> theoretical mean
2011 census:
| x | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| f(x) | 0.43 | 0.4 | 0.12 | 0.04 | 0.01 |
so the theoretical mean of X is:
and median is 2 since F(2) > 0.5 and F(1) < 0.5
and mode is 1
Def: The expected value or expectation or mean of a discrete r.v X is:
Recall - Expected value (aka mean) of X is
Can think of it as a weighted average of the values X can take with weights = probabilities or balance point of the histogram of f(x). Often we may be interested in the average value of the function of x. Eg. x = usage on phone. g(X) = cost of that usage.
Def: the expected value of g(X) for a discrete r.v. X is
weighted average of the g(x) values that can occur. (e.g. g(X) = 1000 + 250x)
What if ?
Here, because g(x) is non-linear function of X. Expectation is a linear operator.
SO ONLY USE IF g(X) IS LINEAR
Also:
If we have the distribution of X ans we let Y = g(X), we can find E[Y] by either: or by finding the range and pf of Y and using
Example
Suppose the time to finish a part on a coding question is 10 minutes if you make no errors. Syntax errors take 2 mins to fix. Logic errors take 10 min. Assume O(syntax error) = 0.1 , P(logic error) = 0.2 independently.
Find the average(expected) time to finish this question.
Let X = 0 (no errors), 1(syntax), 2(logic), 3(both),
| x | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| f(y) -> f(x) | 0.72 =(0.9*0.8) | (0.1)*(0.8) = .08 | (0.9)*(0.2)=0.18 | 0.02 |
| y -> g(x) | 10 | 12 | 20 | 22 |
So
Example:
A web server has a cache. 20% chance that the request is found in the cache (cache hit) -> 10 ms. If it’s not found (cache miss) then it takes 50(send msg) + 70(lookup) + 50(return answer) ms. Find the expected time with and without the cache.
Without: time is always 190ms So E[T] = 170.
With: Let X = 0 if found, 1 if not found
| x | 0 | 1 |
|---|---|---|
| f(x) | 0.2 | 0.8 |
| time=g(x) | 10 | 180 |
Recall:
The mean of X, E[X] tells us where the distribution is centered, on average. But the practice we also care about how widely spread out the distribution is around that mean.
E.g. determining the number of servers for an online system. need to know spread.
How to measure?
(not helpful!)
- average absolute distance from mean
So we use:
- average squared distance from mean
Def: Variance of a r.v. X is
Weighted average squared, distance from mean. If X is discrete,
Calc form of variance:
Where
Example:
X has pf
| x | 10 | 12 | 20 | 22 |
|---|---|---|---|---|
| f(x) | 0.72 | 0.08 | 0.18 | 0.62 |
We found min
Now
Note that variance is measured in units squared rather than the original units of X. Taking the square root of the variance makes more sense.
Defn: the standard deviation of X is
In our example, min
Remember, Var(X) will always be non-negative because it’s a weighted average of values
So SD(X) will also be and a Real number
by linearity of expectations
Note: b does not affect the variance since shifting the distribution doesn’t affect the spread. We increase all the distances by a factor of so the squared distances increase by
Finally,
Example
Suppose X has pf
| x | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| f(x) | 0.1 | 0.1 | 0.1 | 0.5 | 0.2 |
| y | 1 | 3 | 5 | 7 | 9 |
Let
But! We can calculate the Var(Y) in a different way!
Verify and
Note: Var is smaller than mean when or the variance is small since there’s less uncertainty
is the same so are and cdf Claim: F(x) is continuous for a cts rv X Proof ie F(x) is left cts similarly F(x) is right cts So F(x) is everywhere continuous (not necessarily everywhere differentiaible) As before, its non-decreasing We also want to know how X behaves locally Def: The probability density function (pdf) f(x) for a continuous r. v. X is f(x) = F’(x) (where the derivative exist) It represents a relative likelihood of X being “near” the value x Properties of f(x)Recall: continuous rv. has uncountable range for any x, P(X=x) = 0
Properties of F(x)
Probability density function f(x)
expectation + variance, percentiles
transformations
Imagine area of rectangle So f(x) can be thought of as a multiplier for an interval with that tells us the approx prob that X is within an interval of near the value x. for a small interval Expectation Def: The mean of a cts rv X is Def: The pth percentile of X is the value such that: eg. is the median Find for the previous exampleNote: f(x) is NOT a probability!
a) Let X = # who add in 1 day
X~ Poi()
We know P(X=0) = 0.1353
But
Equating and solving,
b)
looks like binomial. We could have at the beginning, used binomial and have gotten the same result.
c)
d) Y = # bad days out of 7
Y~Bin(7,0.41)
e) Let Z = # good before first bad
Z ~ Geo(0.41)
a)
b)
general
c) range of R: {0, 1, 2, 3}
from before
Similarly, and
So
d) we know
take d/dr of bs
Now
Why?
Waiting time is inversely proportional to the prob of success.
| x | 3 | 4 | 5 | 6 |
|---|---|---|---|---|
| f(x) | 0.02 | 0.13 | 0.75 | 0.1 |
suppose the hours of schoolwork you have each week are 20sqrtx and your stress level is 2X^2
a) Find the expected schoolwork hours and the expected stress level of a random student.
b) Find the variance of these quantities
a) Let Y =
| x | f(x) | y | z | y^2 | z^2 |
|---|---|---|---|---|---|
| 3 | 0.02 | 34.64 | 18 | 1200 | 324 |
| 4 | 0.13 | 40 | 32 | 1600 | 1024 |
| 5 | 0.75 | 50 | 2000 | … | |
| 6 | 0.1 | 72 | 2400 | … |
-> Var(Y) = 6.60
-> Var(Z) = 110.31
f(x) = ksqrtx for 0 < x < 1
f(x) = k/2 (3-x) for 1 < x < 3
f(x) = 0 otherwise
see learn
a) we need
So
recall: cdf, pdf, mean, percentiles of cts X
Uniform distribution (8.2)
transformations / change of variable (8.1)
SWAG: computer -generated random numbers
Example:
A cont rv X has pdf f(x) = for 0 < x < 2 and 0 otherwise
Find c:
f(x) = F’(x)
all x
so
So F(x) = 0 if x < 0
F(x) = 1 x > 2
Find P(X>1)
Find E[X]
E[X] =
Def: If a cts rv X takes values on (a,b), a < b R st all subintervals of fixed length are equally likely. We say X~U(a,b). The endpoints a and b can be included or excluded, it doesn’t matter.
Find f(x) = c (a constant)
but we need
Sp F(x) = 0 for x < a
F(x) = 1 for x > b
So F(x) is not diff at a,b.
(average of end points)
Similarly Var(X) = (proof as exercise. Maybe on final :^))
Makes sense that it’s proportional to the square of the range.
Special case:
a=0, b=U~U(0,1)
otherwise
If we have the distribution X but we want we can find the cdf/pdf of Y by changing the variable in 3 steps.
Example:
Let X=# a spinner lands on between 0 and 4.
X~U(0,4)
Let and find
Step 1:
Step 2: We know for
for
for
So
and
Step 3: range of Y:
So for
otherwise
Note: if h(X) is invertible (1-1) we can differentiate after step 1 using the chain rule.
def: The exponential distribution is a cts rv defined for all positive Real numbers. It represents the waiting time between events in a Poisson process.
Find cdf of X=time until next event in P.p w rate .
F(x) = P(Xx) = 1 - P(X>x) = 1 - P(next event occurs more than x time from now)
= 1 - P(0 events in (0,x))
but # events in (0,x) in a P.p is Poi(x)
= 1 -
Thus f(x) = for x > 0
Alternate parameterization
for x > 0.
()
We say X~exp
E[X] =
use integration by parts OR we can use a trick called a Gamma function
Def:
Properties:
If ,
If ,
If is an integer ,
So
substitution:
Let
So:
Remember - rate of events in poisson process.
- average waiting time between events
So it makes sense that they are inversely related
,
So Var(X) =
i.e.
For Poisson, nean = variance = parameter .
For exponential mean = sd = parameter
Example:
Requests arrive to a server with an exp. distribution of wait times. 50% of the time, the wait is at best 15 sec.
a) Find avg time between requests
Let X = time between requests~exp
We know P(X > 15) = 0.5
So 1 - F(15) = 0.5
So
So
b) If a request has just come in, find the prob. another one comes in within 5 sec.
P(X < 5) = F(5) =
Could also do with Poisson rv.
The memoryless property
Example:
Suppose buses arrive according to a Poisson process with rate 5/hr.
Find P(wait > 15 mins)
t = min
X = waiting time ~exp(12)
P(X > 15) = 1 - (1 -
C) given you’ve already waiting 6 min, find prob you wait > 15 more min.
i.e. P(X > 21 | X > 6)
Waiting already done affect change future wait time
Recall: X~exp(), is waiting time between events in a Poisson proccess with rate (cts rv)
Var(X) =
Memoryless property
If X~exp()
P(X > t + s | X > t) = P(X > s)
Any waiting time already occurred is irrelevent in determining the remaining waiting time. This makes exp a bad choice for modelling human lifetimes.
Despite this we often use it in the short term for lifetimes of electronic or mechanical components.
Many real life phenomena seem to follow a Normal distribution.
- heights/weights
- test scores on learge standard tests
- logs of stock returns
- measurement errors
Def: We say X has a Normal Distribution X~N() if its pdf is:
for all Real x
What does it look life?
-symmetric around
-both lefts and right “tails” go to 0 quickly
- highest when x =
- area under curve = 1
We can show using a change of variable and the gamma function trick and also the median and mode are
And (proof again in uses gamma f’n)
the cdf
We cannot evaluate the integral! numerical methods are needed.
Note: the Normal distribution is also called the Gausian X~N(,) = X~G(,) <- where is SD
Standard Normal rv (special case)
Let ,
Z~N(0, 1)
standard Normal pdf for
The standard Normal cdf
still cannot be integrated analytically but tables of values of are readily available.
Using N(0,1) tables
row -> ones column and first decimal place
column -> second decimal place
e.g. P(z < 3.14) = 0.99916
to find F(z) where z < 0 use the fact that the Normal dist is symmetric.
Example:
Suppose a voltage of +2 or -2 is sent down a wire to represent 1 or 0. The connection is noisy and adds a N(0,1) amount to the voltage sent. The receiver interprets any voltage > +0.5 as a 1 or 0 otherwise.
Find P(error| 1 sent)
Let R = voltage received = 2 + Z where Z~N(0,1) is the noise
P(R < 0.5) = P(2 + Z < 0.5)) = P(Z < -1.5)
=1 - P( Z < +1.5)
= 1 - 0.93319
= 0.06681
P(error | 0 sent) R = -2 + Z
P(R > 0.5) = P(Z > 2.5) = 1 - P(Z < 2.5) = 1 - 0.99379 = 0.00621
Finding percentiles of N(0,1) is the value such that F() = p
F() = p connot be solved analytically so we use the F(z) table. Say we want
Recall: Normal Dist, probabilities + percentiles of N(0,1)
Transforming a Normal variable
Probabilities + percentiles of N(,)
Also Recall: X~N(,)
Standard Normal Z~N(0,1)
F(z) =P(Z z) in tables (use symmetry for negative values)
Also finding percentiles of N(0,1)
-can look for p in the main table and find the row + column closest
P(Z )=p
-or can look up in the reverse Normal table (at the bottom)
Example:
Find c such that
Since Normal Dist is symmetric, we look for c -> covers 90% (because the area outside the graph will be 20% / 2)
So c is the 90th percentile of N(0,1)
looking it up, c = 1.2816
In practice we want to find information, not just N(0,1)
Suppose X~N(, )
Let (a linear function of X)
Claim Z~N(0,1)
Proof
Which is the pdf of a N(0,1) rv
Examples
Heights of adult men are N(68, ). Find prob of a person being at least 77 in.
Let X = height of a random person from this population
P(X < 77) = P( > )
Example 2
Scores on the SAT reading test follow a N(504, ). What score is required to be in the top 10%?
Find s st
So set
In general, if X~N(,)
the percentile of X is
percentile of Z~N(0,1).
We have models (both discrete and continuous) for a single random quantity
But we are often interested in two or more rvs at the same time.
Eg. returns on two stocks X and Y
heights and weights
in a board game, # of a suit and # of a rank
treatment vs recovery
runtime vs algorithm used
In this course we’ll focus on the discrete case, but the continuous case is similar
Def:
For two discrete rvs X and Y, the joint pf is f(x,y)=P(X=x , Y=y)
i.e. the prob that X takes the value x AND Y takes the value y at the same time. Defined where x range of X and y Y. In general, the joint pf of , … , is f(,…) = P(, … , )
Similarly, to the single var case, f(x,y) can be displayed as a table or as a function of x and y.
Example:
Experiment: toss a fair coin 3 times
Let X = # heads
Y = 1 if heads , 0 otherwise
find f(x,y)
| f(x,y) | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| 0 | ||||
| 1 |
Note:
what if we only want info about X?
e.g.
P(X=0) = P(X=0, Y=0) + P(X=0, Y=1) = f(0,0) + f(0,1) =
etc
We get the pf of X by summing over the values of Y.
Similarly we could find the pf of Y by summing over the values of X.
Def: The marginal pf of X is and the marginal pf of Y is
Note: and will automatically satisfy the conditions for a pf
In general for X1 ,… , Xn , then the marginal pf of X1 is:
Recall: two events A and B are independent iff P(AB) = P(A)P(B). We extend this idea to rvs.
Def: Two discrete rvs X and Y are independent iff for all possible pairs (x,y)
Note: to show dependence, it suffices to find one pair (x,y) where this doesn’t hold to show Independence, check all pairs.
In general, X1,…Xn are independent of each other iff f(x1, …, xn) = for all n-tuples
In our example, f(0,1) = 0. but fx(0)fy(1) = 1/16 != 0
therefore X and Y are not dependent
A quick way to check for dependence is to find 0’s in the table
In other words, if the range is not a rectangle, formally a Cartesian product, the we know that the variables are dependent.
Remember conditional probability
We can extend to rvs
Def: The conditional pf of X given Y=y is:
Similarly
We may often be interested in the sum of X and Y or any function of any number of rvs.
eg. T = X + Y, U = 2(Y-X)
We can find the pf of the new rv based on the joint pf as follows:


Scholarly Communication & Research Analytics
Select experiment:
Select Set:
topics
authors
Select Similarity:
0.5
0.6
0.7
0.8
0.9
1
Select Trend visualization type:
stream
area
line
Select Journal:
Select Conference:
Home Page
Experiments' Page
Spider Graph
Trends Visualization
Cloud Visualization
Excel Sheets
Documentation
undo
redo
Visualize It!