In a previous article of this series we’ve studied Programming Language Parsers and answered the basic question: what are they?
We learnt that:
- Parsers are algorithms that decide whether or not a source code is correct with respect to the rules of a Grammar.
- Parsers get in input the list of Tokens produced by the Lexical Analysis, and output the yes/no decision, while building in memory a Parse-Tree.
And we also learnt what are the main features that distinguish parsers:
- Top-down or Bottom-up.
- Leftmost vs Rightmost.
- With or without backtracking.
- With or without recursion.
In order to successfully build a Parser, it’s worth taking as much time as we need for the design part, all while keeping the previous information on the top of our heads.
The goal is to make informed decisions about each of the above features. So, let’s see how to design a Parser.
Choosing The Parsing Algorithm
Before to start, remember that my ultimate objective is to learn so much about this subject that I can confidently build my own Programming Language, with its Compiler and hence its Parser.
In fact, I want to guide you through the decisional process I went through myself when I designed the Parser for my language.
Let me start with a bold sentence: writing a parser is a scientific task as much as a coding task; therefore, unless you’re exploring new research horizons, stick to the state of the art algorithms and don’t make a home-made design.
I am not saying that you should dry out the creative effort, not at all. What I am saying is: let scientific theory guide your efforts. Let me give you a few concrete examples.
To start the design of my parser, I could jump straight into writing utterly complex regular expressions and a gigantic loop that reads the source code, until it reaches the End Of File, and works on a case by case design, like in a huge if-then-else. And, maybe, it will work. Maybe it won’t.
Instead, I am going to stop for a second and ask myself: What kind of parser do I want to build, top-down or bottom-up?
I know that bottom-up parsers are a bit more powerful, but they also are much more complex. My objective is to fully understand a parsing algorithm in order to make my own, and then integrate it into my own compiler. Therefore I am going to choose a top-down design.
Then, I could open my text editor and start typing some code and… see what comes out of it. Instead, I am going to think for one more second and ask myself: Do I want to build a parser based on backtracking, or on lookahead?
Backtracking is a very interesting approach, but I am already familiar with it, since I studied it in the past in reasonable depth. Moreover, as I told you, backtracking parsers are a less common choice because their runtime can be very high. Therefore, I am going to design a LL(1) parser. Make no mistake about it: this choice implies that the parser will only work with LL(1) grammars.
I also decided to take a leftmost approach, as this is the most common choice.
Finally, there is the question about recursion. This is another question you should ask yourself at the start, because it influences all the upcoming development.
In fact, this was the toughest choice for me, because my objective was to learn as much as I could and both approaches (recursive and iterative) are really worth exploring. Thus, I chose both! I am going to start with a recursive design, and later learn how to implement the iterative equivalent of it.
Let’s recap. My choice is to build a top-down, recursive, LL(1) parser that uses leftmost derivations.
A Short Tour In The Definitions
Remember that the parser parses the grammar. NOT the language. This means that you must look for the grammar definition and analyze it in quite some depth, in order to build your parser.
Since I want a LL(1) parser, we can start reasoning about how to implement the lookahead. Theoreticians like to define two sets, called First and Follow. For a given symbol (or a sequence of symbols) $X$, here’s the definition of First set:
$$ \text{First}(X) = \{ t\, |\, t\, \text{is terminal}, X \rightarrow^* ta\} \bigcup \{ \epsilon | X \rightarrow^* \epsilon \} $$
Quick bit of notation: the symbol $\rightarrow^*$ means that what’s on right side of it can be achieved from what’s on the left, in any number of derivations. “Derivation” is to apply one production rule of the Grammar.
What does the definition say? It says that $\text{First}(X)$ is the set of all terminal symbols that appear at the beginning of the string after an arbitrary number of derivation. Also $\epsilon$ belongs to $\text{First}(X)$ if $X$ derives the null string.
The Follow set is defined only for a terminal symbol. So, here’s the definition for a terminal $A$:
$$ \text{Follow}(A) = \{\, t\, |\, t\, \text{is terminal}, S \rightarrow^+ bAtd \} \bigcup \{t\, |\, t=EOF, S\rightarrow^* aA \} $$
It says that Follow($A$) is the set of terminals that can appear immediately to the right of $A$ in some partial derivation (with at least one derivation step - that’s what $\rightarrow^+$ means). Furthermore, if $A$ can be the rightmost symbol in a derivation, then EOF is in Follow($A$).
Now that we have seen these definitions, I can also give you a more concrete view about why LL(1) grammars are a restricted subset of all grammars. In fact, a Grammar is LL(1) if, for every production rule A : p | g
, the following three conditions hold true:
- There isn’t any terminal symbol a such that both
p
andg
derive strings starting withA
. - At most one between
p
andg
can derive the empty string $\epsilon$. - If
g
derives $\epsilon$, thenp
does not derive any string that starts with a terminal in Follow($A$). Likewise, ifp
derives $\epsilon$, theng
does not derive any string that starts with a terminal in Follow($A$).
I hope you made it till this paragraph, despite the odd-looking definitions above!
The truth is that those definitions are really important from a conceptual point of view, but here is what I think:
In practice, though, it’s easier to simply ask ourselves, What tokens can possibly start phrases beginning at this alternative? The exact definition of FIRST is a bit much to chew on for our purposes here[…] (cit. Prof. Terrence Parr in his book about language implementation, see the references at the end).
Prototyping The Parser
Finally, we are going to see how to implement a parser algorithm!
Bear in mind that I am only going to discuss the strategic, high-level aspects of the implementation. Basically, the implementation design.
Regarding the actual code, it will have its space in the D section of my Compiler’s class: Do it.
To start off, remember that we are going to build a top-down, LL(1) (thus, with lookahead and without backtracking), recursive Parser.
Also, I think that it is worth looking at one example that clarifies the concept of LL(1), versus LL(k). In practice, LL(1) parser are those that can always take deterministic decision by just looking ahead one single token.
This feature, clearly depends on the grammar. So here’s an example of LL(1) grammar:
exp : ID
| '-' ID
| '+' ID
This grammar can easily be parsed by a LL(1) parser, because when the parser needs to decide what to do with an expr
(expression) token, it can look ahead one token: if it’s ID
then only the first production rule can be right; if it’s -
then only the second choice is valid; and if it’s +
then only the third one makes sense. If the lookahead token is none of the three, then a parsing error will be returned.
Let’s consider instead the following grammar:
expr : ID '++'
| ID '--'
A LL(1) will not be able to parse strings in this grammar, because knowing that the next token is ID
simply does not suffice to the goal. The parser would need to know also the token after that one. In fact, this is an example of LL(2) grammar.
Notice, however, that the grammar in the example could be left-factored and made LL(1), by rewriting it as:
expr : ID ( '++' | '--' )
Left-factoring Grammars is not something I am going to talk about in this article, therefore we can assume that we want to build a LL(1) parser because we know that the grammar is LL(1).
At this point, all information are in your brain, hopefully in your working memory, and we can get started.
The first thing to know, which helped me a lot, it to understand the overall structure of the software that we are going to write. In fact, a parser like the one we want to build should respect a very well known structure, that is basically a software design pattern. Let me give more details.
As we know, all types of Tokens in a Grammar can be classified into two sets: terminal tokens and nonterminal tokens. The key concepts to know are the following ones:
- For each Token we are going to call a procedure (call it “function”, or “method”, if you like).
- Procedures for the nonterminal tokens simply call the procedures for the tokens in the production rule to be applied.
- There is only one procedure for all terminal tokens, that simply matches the current input character(s) with the token type.
An example will make everything easier to figure out. Let’s consider this grammar:
expr : ID ('=' rhs)?
| NUM
rhs : ID | NUM | expr
It says that an expression can either be a NUM
(a number), or it can be an ID
(identifier) optionally followed by a =
symbol and a rhs
(right-hand side of the expression). Such rhs
token must be one between ID
, NUM
and expr
.
For instance the following strings are all valid expressions in this grammar.
5 // a single NUM is an expression
var1 // a single ID is also a valid expression
var = 5
var1 = var2
Due to the recursive nature of the definition, even the following string is valid
var1 = var2 = var3 = var4 = 5
Here’s an example of non-valid string, that must be rejected:
var1 = var2 =
That one is non-valid because the =
symbol MUST be followed by a rhs
.
The grammar is clearly LL(1), because when we are parsing an expr
token, knowing whether the next token is ID
or NUM
is enough knowledge to pick the correct production rule.
So, let’s start by considering the terminal tokens. As I said, there’s only one procedure for them; let’s call this procedure match
void match(int type_enum)
{
...
}
What is the argument type_enum
? It’s an integer, that in a Object-Oriented Language like Java would be instance of Enum
. Basically, a finite set of integers is used to identify one-to-one all terminal token types.
In the current example, we would have that
int 0
matches the token typeID
int 1
matches the token typeNUM
int 2
matches the symbol=
. Let’s call itEQUAL
and these are the only terminal tokens that we have.
The procedure match is really simple. Let’s assume that we have a global pointer to the next token in the input sequence, call it lookahead
. Let’s also say that the sequence of tokens is an array of pairs (token_type
, token_chars
), so that we can access the two elements of the pairs for each token in the array.
void match(int type_enum)
{
if (input_sequence[lookahead].token_type == type_enum)
consume();
else throw_error("Some message");
}
void consume() {
lookahead++;
if (lookahead >= input_sequence.length)
accept(); // input sequence is accepted
}
What happens in the code above? When match
is called, it checks that the next token is indeed of the type that we expect to see. If it’s not, then a parsing error is generated (with a meaningful message, hopefully). If it is, then we call the consume
procedure, that just advances the global pointer to the next location.
Keep in mind that in addition to advancing the pointer you may also want to build the parse tree in memory. This is why I suggest to have a separate procedure, consume
, so that you can change its behavior without touching ever again the match
procedure. For the time being, let’s keep consume very simple and just incrementing the pointer.
What about nonterminal token types? As I said, for each of these types we are going to have a separate procedure. In the example, the only nonterminal is expr
, so we only need to write one function.
How do procedures for nonterminals work? For LL(1) parsers this is going to be a piece of cake:
- Write a long
if-else
for each of the possible lookahead tokens that’s possible to have, or acase-switch
, if you prefer. - Each of these cases corresponds to a production rule. So, for each of them recursively call the procedures defined for the single pieces of that production rule. This will be clear with the example below.
- As “default” case in the
if-else
, generate an error, because it means the lookahead token is not valid in the grammar.
Alright, now let’s see the procedure for the expr
token type. As a convention, it makes sense to call the procedures for the nonterminals with the same name of the token type.
void expr(){
if (input_sequence[lookahead].token_type == NUM)
match(1); // 1 is the integer for NUM
else if (input_sequence[lookahead].token_type == ID){
match(0); // 0 is the integer for ID
if (input_sequence[lookahead].token_type == EQUAL){
// now call procedures for each piece
// of this production rule: expr ← ID '=' rhs
match(2); // 2 is the integer for EQUAL
rhs();
}
}
else generate_error("Helpful message");
}
void rhs(){
if (input_sequence[lookahead].token_type == NUM)
match(0);
else if (input_sequence[lookahead].token_type == ID)
match(1);
else if (input_sequence[lookahead].token_type == expr)
expr();
else
generate_error("Message");
}
There is one crucial factor into play: the lookahead point is a global variable that is updated (globally) each time match
, and therefore consume
, is called. This is extremely important for the overall strategy to work. Even if you don’t like global variables (I don’t either), all serious programming languages have constructs that allow this behavior.
To see why this is so important, just take a look at the nested if in the expr
procedure, the one that checks
input_sequence[lookahead].token_type == EQUAL
This if
instruction is called right after we called match(0)
, that did update the lookahead
pointer. As I said, it’s crucially important.
The second most important thing to notice is that the procedures for nonterminals invoke each other. So, the expr
procedure might call the rhs
procedure, if it matches successfully an ID
token first, and an EQUAL
token in second place. And the rhs
procedure might even call again expr
, if that’s what the lookahead suggests.
How can this work? How do we make sure that we are advancing in the input sequence while doing all these recursive calls?
Again, it’s because before calling any nonterminal procedure we always first consume the current token by invoking match, which advances the global lookahead pointer. Did I say that it is very important?
With some adjustment to this boilerplate code, and some more code to handle global pointers, input sequence and error messages, you’d have a pretty much complete parser for the grammar I wrote as an example!
Obviously, for any real grammar, one that makes sense, there would be many more procedures to create for nonterminal, and many more if-else to write.
As you can imagine, this task can be quite tedious and error-prone. Nonetheless, I believe this is the type of task that one has to do “once in a lifetime”, to understand the concepts in the deepest possible details. After that unique time, it makes sense to use tools that automate it (such as ANTLR).
What’s next
A Parser is the second step in the process of compiling a source code. It comes after the Lexical Analysis, and before the Semantic Analysis.
Building parsers is a complex task, that has been heavily studied from theoretical point of view, along with Formal Grammars.
In this article I showed you how to design a parser, and, perhaps more importantly, what are the strategic decisions that must be taken before going into the coding effort. In particular, we also saw the template code for a LL(1), top-down, recursive-descent parser.
The other top-down, LL(1) alternative is an iterative approach, that uses a “parsing table” and a stack-like data structure to imitate recursion. Such alternative approach is more involved but can have some advantages in terms of memory management, and I will talk about it in a companion article.
If you’re not too interested in the theoretical details of parsing algorithms, then the choice is clear: jump onto the next step – Semantic Analysis!
Resources
My article What is a Programming Language Grammar?.
Language Implementation Patterns. A book by Prof. Terrence Parr.
The Dragon Book. Compilers: Principles, Techniques and Tools. Wikipedia page (of the book).


--- sort_order: 196 tei_id: rdx_v6vhx.p.idm140456973659136 annotation_count: 0 images: small-thumbnail: https://readux.ecds.emory.edu/books/readux:v5mxs/pages/readux:v6vhx/mini-thumbnail/ json: https://readux.ecds.emory.edu/books/readux:v5mxs/pages/readux:v6vhx/info/ full: https://readux.ecds.emory.edu/books/readux:v5mxs/pages/readux:v6vhx/fs/ page: https://readux.ecds.emory.edu/books/readux:v5mxs/pages/readux:v6vhx/single-page/ thumbnail: https://readux.ecds.emory.edu/books/readux:v5mxs/pages/readux:v6vhx/thumbnail/ title: Page 192 number: 192 permalink: "/pages/192/" ---


# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # __all__ = ['SparkConf'] import sys [docs]class SparkConf(object): """ Configuration for a Spark application. Used to set various Spark parameters as key-value pairs. Most of the time, you would create a SparkConf object with ``SparkConf()``, which will load values from `spark.*` Java system properties as well. In this case, any parameters you set directly on the :class:`SparkConf` object take priority over system properties. For unit tests, you can also call ``SparkConf(false)`` to skip loading external settings and get the same configuration no matter what the system properties are. All setter methods in this class support chaining. For example, you can write ``conf.setMaster("local").setAppName("My app")``. Parameters ---------- loadDefaults : bool whether to load values from Java system properties (True by default) _jvm : class:`py4j.java_gateway.JVMView` internal parameter used to pass a handle to the Java VM; does not need to be set by users _jconf : class:`py4j.java_gateway.JavaObject` Optionally pass in an existing SparkConf handle to use its parameters Notes ----- Once a SparkConf object is passed to Spark, it is cloned and can no longer be modified by the user. Examples -------- >>> from pyspark.conf import SparkConf >>> from pyspark.context import SparkContext >>> conf = SparkConf() >>> conf.setMaster("local").setAppName("My app") <pyspark.conf.SparkConf object at ...> >>> conf.get("spark.master") 'local' >>> conf.get("spark.app.name") 'My app' >>> sc = SparkContext(conf=conf) >>> sc.master 'local' >>> sc.appName 'My app' >>> sc.sparkHome is None True >>> conf = SparkConf(loadDefaults=False) >>> conf.setSparkHome("/path") <pyspark.conf.SparkConf object at ...> >>> conf.get("spark.home") '/path' >>> conf.setExecutorEnv("VAR1", "value1") <pyspark.conf.SparkConf object at ...> >>> conf.setExecutorEnv(pairs = [("VAR3", "value3"), ("VAR4", "value4")]) <pyspark.conf.SparkConf object at ...> >>> conf.get("spark.executorEnv.VAR1") 'value1' >>> print(conf.toDebugString()) spark.executorEnv.VAR1=value1 spark.executorEnv.VAR3=value3 spark.executorEnv.VAR4=value4 spark.home=/path >>> for p in sorted(conf.getAll(), key=lambda p: p[0]): ... print(p) ('spark.executorEnv.VAR1', 'value1') ('spark.executorEnv.VAR3', 'value3') ('spark.executorEnv.VAR4', 'value4') ('spark.home', '/path') >>> conf._jconf.setExecutorEnv("VAR5", "value5") JavaObject id... >>> print(conf.toDebugString()) spark.executorEnv.VAR1=value1 spark.executorEnv.VAR3=value3 spark.executorEnv.VAR4=value4 spark.executorEnv.VAR5=value5 spark.home=/path """ def __init__(self, loadDefaults=True, _jvm=None, _jconf=None): """ Create a new Spark configuration. """ if _jconf: self._jconf = _jconf else: from pyspark.context import SparkContext _jvm = _jvm or SparkContext._jvm if _jvm is not None: # JVM is created, so create self._jconf directly through JVM self._jconf = _jvm.SparkConf(loadDefaults) self._conf = None else: # JVM is not created, so store data in self._conf first self._jconf = None self._conf = {} [docs] def set(self, key, value): """Set a configuration property.""" # Try to set self._jconf first if JVM is created, set self._conf if JVM is not created yet. if self._jconf is not None: self._jconf.set(key, str(value)) else: self._conf[key] = str(value) return self [docs] def setIfMissing(self, key, value): """Set a configuration property, if not already set.""" if self.get(key) is None: self.set(key, value) return self [docs] def setMaster(self, value): """Set master URL to connect to.""" self.set("spark.master", value) return self [docs] def setAppName(self, value): """Set application name.""" self.set("spark.app.name", value) return self [docs] def setSparkHome(self, value): """Set path where Spark is installed on worker nodes.""" self.set("spark.home", value) return self [docs] def setExecutorEnv(self, key=None, value=None, pairs=None): """Set an environment variable to be passed to executors.""" if (key is not None and pairs is not None) or (key is None and pairs is None): raise Exception("Either pass one key-value pair or a list of pairs") elif key is not None: self.set("spark.executorEnv." + key, value) elif pairs is not None: for (k, v) in pairs: self.set("spark.executorEnv." + k, v) return self [docs] def setAll(self, pairs): """ Set multiple parameters, passed as a list of key-value pairs. Parameters ---------- pairs : iterable of tuples list of key-value pairs to set """ for (k, v) in pairs: self.set(k, v) return self [docs] def get(self, key, defaultValue=None): """Get the configured value for some key, or return a default otherwise.""" if defaultValue is None: # Py4J doesn't call the right get() if we pass None if self._jconf is not None: if not self._jconf.contains(key): return None return self._jconf.get(key) else: if key not in self._conf: return None return self._conf[key] else: if self._jconf is not None: return self._jconf.get(key, defaultValue) else: return self._conf.get(key, defaultValue) [docs] def getAll(self): """Get all values as a list of key-value pairs.""" if self._jconf is not None: return [(elem._1(), elem._2()) for elem in self._jconf.getAll()] else: return self._conf.items() [docs] def contains(self, key): """Does this configuration contain a given key?""" if self._jconf is not None: return self._jconf.contains(key) else: return key in self._conf [docs] def toDebugString(self): """ Returns a printable version of the configuration, as a list of key=value pairs, one per line. """ if self._jconf is not None: return self._jconf.toDebugString() else: return '\n'.join('%s=%s' % (k, v) for k, v in self._conf.items()) def _test(): import doctest (failure_count, test_count) = doctest.testmod(optionflags=doctest.ELLIPSIS) if failure_count: sys.exit(-1) if __name__ == "__main__": _test()


questions
Tell us about yourself:
Name: (required)
Upload a photo link!
Question 1
Do you procrastinate a lot?
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 2
You always try to get tasks done on time or before a due date.
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 3
You are often lost in thought, sometimes oblivious of what is happening around you.
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 4
You would rather stay in for a night at home, instead of being out in a crowd
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 5
Do you think you have a creative imagination?
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 6
You are generally a tidy person.
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 7
You like to explore and try new things.
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 8
You find it difficult to get motivated.
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 9
If you could, you would delete all of your social media accounts.
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Question 10
You are ambitious, once you have a task completed you are on to the next.
1 (Strongly Disagree)
2
3
4
5 (Strongly Agree)
Submit
Check out our friends api
×
Top Match


{% load staticfiles%}
Senticle50 (Error #404)
Oops the page you requested could not be found.
Return Home


Enter your invite code to connect to a ScreenCat screen. To share your screen, download ScreenCat.app.


Troops rescue octogenarian, others from Boko Haram
Our Reporter
NIGERIAN Army troops deployed at Gwoza Local Government Area of Borno have subdued Boko Haram terrorists and rescued an octogenarian, three women and four children they held captive.
Army Operations Media Coordinator Col. Aminu Iliyasu disclosed this in a statement on Sunday in Abuja.
Iliyasu said the rescued victims were evacuated while the children were vaccinated against polio by a Nigerian Army medical team.
He added that no causality was recorded by the army troops during the commando operations.
According to him, many of the Boko Haram elements fled towards the summit of Mandara Mountains with gunshot wounds.
Read Also: ‘Boko Haram now restricted to three locations’
“The troops’ resilience and doggedness are unwavering as further exploitation to complete the annihilation of the insurgents is being sustained in the mountainous environment.
“The Chief of Army Staff (COAS), Lt.-Gen. Tukur Buratai wishes to reassure the public of the resolve of the Nigerian Army to continue to execute our constitutional mandate professionally and responsively for a better secured Nigeria.
“He also thanks all well-meaning Nigerians for their continued support, goodwill and understanding towards officers and men of the Nigerian Army as they sustain the conduct of various operations and routine exercises nationwide,” he said.
Iliyasu said that the army troops continued to sustain the tempo of the counter-insurgency operations in the Northeast with a view to decimating and destroying the remnant of Boko Haram/Islamic State West Africa (ISWAP) criminals.
He said the troops had also continued to extract credible intelligence on the presence of some of the insurgents in the areas.


What is this?
It's a visualization of US census data!
Why should I care?
It might be fun to play around with. Admittedly it will be more interesting if you live in the US. You could find out:
When you click on the characteristics in the form below, the visualization and statistical result will update automatically. The size of each circle is proportional to the size of one group. The data is from the 2017 census (2018 data out soon)
What was this inspired by?
This was inspired by an episode of NPR's Planet Money called "The Modal American". In fact it uses almost the same data and methodology as they describe in their write up
Show me the gory data details!
A writeup with all the gory details is coming. For now, here's a link if you'd like to get the data yourself
It's a visualization of US census data!
Why should I care?
It might be fun to play around with. Admittedly it will be more interesting if you live in the US. You could find out:
- How common you are. In other words, how many people share your characteristics
- How common you would be if you were slightly different
- How common various combinations of characteristics are
When you click on the characteristics in the form below, the visualization and statistical result will update automatically. The size of each circle is proportional to the size of one group. The data is from the 2017 census (2018 data out soon)
What was this inspired by?
This was inspired by an episode of NPR's Planet Money called "The Modal American". In fact it uses almost the same data and methodology as they describe in their write up
Show me the gory data details!
A writeup with all the gory details is coming. For now, here's a link if you'd like to get the data yourself
Age
Race
Sex
Marital Status
Education
Neighborhood Type
Total Income From All Sources During Last 12 Months
Employment During Last 12 Months


$545.00
GLOCK 20 Pistol
When looking for a pistol that is powerful, yet reliable as an atomic clock, there is only one sound choice. The GLOCK 20 chambered in 10mm. With a magazine capacity of 15 rounds, there are few pistols that are light, concealable and controllable that you can use to successfully protect yourself from about anything on land to include a polar bear.
Used by hunters, explorers and even elite military units operating in the Arctic, the GLOCK 20 has all the features you need to be successful stopping whatever you are aiming at. With the flexibility to mount your choice of a light or laser to the integrated rail the GLOCK 20 is capable of handling any environment, you can think of.


The credentials for the agent machine.
The user name length must be between 3 and 15 characters. Valid characters include '_','-' and all alphanumerical characters.
The password length must be between 8 and 123 characters. It also needs to have at least one digit, one lowercase and one uppercase letter.


Seoul Dust Dashboard (PM10)
{{areaObj.area}}
Show
List
Chart
Keep Monitoring
Total {{ totalDataCount }}


class: center, middle ### W4995 Applied Machine Learning # Model evaluation 02/25/19 Andreas C. Müller (Adapted and modified for CC 6021236 @ PCC/Ciencias/UCV by Eugenio Scalise, October 2019) ??? FIXME macro vs weighted average example FIXME balanced accuracy - explain both? FIXME roc auc not good for imbalanced!? show example!! FIXME remove regression, go into more depth on cost-sensitive? FIXME relate to calibration! FIXME How to pick thresholds in multi-class? FIXME Add log-loss to metrics, and show why I don’t like it (.4, .6, 0) is better than (.36, .34, .3) FIXME explain why ROC AUC doesn't depend on class imbalance by calculating example FIXME write down example on slide about recall being zero and AUC being 1? --- class: centre,middle # Metrics for Binary Classification ??? --- # Review : confusion matrix .center[ ![:scale 75%](images/confusion_matrix.png) ] ??? Diagonal divided by everything. --- # .smaller[ ```python from sklearn.datasets import load_breast_cancer from sklearn.linear_model import LogisticRegression data = load_breast_cancer() X_train, X_test, y_train, y_test = train_test_split( data.data, data.target, stratify=data.target, random_state=0) lr = LogisticRegression().fit(X_train, y_train) y_pred = lr.predict(X_test) from sklearn.metrics import confusion_matrix print(confusion_matrix(y_test, y_pred)) print(lr.score(X_test, y_test)) ``` ] ![:scale 20%](images/breast_cancer_cf_matrix.png) --- # Problems with Accuracy Data with 90% positives: .smaller[ ```python from sklearn.metrics import accuracy_score for y_pred in [y_pred_1, y_pred_2, y_pred_3]: print(accuracy_score(y_true, y_pred)) ``` ``` 0.9 0.9 0.9 ``` ] .center[ ![:scale 70%](images/problems_with_accuracy.png) ] ??? - Imbalanced classes lead to hard-to-interpret accuracy. --- class:split-40 # Precision, Recall, f-score .left-column[ `$$ \large\text{Precision} = \frac{\text{TP}}{\text{TP}+\text{FP}}$$`
`$$\large\text{Recall} = \frac{\text{TP}}{\text{TP}+\text{FN}}$$`
`$$\large\text{F} = 2 \frac{\text{precision} \cdot\text{recall}}{\text{precision}+\text{recall}}$$`] .right-column[
Positive Predicted Value (PPV),
[Precisión]
Sensitivity, coverage, true positive rate.
[Exhaustividad]
Harmonic mean of precision and recall (F1-score) ] ??? All depend on definition of positive and negative. --- class:spacious # Precision, Recall, FPR - Precision: what fraction of positive predictions are correct? - Recall (True Positive Rate, sensitivity, probability of detection): what fraction of all positive instances does the classifier correctly identify as positive? - False Positive Rate (Specificity): what fraction of all negative instances does the classifier incorrectly identify as positive. `$$ \large\text{FPR} = \frac{\text{FP}}{\text{TN}+\text{FP}}$$`
??? --- # Tradeoff between precision and recall - Recall-oriented machine learning tasks: * Search and information extraction in legal discovery * Tumor detection * Often paired with a human expert to filter out false positives - Precision-oriented machine learning tasks: * Sarch engine ranking, query suggestion * Document classification * Many customer-facing tasks (users remember failures!) ??? --- class: center, spacious # The Zoo ![:scale 100%](images/zoo.png) https://en.wikipedia.org/wiki/Precision_and_recall ??? --- class:split-40 .left-column[ ![:scale 50%](images/confusion_matrix_col.png)] .right-column[
![:scale 100%](images/classification_report_1.png)
![:scale 100%](images/classification_report_2.png)
![:scale 100%](images/classification_report_3.png) ] ??? --- class:spacious # Goal setting! - What do I want? What do I care about? - Can I assign costs to the confusion matrix? (i.e. a false positive costs me 10 dollars; a false negative, 100 dollars) - What guarantees do we want to give? ??? (precision, recall, or something else) (i.e. a false positive costs me 10 dollars; a false negative, 100 dollars) --- # Changing Thresholds .tiny-code[ ```python data = load_breast_cancer() X_train, X_test, y_train, y_test = train_test_split( data.data, data.target, stratify=data.target, random_state=0) lr = LogisticRegression().fit(X_train, y_train) y_pred = lr.predict(X_test) print(classification_report(y_test, y_pred)) ``` ``` precision recall f1-score support 0 0.91 0.92 0.92 53 1 0.96 0.94 0.95 90 avg/total 0.94 0.94 0.94 143 ``` ```python y_pred = lr.predict_proba(X_test)[:, 1] > .85 print(classification_report(y_test, y_pred)) ``` ``` precision recall f1-score support 0 0.84 1.00 0.91 53 1 1.00 0.89 0.94 90 avg/total 0.94 0.93 0.93 143 ``` ] ??? --- # Precision-Recall curve ```python X, y = make_blobs(n_samples=(2500, 500), cluster_std=[7.0, 2], random_state=22) X_train, X_test, y_train, y_test = train_test_split(X, y) svc = SVC(gamma=.05).fit(X_train, y_train) precision, recall, thresholds = precision_recall_curve( y_test, svc.decision_function(X_test)) ``` ??? --- # Precision-Recall curve .center[ ![:scale 75%](images/precision_recall_curve.png) ] ??? --- # F1 vs average Precision .smaller[ ```python from sklearn.metrics import f1_score print("f1_score of random forest: {:.3f}".format( f1_score(y_test, rf.predict(X_test)))) print("f1_score of svc: {:.3f}".format(f1_score(y_test, svc.predict(X_test)))) ``` ``` f1_score of random forest: 0.709 f1_score of svc: 0.715 ``` ```python from sklearn.metrics import average_precision_score ap_rf = average_precision_score(y_test, rf.predict_proba(X_test)[:, 1]) ap_svc = average_precision_score(y_test, svc.decision_function(X_test)) print("Average precision of random forest: {:.3f}".format(ap_rf)) print("Average precision of svc: {:.3f}".format(ap_svc)) ``` ``` Average precision of random forest: 0.682 Average precision of svc: 0.693 ``` ] ??? Previously, I just have sort of a simple comparison between f1 and average precision. I'm comparing these two models. So if I look at f1 score, it's going to compare basically these two points and the SVC is slightly is better. But F1 score only looks at the default threshold. If I want to look at the whole RC curve, I can use average precision. Even if I look at all possible thresholds, SVC is still better. Average precision is sort of a very sensitive metric that allows you to basically make good decisions even if the classes are very imbalanced and that also takes all possible thresholds into account. One thing that you should keep in mind if you use this is that this does not give you a particular threshold. For example, if you use the default threshold, your accuracy might be zero. This only looks at ranking. The curve and the area under the curve, don't depend on where the default threshold is. So if you predict everything, like for some weird reason, if you predict everything as the minority class, your accuracy will be really bad. But if they are ranked in the right order, so that all the positive classes are ranked higher than the negative classes, then you might still get an area under the curve that's very close to one. So this only looks at ranking. AP only considers ranking! --- # ROC Curve .center[ ![:scale 100%](images/zoo.png) ] `$$ \text{FPR} = \frac{\text{FP}}{\text{FP}+\text{TN}}$$` `$$ \text{TPR} = \frac{\text{TP}}{\text{TP}+\text{FN}} = \text{recall}$$` ??? Another very commonly used measure is the ROC curve. It's similar to the precision-recall curve. But now you're looking the false positive rate and the true positive rate. True positive rate is just another name for recall, which is true positives divided by true positives plus false positives. So of ones that are actually true, how many did I get? False positive rate is false positives divided by false positives plus true negatives. So of everything that's predicted as negative, how many of those were wrongly predicted as negative. --- .center[ ![:scale 75%](images/roc_curve.png) ] ??? You can look at this for all possible thresholds. Again, you get a curve. Here is the curve for support vector machine and random forest again. With the same classifier. And again, the thresholds look pretty arbitrary. It might be a little bit hard to say which one is better? For the precision-recall curve, the optimum was in the top right, you want to be in as top right as possible. So you want to have a recall of one and the precision of one. For the ROC curve, the ideal point is the top left. You want a false positive rate of zero and a true positive rate of one. One thing that's kind of nice for the ROC curve is that no matter what the class imbalances are, the random classifier or classifier that predicts everything as the same class will be diagonal. --- # ROC AUC - Area under ROC Curve - Always .5 for random/constant prediction .tiny-code[ ```python from sklearn.metrics import roc_auc_score rf_auc = roc_auc_score(y_test, rf.predict_proba(X_test)[:,1]) svc_auc = roc_auc_score(y_test, svc.decision_function(X_test)) print("AUC for random forest: {:, .3f}".format(rf_auc)) print("AUC for SVC: {:, .3f}".format(svc_auc)) ``` ``` AUC for random forest: 0.937 AUC for SVC: 0.916 ``` ] The Relationship Between Precision-Recall and ROC Curves
https://www.biostat.wisc.edu/~page/rocpr.pdf ??? And so when you look at the area under the curve, which is called ROC AUC, it's always 0.5 for random or constant predictions. So it's very easy to say, how much better than random are you if you look at ROC AUC. I encourage you to read the paper in the link. One thing is that the ROC curve is usually much smoother and it makes more sense to interpolate it, where the precision-recall curve makes less sense to interpolate us. But the precision-recall curve can sometimes pick up on more fine-grained differences. Even though AUC stands for area under the curve, if you see it in literature always means the area under the receiver operating curve. So AUC always means ROC AUC. AUC is a ranking metric. So it takes all possible thresholds into account, which means that it's independent of the default thresholds. So again, you can have something with very low accuracy but still with perfect ROC AUC. --- # Summary of metrics for binary classification Threshold-based: - accuracy - precision, recall, f1 Ranking: - average precision - ROC AUC ??? So let's briefly summarize the metrics for binary classification. So there are basically two approaches. One looks just at the predictions or look at soft predictions and take multiple thresholds into account. So the ones that I called threshold base, which is for single threshold, the ones that we talked about in our accuracy, which is just a fraction of correctly predicted, precision, recall, and f1. So the issue with accuracy is obviously that it can't distinguish between things that are quite different, for example, for imbalanced data sets, the classifier always predicts majority class often has like very high accuracy but tells you nothing. So in particular, for imbalanced classes, accuracy is a pretty bad measure. Precision and recall together are pretty good measures, though you always need to look at both numbers. One way to look at both numbers at once is the f1 score, though, using the harmonic mean is a little bit arbitrary. But still, only f1 score is a somewhat reasonable score if you only look at the actual predicted classes. For the ranking based losses, I think both average precision and ROC AUC are pretty good choices, ROC AUC, I like it because I know what 0.5 means, while for average precision, it's a little bit more tricky to see what the different orders of magnitude mean, or the different scales mean, but it can be more fine-grained measure. And so if you want to do cross-validation, my go-to is usually ROC AUC. In particular, for imbalance binary datasets, I would usually use ROC AUC. But then make sure that your threshold is sensible, but anything other than accuracy is okay. Just don’t look at only precision or only recall, if you do a grid search for just precision, you will probably get garbage results. add log loss? --- class: centre,middle # Multi-class classification ??? The next thing I want to talk about is multiclass classification. --- class:split-40 #Confusion Matrix .left-column[ .tiny-code[ ```python from sklearn.datasets import load_digits from sklearn.metrics import accuracy_score digits = load_digits() # data is between 0 and 16 X_train, X_test, y_train, y_test = train_test_split( digits.data / 16., digits.target, random_state=0) lr = LogisticRegression().fit(X_train, y_train) pred = lr.predict(X_test) print("Accuracy: {:.3f}".format(accuracy_score(y_test, pred))) print("Confusion matrix:") print(confusion_matrix(y_test, pred)) ``` ``` Accuracy: 0.964 Confusion matrix: [[37 0 0 0 0 0 0 0 0 0] [ 0 41 0 0 0 0 1 0 1 0] [ 0 0 44 0 0 0 0 0 0 0] [ 0 0 0 43 0 0 0 0 1 1] [ 0 0 0 0 37 0 0 1 0 0] [ 0 0 0 0 0 47 0 0 0 1] [ 0 1 0 0 0 0 51 0 0 0] [ 0 0 0 0 1 0 0 47 0 0] [ 0 3 1 0 0 1 0 0 43 0] [ 0 0 0 0 0 2 0 0 1 44]] ``` ] ] .right-column[ .tiny-code[ ```python print(classification_report(y_test, pred)) ``` ``` precision recall f1-score support 0 1.00 1.00 1.00 37 1 0.91 0.95 0.93 43 2 0.98 1.00 0.99 44 3 1.00 0.96 0.98 45 4 0.97 0.97 0.97 38 5 0.94 0.98 0.96 48 6 0.98 0.98 0.98 52 7 0.98 0.98 0.98 48 8 0.93 0.90 0.91 48 9 0.96 0.94 0.95 47 avg / total 0.96 0.96 0.96 450 ``` ] ]
Note: read about "micro" and "macro" average. ??? So again, for multiclass classification, you look at the confusion matrix. It's even more telling in a way than it was for binary classification but it's also pretty big. So here, I'm using the digital data set, which has 10 classes, and here's the confusion matrix. The diagonal is everything that's correct, the off-diagonal are mistakes. And you can see very fine-grained which classes were mistaken for which other classes. So this is very nice if you want to look in a very detailed view of the performance of the classifier. But again, you can't really use it for model selection, or not easily. You can also again, look at the classification report, which will give you precision-recall and F score for each for the classes, again, very, very fine grained. So you can see, for example, that Class 0, was predicted while Class 8 is the hardest. It might make more sense to look at in precision average classes, recall over the classes or f1 score for the classes. --- class: middle # Using metrics ??? In summary, for both multiclass and binary, you should really think about what your metrics are. And unless your problem is balanced, and even maybe then don't use accuracy. Accuracy is really bad. Problems are rarely balanced, in a real world and usually there heavily unbalanced unless someone artificially balances them. So it's really important to think about what is the right criterion for a particular task, and then you can optimize that criterion. So as I said, that can be like having costs associated with the confusion matrix, emphasizing precision or recall, setting specific goals such as have recall of at least X percent, or have precision of at least X percent and for multi-class deciding whether are all the classes the same importance, or all the samples the same importance, what are the important classes, even for binary, which one is the positive class? So whenever you talk about precision and recall, it’s important to think about which one is the positive class and how will changing the positive class change these two values? So and then finally, obviously, am I going to use the default threshold? Why am I going to use the default threshold? Do I use a ranking based metric? Or is there a reason why I would want to use a ranking based metric? - Accuracy rarely what you want - Problems are rarely balanced - Find the right criterion for the task - OR pick one arbitrarily, but at least think about it - Emphasis on recall or precision? - Which classes are the important ones? --- # Using metrics in cross-validation .smaller[ ```python X, y = make_blobs(n_samples=(2500, 500), cluster_std=[7.0, 2], random_state=22) # default scoring for classification is accuracy scores_default = cross_val_score(SVC(), X, y) # providing scoring="accuracy" doesn't change the results explicit_accuracy = cross_val_score(SVC(), X, y, scoring="accuracy") # using ROC AUC roc_auc = cross_val_score(SVC(), X, y, scoring="roc_auc") print("Default scoring:", scores_default) print("Explicit accuracy scoring:", explicit_accuracy) print("AUC scoring:", roc_auc) ``` ``` Default scoring: [ 0.92 0.904 0.913] Explicit accuracy scoring: [ 0.92 0.904 0.913] AUC scoring: [ 0.93 0.885 0.923] ``` ] ??? So once you pick them, it's very easy to use any of these metrics in scikit-learn. So they're all functions inside the metrics module, but usually, you're going to want to use them in for cross-validation, or grid search. And then it's even easier. There's argument called scoring. It takes a string or a callable. And so here, if you give it a string, it'll just do the right thing automatically. By default its accuracy. So if you don't do anything, it's the same as if you provide accuracy. But you can also set ROC AUC, and it's going to use ROC AUC. So the thing is ROC AUC actually needs probabilities right or a decision function, so behind the scenes, it does the right thing and gets out the decision function for the positive class to compute the ROC AUC correctly. Using better a metric than accuracy is as simple as saying scoring equal to something. And it’s exactly the same as in grid search CV. So if you want to do a grid search CV or randomized search CV, you can set scoring equal to ROC AUC or average precision or recall macro. Same for GridSearchCV
Will make GridSearchCV.score use your metric! --- # Built-in scoring ```python from sklearn.metrics.scorer import SCORERS print("\n".join(sorted(SCORERS.keys()))) ``` .smaller[ ``` print("\n".join(sorted(SCORERS.keys()))) accuracy adjusted_mutual_info_score adjusted_rand_score average_precision balanced_accuracy brier_score_loss completeness_score explained_variance f1 f1_macro f1_micro f1_samples f1_weighted fowlkes_mallows_score homogeneity_score max_error mutual_info_score neg_log_loss neg_mean_absolute_error neg_mean_squared_error neg_mean_squared_log_error neg_median_absolute_error normalized_mutual_info_score precision precision_macro precision_micro precision_samples precision_weighted r2 recall recall_macro recall_micro recall_samples recall_weighted roc_auc v_measure_score ``` ] ??? Here's a list of all the built-in scores, you can look at the documentation, there's really a lot of them. So these are for classification or regression or clustering. If you look in the documentation, you'll actually see which ones are for classification, which one is binary only, which ones are multiclass, which ones are regression and which ones are for clustering. The thing in scikit-learn, whatever you use for scoring greater needs to be better the way it's written. So you can’t use mean_squared_error for doing a grid search, because the grid search assumes greater is better so you have to use negative mean squared error. So for regression or log loss, you use mean squared error. For classification, you need to use the neg log loss one. --- class: center, middle # Questions ?


Broadband workshops planned for New Mexico
ALBUQUERQUE, N.M. (AP) - Broadband workshops are planned in New Mexico as the rural state looks to boost high-speed online access.
The U.S. Agriculture Department’s rural development division is working with the state and the National Telecommunications and Information Administration to host meetings this week in Truth or Consequences and Albuquerque.
Census figures show almost 30% of New Mexico residents have no internet subscription of any type while 55% of residents have a subscription such as fiber, cable or DSL at home.
Officials say that means nearly half the homes in New Mexico don’t currently benefit from a high-speed broadband connection.
A recent report by legislative analysts found that state and federal investments totaling over $300 million have succeeded in connecting schools, hospitals and other institutions, but many rural areas remain unserved.
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


XPRIZE CMU
Addition
Subtraction
Other XPRIZE game
New Subtraction
Change Theme
-
0
1
2
3
4
5
6
7
8
9
Start Game


One of the only two sixteenth-century Islamic monuments which managed to survive the excesses of the Inquisition, the Safa Masjid lies 2 km west of the centre of the town of Ponda, in a district known as Shahpur. The elegant structure was built in 1560 by Ibrahim Adil Shah, the Sultan of Bijapur.
alt
The mosque was the focus of attention in a fairly extensive complex of gardens and fountains which lies in ruins today. The rectangular prayer hall of the mosque rests above a high base and is capped with a pointed terracota tile roof.
There are elegant Islamic arches decorating the walls. Remnants of octagonal pillars can be seen all around the mosque, perhaps these supported a covered courtyard to provide shade to worshippers.
There is a is well-constructed water tank with small chambers with 'meharab' designs nearby which is located to the south of the prayer hall unlike most mosques where it is located outside the main entrance.
This has led to speculation that the tank may have been part of another religious structure which once stood there. Local legend also has it that there are hidden tunnels in the walls of the tank which connect it to a nearby water reservoir.
This mosque is a venue of celebration during festivals of Id-Ul-Fitr and Id-Ul-Zuha, by the local Muslim community. There are rickshaws available at the main Ponda bus stand which can take you to the site of the Safa Masjid.
Namazgah
This mosque is located in the Ponda area through the attractive countryside a further 2 or 3 km from the Safa Masjid.


17
1 The whole community of the Israelites journeyed from the wilderness of Sin, following Yahweh's instructions. They camped at Rephidim, but there was no water for the people to drink.
2 So the people blamed Moses for their situation and said, "Give us water to drink."  Why do you test Yahweh?"
3 The people were very thirsty, and they complained against Moses. They said, "Why have you brought us up out of Egypt? To kill us and our children and our cattle with thirst?"
4 Then Moses cried out to Yahweh, "What should I do with this people? They are almost ready to stone me."
5 Yahweh said to Moses, "Go on ahead of the people, and take with you some elders of Israel. Take with you the staff with which you struck the river, and go.
6 I will stand before you there on the rock at Horeb, and you will strike the rock. Water will come out of it for the people to drink." Then Moses did so in the sight of the elders of Israel.
7 He called that place Massah and Meribah because of the Israelites' complaining, and because they had tested the Lord by saying, "Is Yahweh among us or not?"
8 Then an army of the Amalek people came and attacked Israel at Rephidim.
9 So Moses said to Joshua, "Choose some men and go out. Fight with Amalek. Tomorrow I will stand on top of the hill with the staff of God in my hand."
10 So Joshua fought Amalek as Moses had instructed, while Moses, Aaron, and Hur went up to the top of the hill.
11 While Moses was holding his hands up, Israel was winning; when he let his hands rest, Amalek would begin to win.
12 When Moses' hands became heavy, Aaron and Hur took a stone and put it under him for him to sit on. At the same time, Aaron and Hur held his hands up, one person on one side of him, and the other person on the other side. So Moses' hands were held steady until the sun went down.
13 So Joshua defeated the people of Amalek with the sword.
14 Yahweh said to Moses, "Write this in a book and read it in Joshua's hearing, because I will completely blot out the memory of Amalek from under the skies."
15 Then Moses built an altar and called it "Yahweh is my banner."
16 He did this, because he said, "Yahweh has sworn that he will have war with Amalek from generation to generation."


My Favorite Things
These are a few of my favorite things.
People
These are a few of my favorite people:
- My husband Jesse
- My sister Jessica
- My best friend Deserae
- I don't like many people really.
Favorite Foods
These are my favorite foods, in order:
- Burgers
- Pizza
- Sushi
- Pho
- Gyros
Thanks for reading about me!


Make a hole in the targeted formation
Activate Geo-Ohm's(the sensor).
get data analyze,and send to earth
Developer
the Leader group
graphic design
Developer
researcher
mechanical engineer
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut eaque, laboriosam veritatis, quos non quis ad perspiciatis, totam corporis ea, alias ut unde.


jQuery makes it very easy to create new page content and change existing page content.
Content Creation
Creating new content is as simple as passing a string of HTML to the $() function.
For example, $("
")
creates a new, empty paragraph tag. To add new content to the paragraph,
you could simply write $("
").append("Hello there")
.
Changing Content
There are multiple ways to change page content using jQuery, depending on your needs.
The html()
and text()
functions can be used to directly manipulate the contents of elements,
and there are ways to control how content can be inserted and moved around in the page.


This is supposed to be a very long server name [Cockpit hosting]
2000ms
04rel004
100/100
Longname v1.0.0


WITNESS LIST Windham School District, Select Committee August 29, 2000-9:30A Budget On: Faulkner, Charles E. (Windham School District) Morrow, Mike (Windham School District) Education and Recidivism On: Fabelo, Dr. Tony (Texas Criminal Justice Policy Council)


• Do you have an email? If not you need to create one.
• Set up a password.
• Tell us about yourself.
• Give us every little detail, birth, age, and life story.
• If you can talk to them, ask them questions and get photos and documents.
• When adding your deceased relatives its important to check your facts
• Find out what you can from your living relatives.
• https://www.findagrave.com/
• Ancestry Census Records
• genealogy.com
• https://relativefinder.org/
• 23andme.com
• ancestry.com


Turn down the lights, curl up by the fire, and enjoy these classic tales of frightful creatures... if you dare!
Books
Beowulf, the epic tale of adventure that follows Beowulf as he battles Grendel, Grendel's Mother, and later becomes king. Beowulf was originally written in Old English by an unknown Anglo-Saxon poet sometime between the 8th and 11th centuries. It is one of the most important works of Anglo-Saxon literature. This translation, by Professor Francis Gummere, was first published in 1910.
Frankenstein; or, The Modern Prometheus was first published in London, England in 1818. It contains elements of the Gothic novel and the Romantic movement. It was also a warning against the “over-reaching” of modern man and the Industrial Revolution. The story has had an influence across literature and popular culture and spawned a complete genre of horror stories and films. It is often considered the first science fiction novel.
The Vampyre is a short novel written by John William Polidori and is a progenitor of the romantic vampire genre of fantasy fiction.
The Vampyre was first published on April 1, 1819, by Colburn in the New Monthly Magazine with the false attribution “A Tale by Lord Byron.” The name of the work’s protagonist, “Lord Ruthven”, added to this assumption, for that name was originally used in Lady Caroline Lamb’s novel Glenarvon, in which a thinly-disguised Byron figure was also named Lord Ruthven. Despite repeated denials by Byron and Polidori, the authorship often went unclarified.
The novel was an immediate popular success, partly because of the Byron attribution and partly because it exploited the gothic horror predilections of the public. Polidori transformed the vampire from a character in folklore into the form we recognize today—an aristocratic fiend who preys among high society.
The Strange Case of Dr. Jekyll and Mr. Hyde is a suspense novel by Robert Louis Stevenson, narrating the tale of Dr. Jekyll, and his menacing alter ego Mr. Hyde.
Dracula is a horror novel by Bram Stoker, narrated in first person diary entries and letters, telling the story of an encounter with Count Dracula.
The War of the Worlds, by H. G. Wells, is an early science fiction novel which describes an invasion of England by aliens from Mars. It is one of the best-known depictions of an alien invasion of Earth.


class Solution: def closestCost(self, baseCosts: List[int], toppingCosts: List[int], target: int) -> int: t = [0] for i in toppingCosts: t = t + [j + i for j in t] + [j + i * 2 for j in t] # print(t) dif = float('inf') res = 0 for b in baseCosts: for c in t: tt = b + c # print(b, c, tt) if abs(target - tt) < dif or (abs(target - tt) == dif and tt < res): dif = abs(target - tt) res = tt return res


FOR LOVE OF THE GAME A film review by Christopher Null Copyright 1999 Christopher Null filmcritic.com
My brother says I shouldn't review sports movies. Because I'm not a sports fan, he says, I can't be objective.
He may have a point, but I don't think FOR LOVE OF THE GAME is fundamentally a sports movie. Sure, suit Kevin Costner up in a baseball uniform and you might think you're looking at another FIELD OF DREAMS, but FOR LOVE OF THE GAME is something we don't see a lot of. Allow me to explain.
On the last day of a losing baseball season, veteran Detroit Tigers pitcher Billy Chapel (Costner) gets the news that he's going to be traded *and* that his girlfriend is ditching him to move to London. The information devastates Chapel, so he decides to take it out on the baseball diamond, steeling himself up for the game of his life.
Before you know it, we're watching Chapel edge closer and closer to the near-impossible perfect game: 9 innings, 27 batters, no hits, no walks, no men on base. And while Chapel struggles inning after inning – against the Yankees, against the coach, against his aching body and mind – he relives the last five years of his life through flashback.
The flashbacks include the meeting of his on-again off-again girlfriend Jane (Preston), befriending her daughter (Malone), his ups and downs with his old buddy and standby catcher Gus (Reilly), getting injured, getting better, and basically living the life of an aging ballplayer.
Back at game time, Chapel realizes he's made some mistakes, and this final match becomes a shot at redemption. Everyone watching the game somehow seems to realize this, and through those nine innings, all lives are invariably altered.
If it sounds like a powerful film, that's because it is. Director Raimi is a master at pulling strings, and no expense has been spared at coaxing the tears out of you. All the players are perfectly suited for their roles, with special marks for Reilly and Costner, who gives his best performance since JFK in 1991.
But it isn't too far into FOR LOVE OF THE GAME that you start to realize a couple of things. First, that the baseball game is far more dramatic and interesting than the flashbacks. (The film is obviously adapted from a novel, and sometimes it feels like the flashback pages are being shot verbatim.) Second, that the whole thing is a ploy to manipulate you into getting over-emotional. There are points when you want to spit, the movie is so saccharine.
But this GAME is just so compelling, it's hard not to put those flaws aside and just let yourself be washed over by this movie. I may be a victim of Hollywood mind games, but at least I enjoyed myself.
RATING: ****
|------------------------------| \ ***** Perfection \ \ **** Good, memorable film \ \ *** Average, hits and misses \ \ ** Sub-par on many levels \ \ * Unquestionably awful \ |------------------------------|
MPAA Rating: PG-13
Director: Sam Raimi Producer: Armyan Bernstein, Amy Robinson Writer: Dana Stevens Starring: Kevin Costner, Kelly Preston, John C. Reilly, Jena Malone, Brian Cox, J.K. Simmons
http://www.universalpictures.com/forloveofthegame/
Christopher Null -<EMAIL_ADDRESS>- http://www.filmcritic.com Author - Network Administrator's Reference, 1999, ISBN 0-07-882588-1 http://www.amazon.com/exec/obidos/ASIN/0078825881/filmcriticcom
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


Marvel Powers United VR 2016-2018 Sanzaru Games
A cooperative online VR game where players embody classic Marvel heroes and fight against waves of enemies and supervillains.
Implemented player inverse kinematics system and body size compensation. The system computes a full body pose based on the positions and orientations of the head and hands. Added features to blend IK smoothly with partial- and full-body animations, allowing for special moves with dramatic animations, and added secondary motion for remote players. Working with technical artists, I set up the character models to flex and rotate their joints in a natural looking manner using programmatic constraints, and set up finger animations based on touch sensors and reaching for the disc. I implemented network serialization and interpolation to allow for low update rates to the server.
Developed resolution independent 3D UI with refinements to work with dynamic temporal supersampling. Modified separate translucency renderer to allow UMG widgets and other 3D tranclucent UI effects to render at full native resolution while the base rendering pass changes dynamically to maintain framerate, and fixed several parts of the rendering pipeline to work with temporal upscaling for higher image quality at lower resolutions.
I integrated and maintained third party tools including Simplygon and FMOD, fixing workflow issues within the engine and adding additional artist/designer utility functions. I established presets and standard practices for applying LOD to environments and characters, and created several prototype tools for combining geometry and materials to make the most efficient use of our assets and environments.
Created character material pipeline and shaders for previewing different lighting models in Substance Painter. Made modifications to the engine to automate texture importing based on a naming convention. I created a template for player character rendering, including draw call merging in third person and foot ambient occlusion. Created a system for automating dynamic material swapping for enemy meshes, allowing expensive shader effects to be efficiently enabled and disabled without excessive blueprint setup.
During a large portion of production, I was mainly focused on a different unannounced project, but came in toward the end to work on optimization, lighting, and to implement scalability settings. I assisted artists with physically based lighting rigs using realtime lighting with baked environment shadows, fixing inconsistencies with light sources and improving accuracy of light probes. I helped with the profiling and optimization of VFX and materials, minimizing shader complexity and overdraw.
.


US govt posts $134-billion budget deficit in October: Treasury dept
Fiscal year 2019 saw a widening in the deficit to $984 billion, the largest budget deficit in seven years
by ReutersThe US government recorded a $134 billion budget deficit in October, the first month of the new fiscal year, the Treasury Department said on Wednesday.
That compared to a budget deficit of $100 billion in the same month last year, according to the Treasury's monthly budget statement.
Analysts polled by Reuters had forecast a $133 billion deficit for the month.
Unadjusted receipts last month totalled $246 billion, down 3% from October 2018, while unadjusted outlays were $380 billion, a rise of 8% from the same month a year earlier.
The U.S. government's fiscal year ends in September each year. Fiscal year 2019 saw a widening in the deficit to $984 billion, the largest budget deficit in seven years, a result of the Trump administration's decision to cut taxes and increase government spending.
Those figures reflected the second full budget year under U.S. President Donald Trump, a Republican, and a time when the country had an expanding tax base with moderate economic growth and an unemployment rate near a 50-year low.
When adjusted for calendar effects, the deficit for October remained at $134 billion compared with an adjusted deficit of $113 billion in October 2018.