FEATURED STORIES
Many British Jews Are Uneasy About Labour's Jeremy Corbyn Winning Power
The U.K. will hold an election in December and the new prime minister could be a man who's struggled to quell anti-Semitism in his party.
Apple Card Gender Bias? Don't Assume So, Experts Warn
The controversy started over the weekend when it was revealed the wives of two tech titans had a much smaller credit limits on their Apple Cards than their husbands.
Delhi's Air Pollution Shot Up to Levels 'Rarely Seen Before' in November
Schools had to be closed and flights canceled, while residents were told to avoid outdoor physical activities and advised to wear anti-pollution masks last week. Some ministers proffered their own solutions, from eating more carrots to listening to music.
Best STEM High Schools 2020
Newsweek partnered with STEM.org to rank America's Best STEM High Schools. We found successful schools in every region of the country.
Mauritius: The perfect gateway to Africa
The World Bank’s easiest place to do business in Africa in 2020 is an idyllic island nation in the Indian Ocean that continues to cement its position as a dynamic trade and investment hub. Read more.
EQUIS Accredited Business Schools 2019
It is important to check whether a school is accredited by a credible global accreditation body and meets internationally agreed quality standards.
Why Haven’t You Thought About Coding?
The industry demand for coders is skyrocketing. It is increasingly recognized as a rewarding, future-proof and flexible vocation and it’s easier to jump on the train than you might think. Find out more...
Which Global Universities are Leading the Way in 2019?
The world is shrinking and the concept of a "global marketplace" has never been more appreciable. Which universities are best preparing tomorrow’s international thought leaders?
Top Story
Will Donald Trump Be Able to End DACA? Decision Heads to Supreme Court
The Supreme Court will be considering on Tuesday whether the Trump administration had the legal right to end the Deferred Action for Childhood Arrivals program.
CULTURE & TRAVEL
30 Years After the Fall of the Berlin Wall, Explore the Relics
November 9, 2019 marks the 30th anniversary of the fall of the Berlin Wall. Celebrate the triumph of freedom with these memorials dedicated to the history of the Cold War.
The Literary Influences of Superstar Musician David Bowie
Bowie was more than a multi-platinum rock and roller. He was also one of the more literate composers in the business.
9 Larger-Than-Life Sculpture Parks Around the World
Across the globe, sculpture parks present imposing works (and even ideas) that are too large to be contained within four walls.
Saba: The Greatest Little Island You Never Heard Of
Islanders call Saba "The Unspoiled Queen of the Caribbean" for its pristine landscapes and striking biodiversity as well as the absence of crowds, chain stores, and cruise ship throngs.
MORE STORIES
Supreme Court Justices Couldn't Stop Interrupting During DACA Arguments
The first interruptions came just minutes into the start of proceedings regarding the immigration policy.
Trump and Erdogan Prepare to Meet as Fighting in Syria Flouts Cease-Fire
Erdogan complained Tuesday that neither the U.S. nor Russia has been able to "clean" the Kudish-led forces out of Turkey's invasion zone.
Hillary Clinton Says She Is Under Pressure to Run in 2020
She told British station BBC Radio 5 Live she thinks about what kind of president she would have been.
Trump's Foreign Policy Is 'the Greatest Thing' for Putin, Intel Expert Says
Former U.S. Navy intelligence and counter-terrorism specialist Malcolm Nance suggested, "Putin leads Donald Trump around on a leash."
Mayor Blames Climate Change for Venice's Worst Flood in More Than 50 Years
"The situation is dramatic. We ask the government to help us. The cost will be high," Venice Mayor Luigi Brugnaro said.
New Witnesses Emerge With Evidence Supporting Rodney Reed on Death Row
Reed is due to be executed on November 20, having spent more than 20 years on death row.
Scientists See Tobacco Industry Playbook in EPA Overhaul Plan
This concept of targeting the transparency of the scientific process "first appeared in tobacco industry documents in the 90s," Gretchen Goldman told Newsweek. "It was never about transparency."
Kentucky's Youngest Black Lawmaker Explores Run Against Mitch McConnell
Representative Charles Booker announced he's forming an exploratory committee to look into unseating Senate Majority Leader Mitch McConnell.
U.S. Asking Turkey to 'Chase Down' Those Behind Syria Human Rights Crimes
"We don't know these people particularly well," a senior State Department official said of Syrian rebel groups accused of atrocities.
Lindsey Graham Is Refusing to Watch 'Un-American' Impeachment Hearings
The Republican senator has told Fox News that GOP members should make their opposition heard to the proceedings, which he says are a "threat to the presidency."
OPINION
Let's Take Bloomberg 2020 for What It Is: A Vote of Confidence in Warren
By Jared Yates Sexton
Please, No Shallow 'Thank You for Your Service'
By Mansoor Shams
This Veterans Day, Let's Learn From Those Who Served
By David Shulkin
Under Real Capitalism, Billionaires Shouldn't Exist
By Robert Reich
LATEST NEWS
Leaders of Qatar
Qatar is one of the fast-growing regional economies and among the most promising in the MENA region, maintaining balanced growth rates despite various global challenges.
What Can a Degree in Public Health Do For You?
The field of public health is a powerful draw for those who feel inspired to make a positive difference in their communities. Find out more.
Mister Rogers Special Edition
Commemorate the compassionate legacy of one of the most beloved children’s programming hosts with Newsweek Special Edition. Featuring photos and articles from his life and a first look at the new film starring Tom Hanks.
Wizard of Oz Special Edition
Celebrate the 80th anniversary of one of the most iconic American films with Newsweek’s Special Edition. Featuring an introduction from the president of the International Wizard of Oz Club and an inside look at the new Judy Garland biopic.


HERTFORD REGIONAL COLLEGE
Whether you are looking to Hertford Regional College as a step forward towards a successful career, retraining, progression to university or to pursue an area of interest, HRC has something for you. We offer a wide range of full and part-time courses, Apprenticeships and professional and leisure courses.
Business and Professional Administration
- Level:
- 4 (equivalent to certificate of higher education)
Apprenticeship training information
Apprenticeship Framework
You achieve apprenticeship status by successfully completing the full framework. This is made up of components, all of which you must pass to achieve the qualification.
How does it all work?
You find an employer yourself or with the assistance of experienced HRC staff. We select the best apprenticeship for you and your employer.
How are you assessed?
An assessor will regularly visit you in the workplace and assess your progress. Your employer is fully involved in this process.
Content maintained by HERTFORD REGIONAL COLLEGE .


Choose where you log in
Log In
Cancel
Login with custom provider ...
Login with Solid Community
Login with Solid Test Space
Login with OpenLink WebID-OIDC
Login with OpenLink Solid Server ver:5.x
Login with OpenLink Data Spaces (QA server)
Login with Localhost:8443
Logged In as:
Logout


Easiest way to mining your bitcoin
Autocryp is the place to buy and sell Bitcoin, Ethereum and various kinds of Digital Assets in Indonesia. Then, book your weekly, bi-weekly or one-off clean online with imminent confirmation.
Autocryp is the place to buy and sell Bitcoin, Ethereum and various kinds of Digital Assets in Indonesia. Then, book your weekly, bi-weekly or one-off clean online with imminent confirmation.
Your account is protected by Multifactor Authentication using a combination of email, SMS and Google Authenticator.
You only need 1 account to do all Bitcoin transactions whether it is buying, selling, investing or trading.
The Rupiah deposit can be processed instantly and Rupiah withdrawal is processed in less than 1 business day.


Axis Labels:
Freeze Labels:
Textures:
Reflection:
Queued Moves:
Undo Moves:
Redo Moves:
History:
Undo
Redo
Saved States:
Save
Restore
Help
Sequence:
Execute


Lookup Doctors
Choose method to search for doctors
By Condition
By Doctor Name
Search By Condition
Submit
Home
Search By Name
Submit
Home


---
title: About Me
permalink: /about/
cover: "/assets/images/about-me.jpg"
cover_source: "http://www.newbeeman.net/wp-content/uploads/2016/03/About-me.jpg"
---
{% include head.html %}
{% include header.html %}
Blog Logo
{{ site.author.name }}
{{site.author.description}}
·
Purdue University
{% for social in site.social %}
{% if social.url %}
{% endif %}
{% endfor %}
My research focuses on deep learning of objective-driven representations.
Prior to this, I worked for over 4 years as a research scientist solving problems in the field of NLP and Computer Vision, majorly in domain of healthcare and insurance. Organizations that I have worked for include the California based ML solutions startup called Foundation AI and a leading Bangalore based healthcare startup called Practo.
I have received Bachelor's degree in Electrical and Electronics Engineering from NITK Surathkal, India. My undergraduate thesis, advised by Prof. Ashvini Chaturvedi focuses on comparison of machine learning and classical techniques in image segmentation.
This website is built and maintained by me personally. Any improvements or suggestions are welcome.


-- Model conceptualise a ~ person ~ P that has the value V as ~ age ~ and has the value S as ~ social security number ~ and has the sequence MH as ~ medical procedures ~ and ~ is the sibling of ~ the person P1 and ~ is the parent of ~ the person P2 and ~ is the child of ~ the person P3 and ~ is the uncle of ~ the person P4 and ~ is the aunt of ~ the person P5 and ~ is the brother of ~ the person P6 and ~ is closely related to ~ the person P7 and has the value NB as ~ number of brothers ~. conceptualise a ~ man ~ M that is a person. conceptualise a ~ woman ~ F that is a person. conceptualise a ~ patient ~ P that is a person. conceptualise a ~ disease ~ D. conceptualise an ~ animal ~ A. conceptualise the person PA ~ suffers from ~ the disease D. conceptualise a ~ symptom ~ S. conceptualise a ~ lump ~ L that is a symptom. conceptualise the person PA ~ presents with ~ the symptom S. conceptualise a ~ cancer ~ C that is a disease. conceptualise a ~ diagnostic test ~ D. conceptualise a ~ cancer scan ~ BS that is a diagnostic test. conceptualise the diagnostic test D ~ is recommended for ~ the patient P. conceptualise a ~ medical procedure ~ M. conceptualise a ~ media ~ M that has the value U as ~ url ~ and has the value C as ~ credit ~. conceptualise a ~ hospital ~ H that is a place and has the media P as ~ picture ~. conceptualise a ~ event ~ E that is a temporal thing and ~ occurred at ~ the place P. conceptualise a ~ check up ~ C that is an event. conceptualise a ~ consultation ~ C that is an event. conceptualise an ~ operation ~ O that is an event. conceptualise a ~ medical report ~ R that ~ mentions ~ the person P and has the value T as ~ text ~. -- Queries [ parent ] for which P1 and P2 is it true that ( the person P1 is the parent of the person P2 ) . [ grandparent ] for which P1, P2 and P3 is it true that ( the person P1 is the parent of the person P2 ) and ( the person P2 is the parent of the person P3 ) . -- Rules [sibling] if ( the person P1 is the sibling of the person P2 ) then ( the person P2 is the sibling of the person P1 ) . [uncle] if ( the man M is the sibling of the person P1 ) and ( the person P1 is the parent of the person P2 ) then ( the person M is the uncle of the person P2 ) . -- Model the hospital 'Basingstoke and North Hampshire Hospital' has '51.2807463' as latitude and has '-1.1095547' as longitude. the hospital 'Royal Hampshire County Hospital' has '51.0621731' as latitude and has '-1.3290164' as longitude. there is a man named John that has '53' as age and has 'abc123' as social security number. there is a man named James that has '49' as age and has 'def456' as social security number. there is a woman named Jean that has '21' as age and has 'ghi789' as social security number. there is a cancer scan named scan1. the person James has the sequence (the medical procedure 'cat scan', the medical procedure chemotherapy, the medical procedure 'barium meal') as medical procedures and is the brother of the person David.


Design
and Implementation of Analytics System:
Analyzing Baseball Data &
Predict the Winners of 2020 Series
Project
Background:
Baseball has been referred to as America’s national
pastime. Since its start in the mid-19th century, the game has grown
in popularity across the globe. Many professional leagues have come and gone
since the game began, with Major League Baseball (MLB) becoming the premier
league. MLB held its first game in 1869 and continues to play games to this
day. Financially, the MLB generates a great deal of money, and according to
Forbes annual valuation of the MLB, the league generated $10.5 billion in
revenue during the 2019 season. However, this year is different. Due to
coronavirus, the 2020 season has been vastly changed.
The season’s
opening day was pushed back by three months and the number of games to be
played is now at 60 versus the usual 162 game season. Additionally, fans are
not allowed to be in the stadiums when the games are played. Through September
2nd, 41 games have been postponed due to Covid-19 concerns. With all
these changes affecting the game and its players, we want to see if we can
accurately predict several data points for the 2020 MLB season.
Forbes annual valuation URL:
Scope:
Baseball is a game of trends. With normal seasons being
162 games, where each team plays most other teams across multiple series, it’s
normal to get a large sample size of regular season data which can be used to
predict post season success. While the post season matchups are much shorter in
length and they can be subject to short term variance and predicted winners
could end up losing, the teams that are believed to be the best regular season
teams are likely to be the best post season teams. However, 2020 has changed
that. With MLB having only 37% of their regular games, it might be much more
difficult to predict the post seasons successes this year. Additionally, MLB
has been considering a reduction in the number of games played for a while now.
Perhaps they could see this unique season as a working hypothesis to determine
the effect that fewer games would have. Many different groups of people would
be interested in answering these questions: Major League Baseball, individual
baseball teams, casinos, even personal sports betters would be very interested
in the outcome of the 2020 MLB season, and what prediction power the shortened
season has.
Research
Questions:
·
Who will win the 2020 Cy Young for each league?
·
Who will win the 2020 MVP Winners for each
league?
·
Who will win the National League? American
League?
·
Who will win the World Series in 2020?
Tools
& Technologies:
·
Scripting – R, Python / Jupiter-Notebooks
·
ETL – KNIME / API for
Current Year Data
·
MongoDB for Datastore
(NoSQL scalable database)
·
Data Visualization –
Tableau
Possible source of 2020 stats https://www.baseball-reference.com/leagues/MLB/2020.shtml
Data:
The data for the project is
primarily taken from the Lahman baseball dataset which is publicly available. The
Lahman Baseball Dataset is used frequently in data analysis as it contains
pitching, hitting, and fielding statistics for Major League Baseball from 1871
through 2017. It includes data from the two current leagues (American and
National), the four other "major" leagues (American Association,
Union Association, Players League, and Federal League), and the National
Association of 1871-1875.
The database was created by Sean
Lahman, who pioneered the effort to make baseball statistics freely available
to the public. What started as a one-man effort in 1994 has grown tremendously,
and now a team of researchers have collected their efforts to make this the
largest and most accurate source for baseball statistics available anywhere.
The raw data consists of 26 *.csv
files as shown in Table 1. Each *.csv contains between 4 and 56 attributes and
records which range from 53 to 143,047 (see Table 1). The table can be joined
via inner joins to provide additional details when needed.
Table
Design:
The design follows these general principles.
Each player is assigned a unique number (playerID). All the information relating to that
player is tagged with his playerID. The playerIDs are linked to names and
birthdates in the MASTER table.
The database is comprised of the
following main tables (See Table 1 for attribute and records counts):
·
People - Player names, DOB, and
biographical info
·
Batting - batting statistics
·
Pitching - pitching statistics
·
Fielding - fielding statistics
It is supplemented by these tables (see
Table 1 for attribute and records counts):
·
AllStarFull - All-Star appearances
·
Appearances - details on the positions a
player appeared at
·
AwardsManagers - awards won by managers
·
AwardsPlayers - awards won by players
·
AwardsShareManagers - award voting for
manager awards
·
AwardsSharePlayers - award voting for player
awards
·
BattingPost - post-season batting statistics
·
CollegePlaying - list of players and the
colleges they attended
·
FieldingOF - outfield position data
·
FieldingOFsplit - LF/CF/RF splits
·
FieldingPost- post-season fielding data
·
HallofFame - Hall of Fame voting data
·
HomeGames - Number of home games played by
each team in each ballpark
·
Managers - managerial statistics
·
ManagersHalf - split season data for managers
·
Parks - list of major league ballparks
·
PitchingPost - post-season pitching
statistics
·
Salaries - player salary data
·
Schools - list of colleges that players
attended
·
SeriesPost - post-season series information
·
TeamFranchises - franchise information
·
Teams - yearly stats and standings
·
TeamsHalf - split season data for teams
Table 1: Lahman Baseball Dataset
|
File |
Attributes/Variables |
Records |
|
AllstarFull.csv |
8 |
5376 |
|
Appeararances.csv |
21 |
107,358 |
|
AwardsManagers.csv |
6 |
180 |
|
AwardsPlayers.csv |
6 |
6,237 |
|
AwardsShareManagers.csv |
7 |
426 |
|
AwardsSharePlayers.csv |
7 |
6,880 |
|
Batting.csv |
22 |
107,430 |
|
BattingPost.csv |
23 |
14,751 |
|
CollegePlaying.csv |
3 |
17,351 |
|
Fielding.csv |
18 |
143,047 |
|
FieldingOF.csv |
6 |
12,029 |
|
FieldignOFsplit.csv |
18 |
33,280 |
|
HallOfFame.csv |
8 |
4,192 |
|
HomeGames.csv |
9 |
3,109 |
|
Managers.csv |
10 |
3,537 |
|
ManagersHalf.csv |
10 |
94 |
|
Parks.csv |
6 |
256 |
|
People.csv |
50 |
1,624 |
|
Pitching.csv |
56 |
47,629 |
|
PitchingPost.csv |
56 |
5,799 |
|
Salaries.csv |
5 |
26,429 |
|
Schools.csv |
5 |
1,208 |
|
SeriesPost.csv |
9 |
344 |
|
Teams.csv |
48 |
2,926 |
|
TeamsFranchises.csv |
4 |
121 |
|
TeamHalf.csv |
10 |
53 |
Additional
Data Sources:
Additional data will be obtained from the following sources:
·
mlb.com
(Major League Baseball) - https://www.mlb.com/
·
Baseball-Reference.com
- https://www.baseball-reference.com/
·
Retrosheet.com
- https://www.retrosheet.org/
The Major League Baseball website provides copious statistical data,
sortable and printable, updated instantly as games progress. The main attraction
of the MLB website is that it provides PITCHf/x data. That is, for every pitch
thrown by any pitchers in MLB, they’ll tell you the type of pitch, where it
crossed the plate, and how much it broke vertically and horizontally. As a
result, and not surprisingly, much of the groundbreaking research in
sabermetrics has to do with pitch analysis.
Baseball-Reference.com
(B-R) is like mlb.com but provides historical data. Not only can we get the
regular Bill-Terry’s-batting-average data, but you also get a large selection
of sabermetric stats, breakdowns by tens of different criteria (left/right,
day/night, April/September, and so on), and the ability to manipulate the data
in ways that other websites don’t allow.
Data
Acquisition:
MongoDB is a type of NoSQL database, called a document store.
The data is stored in a JSON-like array in a format called BSON (binary JSON),
which allows for quick and scalable (baseball related) queries. Java Script
Object Notation (JSON) are name/value pairs that can be nested to store complex
data. Another way of thinking of a MongoDB is that they are akin to a
multidimensional array. Like many NoSQL databases, the schema structure is
dynamic. This means that the descriptors of a dataset can be added, removed, or
not even required for records to be stored into a given database.
Loading and accessing the data was made relatively easy with
the mongolite R Package. Once data is uploaded to MongoDB, mongolite allows for
a wide range of R function to perform data wrangling and visualization
operations. Table 2 shows the results of a simple query of players and Figure 1
is an example plot of win percent (WinPct feature) versus the Number of games
managed.
Table 2
|
|
PlayerID <chr> |
NameFirst <chr> |
NameLast <chr> |
|
1 |
aardsda01 |
David |
Aardsma |
|
2 |
aaronha01 |
Hank |
Aaron |
|
3 |
aaronto01 |
Tommie |
Aaron |
|
4 |
aasedo01 |
Don |
Aase |
|
5 |
abadan01 |
Andy |
Abad |
|
6 |
abadfe01 |
Fernando |
abad |
Figure 1
Data
Acquisition via Web:
As stated above, we will be
accessing one to several websites to gather current baseball statistics from
the 2020 season. The Lahman dataset is an excellent reference, but to gather
current data we need to scrape the web using R. The rvest package in R is a
great tool for scraping the necessary statistics from html web pages to test
our models. The package itself was released in 2014 and is widely used and very
stable.
In addition to rvest, we can use
the Selector Gadget extension in Chrome to assist with selecting the correct
fields from mlb.com. The Selector Gadget is an open-source extension that helps
with CSS selection. The benefit of this tool is that you do not need to know
html or CSS to select the correct data for our database.
For example, as we work on predicting the Cy Young winner for 2020,
current pitching statistics will be vital to our models. Rvest will allow us to
easily gather statistics from mlb.com, such as the ones shown in the image
below. We must determine the fields we want and build out the necessary tables
in R to hold the variables before they are moved to MongoDB or used in our test
models. By using rvest and Selector Gadget, we essentially point and click on
the data we need, such as ERA, Wins, Games Started, etc.
Picture 1
Datasets:
We have collected two separate
datasets. The first data set is the Lahman dataset that is available in R
through the Lahman package. The complete dataset is shown in Appendix A. This
dataset will be providing all the historical data that we’re using to train our
models. It is a complete dataset of every baseball statistic that is currently
used in baseball analytics. Our plan is using the past five years of data to
train our models.
The second dataset has been
downloaded from baseball-reference.com. There are a total of six different csv
files associated with this dataset; the complete dataset is shown in Appendix
B. The baseball-reference.com dataset contains data from the current 2020
season and is being used to test our models. Our initial plan was to use the baseball
package currently available in R to scrape the baseball-reference site, however
several variables that are required for our models were not being collected
using that package. As an alternative, we downloaded the available csv files
from the site as they contained the required variables.
Both sets of data are complete and
already cleaned as they are official statistics provided by Major League
Baseball (MLB). Several variables have null values as that variable doesn’t
apply to a specific player; but overall, the data is complete and ready to use.
We will be keeping the missing values as they are. Outliers in the dataset are
rare, as it takes a special player/season to outperform his peers. With that in
mind, our first model attempts to predict who will with the Cy Young award,
given to the best pitchers in baseball. One pitcher from the American League
(AL) and one pitcher from the National League (NL) are each awarded the Cy
Young each season.
The most direct approach is to
calculate the Cy Young points for each pitcher. The Cy Young point formula will
create a derived variable for us to use. All the required variables are
available in both the Lahman dataset and the baseball-reference dataset. The
necessary variables are shown below:
·
Innings
Pitched (IP)
·
Earned Runs
Allowed (ER)
·
Strikeouts
(SO)
·
Saves (SV)
·
Shutouts
(SHO)
·
Wins (W)
·
Losses (L)
The formula to calculate Cy Young
points is straightforward and is show below:
Cy
Young Points (CYP) = ((5*IP/9)-ER) + (SO/12) + (SV*2.5) + Shutouts + ((W*6) - (L*2))
While the Cy Young award focuses
on an exceptional pitching season by a player, we are also working on a way to
predict total wins for each team. Our objective is to build a multiple linear
regression model using the Lahman data to predict the number of wins for the
2020 season. We’ll use the baseball-reference dataset to test our model. All
the following variables are present in both datasets.
Table 3
|
Variable Name |
Definition |
|
H |
Base
Hits by Batters (1B, 2B, 3B, HR) |
|
2B |
Doubles
by Batters (2B) |
|
3B |
Triples
by Batters (3B) |
|
HR |
Homeruns
by Batters (HR) |
|
BB |
Walks
by Batters |
|
SO |
Strikeouts
by Batters |
|
SB |
Stolen
Bases |
|
CS |
Caught
Stealing |
|
HBP |
Batters
hit by pitch |
|
E |
Errors |
|
DP |
Double
Plays |
|
H |
Hits
allowed |
|
HR |
Homeruns
allowed |
|
BB |
Walks
by Pitchers |
|
SO |
Strikeouts
by Pitchers |
|
W |
Number
of Wins by pitcher |
Between these two models we have
21 required variables due to overlap of 2 variables.
In addition, our last two research
questions ask if we can predict the league winner (AL or NL) and the World
Series Winner. To do this, we need to combine the above player data with
win/loss data from the teams in which they played. This was done by joining the
player data with data from the Teams table based on playerID, yearID, and
teamID. The following list are variables included in the uncleaned dataset due
to availability in both datasets.
Table 4
|
Variable Name |
Definition |
|
PlayerID |
ID designation of player |
|
NameLast |
Last Name of Player |
|
NameFirst |
First Name of Player |
|
batting_H |
Base
Hits by Batters (1B, 2B, 3B, HR) |
|
batting_X2B |
Doubles
by Batters (2B) |
|
batting_X3B |
Triples
by Batters (3B) |
|
batting_HR |
Homeruns
by Batters (HR) |
|
batting_BB |
Walks
by Batters |
|
batting_SO |
Strikeouts
by Batters |
|
batting_SB |
Stolen
Bases |
|
batting_CS |
Caught
Stealing |
|
batting_HBP |
Batters
hit by pitch |
|
fielding_E |
Fielding
Errors |
|
fielding_DP |
Double
Plays |
|
pitching_H |
Hits
allowed |
|
pitching_HR |
Homeruns
allowed |
|
pitching_BB |
Walks
by Pitchers |
|
pitching_SO |
Strikeouts
by Pitchers |
|
pitching_W |
Number
of Wins by pitcher |
|
pitching_L |
Number of Losses by pitcher |
|
pitching_SHO |
Shutouts by pitcher |
|
pitching_SV |
Saves by pitcher |
|
pitching_IP |
Innings Pitched by pitcher |
|
pitching_R |
Runs allowed by pitcher |
|
YearID |
Year of data entry |
|
TeamID |
ID of team of data entry |
|
team_W |
Team wins |
|
team_L |
Team Losses |
|
DivWin |
Did they win the division (Y or N) |
|
LgWin |
Did they win the league (Y or N) |
|
WSWin |
Did they win the World Series (Y or
N) |
The following graphs, generated
using the DataExplorer package in R, provide insight and detail into the
uncleaned.
Figure 2 – Basic Statistics
Figure 3 - Percentages
Figure 4 – Feature types and their categories (if available)
Figure 5 – Missing Data Profile
Figure 6 – Univariate Distribution (using Histogram)
Figure 6 – Univariate Distribution (using Histogram) - Continued
Figure 7 – QQ Plot
Figure 8 – Correlation Analysis
The uncleaned dataset contains
140,173 rows and 32 columns for a total of 4,502,496 observations. Of variables
included, 7 are discrete and 25 are continuous. After the data is joined
together, about 25% of the data is missing which will need to be cleaned and
fixed before analysis can begin. Initial analysis of the histograms from the
uncleaned dataset suggests that most of the variables are heavily skewed in one
direction or another. In addition, an initial look at the quantile plots of
each of the numeric variables suggests that most of the variables are not
normal and that will need to be addressed as well before modeling can begin.
Finally, the correlation plot of the uncleaned data shows a few things. Much of
the batting variables show some correlation with each other. The same is true
for the pitching variables and the team variables.
Now that the dataset has been
fully defined, it is now time to select the necessary attributes to be included
in the data model. To do this, we will use the backward elimination method. In
this, a model will be generated using the entire set of data, and there will be
a p-value generated for each attribute. Attributes are then dropped from the
dataset, starting with the attribute with the highest p-value greater than 5%,
and the p-values of the remaining attributes are then recalculated. Once all
the appropriate attributes have been removed, the R-squared value of the
original model will be compared to the new models’ R-squared value. If there
wasn’t a steep drop off in this value, it was acceptable to have eliminated the
above attributes.
Team
Wins – Variable Selection:
Figure 9
“Tm_Batting_SO” is the attribute
with the highest p-value at 0.64146. Once that is removed and the model
updated, we get the following results:
Figure 10
“Tm_Batting_CS” is the attribute
with the next highest p-value at 0.22852. With that removed and the model
updated, we get the following:
Figure 11
“Tm_Batting_HBP” is the next attribute with the highest p-value,
at 0.234. After removing that attribute and updating the model, we get the
following:
Figure 12
We now have no attributes that
have a p-value of greater than 0.05. Therefore, there is no need to further
remove any additional attributes from the dataset. Now, looking at the
R-squared values, the original model has an R-squared value of 0.8052, with the
final model having an R-squared value of 0.8467. This would imply that the
final model is somewhat a better fit for the data than the original dataset. But
it’s not a significant improvement. The important thing to note here is that
the R-squared value didn’t significantly drop. This means that our removal of
the Tm_Batting_SO, Tm_Batting_CS, and Tm_Batting_HBP attributes from the
dataset was appropriate.
Team Wins –
Variable Transformation:
most of the attributes in the
dataset are heavily skewed in one direction, i.e., most baseball players have
under 10 homeruns and only a small number of players have 40+ homeruns in each
season. Therefore, it will be necessary to perform some sort of transformation
on the skewed attributes to normalize the data.
To do so, the remaining dataset
will be compared to the log-based version of the dataset, along with a square
root version as well. Here’s a snapshot of one attribute that has been
transformed:
Figure 13
Here’s the distributions of each
dataset presented with histograms:
|
Figure 14 –
Original Dataset |
Figure
15 – Log Transformation |
Figure
16 – Square-Root Transformation |
After reviewing the distributions,
it appears as though the square-root transformation does the best job in
normalizing the dataset, although it is not perfect, it becomes unimodal along
with a gradual decline on the left side of the plot, and a steeper decline
towards the right. It does appear to be slightly skewed as well. But overall,
it appears to be a notable improvement.
After reviewing the other
attributes, it appears though some of the attributes will be normalized via the
square-root method, some will be transformed via the log method, and some will
remain in their original state. The important takeaway from this lesson’s
submission is that each attribute should be reviewed individually. You cannot
apply a blanket solution to every attribute within the model and expect to see
improvements to the results.
In addition to the selection and
transformations steps detailed above, a second method was employed for feature
selection and transformation to find the best possible data set for the MVP and
winner models. This method is uses the Boruta algorithm to determine feature
importance. The Boruta algorithm is based on the Random Forest model. The
algorithm generates a random dataset using the features you give it and builds
a model based on those features. It then builds another model based on the
actual dataset and compares the features to see which performed better. If the
real data performs better, it is a hit. This process is repeated many times
until enough hits or failures are generated to determine feature importance
(Mazzanti). In addition to the algorithm, each variable was transformed to a
scale of zero to one because the variables have a large range of values.
To begin, a unique dataset was
created to answer each of the four research questions. A unique data set is
needed because each question relates to different aspects of baseball and needs
different data. To predict the MVP winners, only data after 1969 can be used because
it was this year that the modern National League and American League both
existed. In addition, only the players that participate in the NLCS and ALCS
are eligible, so it does not make sense to look at every player but only the
ones that were in their respective series’. The same logic is applied to
predicting the National League winner, the American League winner, and the
World Series winner. As stated above, the current Leagues are only 40 years old
so only the past 40 years of data can be used for those predictions. Moreover,
this same data must be used for predicting the World Series winner. The current
baseball system uses the victors of the NLCS and ALCS as competitors, so any
data gathered before this time is void because it was generated under the same
circumstances. In addition, these datasets except for the World Series
prediction must be mutually exclusive as a team in the American League cannot
win the NCLS and vice versa. After these considerations, removing all the
missing data, and converting any categorical variables into numeric ones using
dummy variables, I arrived at the following dimensions for the datasets:
Table 5
|
Dataset |
Number of Variables |
Number of Entries |
|
American League MVP |
183 |
29763 |
|
National League MVP |
187 |
31314 |
|
American League Championship |
58 |
691 |
|
National League Championship |
56 |
689 |
|
World Series |
78 |
1380 |
After the algorithm was ran on the
datasets, the following graphs were generated showing the importance of each
feature. Green shows the important features while red shows the rejected
features. The features in yellow are features that were still undecided when
the algorithm terminated at 100 iterations. For initial modeling these yellow
features will be ignored however the Boruta algorithm will be left to run for
longer when the final modeling is completed. The superseding tables lists the
variables to be chosen for each model respectively.
Figure 17 – AL (American League) MVP Dataset
Figure 18 – NL (National League) MVP Dataset
Figure 19 – ALCS Dataset
Figure 20 – NLCS Dataset
Figure 21 – World Series Dataset
Table 6
|
Dataset |
Selected Features |
|
American League MVP |
159 Confirmed Features |
|
National League MVP |
162 Confirmed Features |
|
American League Championship (10) |
Team Rank, Team Wins, Team Losses, Division Win (Binary), Team
Runs, Team Hits, Runs scored by opponent teams, Team Earned Runs Allowed,
Team Earned Run Average, Hits Allowed |
|
National League Championship (13) |
Team Rank, Team Wins, Team Losses, Division Win (Binary), Team
Runs, Team Homeruns, Team Batters Caught by Pitch, Runs Scored by Opponent
Teams, Team Earned Runs Allowed, Team Earned Run Average, Hits Allowed,
Homeruns Allowed by opponent teams, Team walks allowed |
|
World Series (11) |
Team Rank, Team Wins, Team Losses, Division Win (Binary), League
Win (Binary), Team Runs, Team Hits, Runs scored by opponent teams, Team
Earned Runs Allowed, Hits Allowed, Team walks allowed,
Florida Marlins (Binary) |
To model these predictions, a couple different models will be employed
to generate more accurate results. The models used are Neural Networks and
Random Forests. To accompany these models, 10-fold, 3-repeated cross-validation
and using a 70/30 training/test split will be used.
For the Cy Young prediction, we believe that the best features to use
for prediction are in the formula detailed in earlier. Not only does external
research show that this formula is fairly accurate, but our own attempts at
modeling also using a larger dataset did not produce good results (Castrovince). An SVM model and an
Ada Boost model were constructed to see if another approach could be used to
predict the Cy Young winner. Using the Lahman dataset pitching statistics from
1957 onward, when the Cy Young was first awarded, a broad approach was utilized
to see if other models could successfully predict the Cy Young winner. The
models were run with an 80/20 split and then without splitting as the number of
Cy Young winners is very low compared to the number of pitchers.
To generate the SVM model utilizing an 80/20 split; we rescaled all
the pitching statistics from 1957 onward using a 0 to 1 scale. PlayerID,
teamID, stint, and yearID were all excluded from the data set. The SVM model
was then run to see if utilizing all available pitching statistics could
successfully predict the Cy Young winner.
SVM Results
As shown in the Testing confusion
matrix below, the SVM model was unable to predict a Cy Young winner in any
instance. This is most likely due to the sheer number of pitchers that did not
win the CY Young, as it’s only award to two pitchers in MLB each year.
Table 7
|
Actual |
Non-winner |
CY
winner |
Error |
|
Non-winner |
5,487 |
0 |
|
|
CY winner |
9 |
0 |
|
The Precision/Recall Plot below highlights the unreliable nature
of the SVM model. While the Lift chart and the ROC Curve also highlight the
fact that SVM model is not a good model to use when trying to determine the Cy
Young winner.
Figure 22 – SVM Precision/Recall
Figure 23 – SVM True Positive/False Positive Rate
Figure 24 – SVM Life Value Plot
We reran the SVM model without splitting the data to see if better
results could be achieved. Here are the results without splitting into a
training/testing set. As you can see in the error matrix below, Cy Young
winners were predicted this time; but the model achieved a high error rate
(69.2) in predicting CY winners.
Table 8
|
Actual |
Non-winner |
CY
winner |
Error |
|
Non-winner |
27,225 |
0 |
|
|
CY winner |
36 |
16 |
69.2 |
Figure 25 – SVM Precision/Recall
Figure 26 – SVM True Positive/False Positive Rate
Figure 27 – SVM Life Value Plot
In addition to the SVM model, an
Ada Boost model was run as well. To generate the Ada Boost model utilizing an
80/20 split; all the pitching statistics from 1957 onward were rescaled using a
0 to 1 scale. PlayerID, teamID, stint, and yearID were all excluded from the
data set. The Ada Boost model was then run with a max depth of 6 and 2
iterations to see if utilizing all the pitching statistics could successfully
predict the Cy Young winner. Additionally, variables with no values were
removed from the data set as well.
Ada Boost Results
As shown in the Testing confusion
matrix below, the Ada Boost model had a high error rate (77.8) when attempting
to predict Cy Young winners. Again, this is most likely due to the sheer number
of pitchers that did not win the CY Young, as it’s only award to two pitchers
in MLB each year.
Table 9
|
Actual |
Non-winner |
CY
winner |
Error |
|
Non-winner |
5,486 |
1 |
|
|
CY winner |
7 |
2 |
77.8 |
Figure 28 – AdaBoost Precision/Recall
Figure 29 – AdaBoost True Positive/False Positive Rate
Figure 30 – AdaBoost Lift Value Chart
I reran the Ada model without splitting the data to see if better
results could be achieved. Here are the results without splitting into a
training/testing set. While the error rate improved from the 80/20 split, the
model still achieved a high error rate (69.4) in predicting CY winners.
Table 10
|
Actual |
Non-winner |
CY
winner |
Error |
|
Non-winner |
32,432 |
6 |
|
|
CY winner |
43 |
19 |
69.4 |
Figure 31 – AdaBoost Precision/Recall
Figure 32 – AdaBoost True Positive/False Positive Rate
Figure 33 – AdaBoost Lift Value Chart
Overall Results
Overall,
the SVM and Ada Boost models proved to not be good models to use when
predicting the Cy Young winner. They were unable to predict the winner with any
accuracy, having error rates above 69%. The formula approaches the group is
utilizing is a far better approach than either the SVM or Ada Boost approaches.
The
following table summarizes our attempts at generating predictive models to
answer the research questions detailed at the beginning of this paper. Accuracy
was the main metric we decided to use to evaluate model fitness. All our models
are classification models, so we selected accuracy.
Table 11 – Overall Results of Random Forest and Neural Network
|
What
does the model predict? |
Modeling
Method |
Validation
Method |
Train/Test or Average
Model Accuracy |
|
American
League MVP |
Neural
Network |
70/30
Split |
.6919
/ .7059 |
|
American
League MVP |
Random
Forest Classification |
70/30
Split |
1
/ .9941 |
|
American
League MVP |
Neural
Network |
10-Fold,
Cross-Validation |
.6946 |
|
American
League MVP |
Random
Forest Classification |
10-Fold,
Cross-Validation |
.99 |
|
National
League MVP |
Neural
Network |
70/30
Split |
.5060
/ .4984 |
|
National
League MVP |
Random
Forest Classification |
70/30
Split |
1
/ .9923 |
|
National
League MVP |
Neural
Network |
10-Fold,
Cross-Validation |
.5686 |
|
National
League MVP |
Random
Forest Classification |
10-Fold,
Cross-Validation |
.99 |
|
American
League Winner |
Neural
Network |
70/30
Split |
.5714
/ .3333 |
|
American
League Winner |
Random
Forest Classification |
70/30
Split |
1
/ .9333 |
|
American
League Winner |
Neural
Network |
10-Fold,
Cross-Validation |
.5133 |
|
American
League Winner |
Random
Forest Classification |
10-Fold,
Cross-Validation |
.9167 |
|
National
League Winner |
Neural
Network |
70/30
Split |
.9714
/ .9333 |
|
National
League Winner |
Random
Forest Classification |
70/30
Split |
.9857
/ .9333 |
|
National
League Winner |
Neural
Network |
10-Fold,
Cross-Validation |
.8400 |
|
National
League Winner |
Random
Forest Classification |
10-Fold,
Cross-Validation |
.9133 |
|
World
Series Winner |
Neural
Network |
70/30
Split |
.5142
/ .4667 |
|
World
Series Winner |
Random
Forest Classification |
70/30
Split |
.9857
/ 1 |
|
World
Series Winner |
Neural
Network |
10-Fold,
Cross-Validation |
.5233 |
|
World
Series Winner |
Random
Forest Classification |
10-Fold,
Cross-Validation |
.9900 |
|
CY
Young Award Winner |
Nearest
Neighbor |
10-Fold,
Cross-Validation |
.7222 |
|
CY
Young Award Winner |
Support
Vector Machine |
10-Fold,
Cross-Validation |
.6945 |
|
CY
Young Award Winner |
CART |
10-Fold,
Cross-Validation |
.7963 |
|
CY
Young Award Winner |
Random
Forest Classification |
10-Fold,
Cross-Validation |
.8148 |
The
first thing that stands out is the huge discrepancy the neural network models
and the random forest models for the MVP / Winner models. The data sets used
for the neural network and random forest modes were identical respective to
what they were predicting however each of models were predicting no “winning”
responses regardless of which dataset was used. The reason for this is over
fitting and how each model uses the data set it is given. Initially the data
sets for these predictions were massively under-sampled with a positive result
occurring less than five percent of the time. To correct this, a new data set
was generated with all of the entries with positive
results and an equal amount of randomly selected entries with a negative
result. This resulted in a balanced data set. For the neural network, this
meant a much more valid model than what was created from the unbalanced data
set with accuracy results of around .5 for each model. However, the random
forest model yields accuracy of around .99. This is an interesting result
because this time I do not believe the random forest is overfitting. The
training and test sets are extremely close together which means the model is
not memorizing the training data. In addition, the model was run using the unbalanced
dataset and again yielded accuracy results of .98. Overall, the random forest
performed significantly better than the neural network in all cases. Another
important thing to note is the accuracy of the Cy Young Award predictions.
These models were also generated using cross-validation and a balanced data in
the same way as the neural network models. However, they are much more accurate
with the highest being .81. This speaks to the effectiveness of doing outside
research when modeling. The neural networks were generated purely using
variable selection methods learned in class where the Cy Young models were
generated using a mixture of traditional variable selection and research to
choose specific predictors.
Neural
Network Plots
Figure 34
|
|
|
|
|
|
|
|
Random
Forest Classification Plots
Figure 35
|
|
|
|
|
|
Who
will win the World Series in 2020?
The first
step in predicting the 2020 world Series winner was to simulate the 2020 season
to obtain the teams “talent” and then plug the result into the Bradley-Terry
(BT) model. Given the 30 professional teams who talents (quantitative ability)
denoted by a1, … a30. The probability team I defeats team j is given by
This is a
special case of a logistic model which is a common regression model where the
response viable is binary (0 or 1, lose or win)
Model
Setup
The date was
extracted from the Group 6 MongoDB. Based upon the data I created a new
variable Win that is 1 or 0 depending on if the home team wins (1) or loses (0).
Then using the summarize function in the dplyr R package, I found the
number of homes wins and away wins for each matchup of two teams. Figure 36
show the first few rows of this data frame.
Figure 36
Fitting the Model
With the data frame from
Figure 1 we can use the Bradley-Terry model using the Btm
function in the BradleyTerry2 package, which calculates the
seasonal talents. The resulting talents are show in Figure 37. The output gives
the estimates of the team talents a1, …. A30. For
example, the team talent for the Los Angles Dodges is 0.90295 and for the Tampa
Bay Rays is 0.49568. A modification to the model would allow for calculating
the effect of a home field advantage, but since neither team will be playing in
their respective hometowns a home field advantage will not be used in this
model.
Figure 37
Predicting the World Series Winner
The winner of the word series is the first team
to win 4 of 7 games. Using the BT model for the first game we find that the Los
Angele Dodgers are favored to win, see Figure 38. After each game talents are
recalculated and then reused to predict the winner of a particular game. Figure
38 show the game predictions and results. The model predicted that the Los Angele
Dodgers should have defeated the Tampa Bay Rays in the first four games, but
Tampa Bay was able to win two.
Figure 38
Table 12 is the final worlds series prediction
confusion matrix.
Table 12 – Confusion Matrix LA Dodges
|
N = 6 |
Predicted Loses |
Predicted Wins |
|
Actual Loses |
TN = 0 |
FP = 2 |
|
Actual Wins |
FN = 0 |
TP = 4 |
Model accuracy: (TP
+ TN)/total = (4 + 0)/6 = 0.67
Misclassification Rate
(Error Rate) (FP + FN)/total = (2 +
0)/6 = 0.33
True Positive Rate: When
the was a LA Dodger win, how often did the model predict a win TP/actual yes = 4/4 =
1.00
False Positive Rate: When
the LA Dodges actual lose, how often did the model predict a loss. FP/actual no = 2/2 = 1.00
Who
will win the 2020 Cy Young Award?
To predict the 2020 Cy
Young Award, I started with 35 variables as shown in figure below:
Figure 39
To this group of variables,
I added one additional variable – CYP or the Cy Young Points using the
following formula:
Where:
·
IP: Innings pitched
·
ER: Earned runs
·
SV: Saves
·
SO: Shutouts
·
W-L: Wins-Losses
·
VB: Victory Bonus is a
12-point bonus awarded for leading your team to the division championship. I
did not include this variable as at the time as I didn't know who the NL/AL
winners were.
Predictive
Models
Four models were revied
to determine which was the most accurate for predicting the 2020 Cy Young
Award. Those models were the
·
K-Nearest Neighbor
·
Support Vector Machine
·
Regression Tree
·
Random Forest
Before any analysis was
performed the data was split the data into two data sets; a training and a
testing dataset, based upon an 80/20 split. The dataset was large enough to
perform cross validation using an 80/20 split of training and testing data. An
arbitrary seed was set to assure reproducibility, and the training and testing
sets were created using createDataPartition from the caret
package.
A random forest model was
built using all the prediction variables and the CYP variable as the
categorical outcome. A random forest was attempted with the train
function from the caret package and with the randomForest
function from the randomForest package. The train function run for ~75
minutes and the function never completed. The randomForest method ran in under
ten minutes, and thus the randomForest method was used to build the
random forest. The final variables selected are shown in Figure 40.
Figure 40
Over-Under-Sampling
The training dataset
contained 12-percnet of Cy Young winners and 88-percent no winners. This
indicated a severely imbalanced data set which would adversely affect the
model. So, two new training datasets were created one and under-sampled dataset
and the rother an over-sampled dataset. So, 16 models were run and compared to
determine the best and most accurate model.
Predictions
Of the 16 model the most
accurate model were the over- and under- sampled regression tree models which
had inaccuracy of 0.83 (95% CI 0.67 - 0.94), See Figure 41.
Figure 41
Predicting the Cy Young Award
winner using python:
Just like the predictive model in R, it started with 35
variables but ended up using only 7 variables for prediction based on the CYP
formula which was discussed in the previous section.
Predictive
Models
Seven models were used to determine the most accurate
model for predicting the 2020 Cy Young Award:
·
Logistic Regression
·
Naïve Bayes
·
Decision Tree
·
Neural Network
·
Support Vector Machine
·
Regression Tree
·
AdaBoost Classifier
The data was large enough to perform cross validation,
thus, it was split into training and test datasets with the 80 to 20 ratios.
All these was performed using model selection module in scikit-learn library in
python.
Over-Under-Sampling
The training dataset
contained 15-percent of Cy Young winners and 85-percent none-winners. This
indicated a severely imbalanced data set which would adversely affect the
model. Two datasets were created: one with over sampled data and the other one
with the under sampled data and all the seven prediction models were ran under
the two different datasets but to have a tidy and concise document only the
over-sampled results were attached to the document which had more accurate
results in general.
Figure 42
Predictions
As it is stated in table below the most accurate models
are the Random Forest and AdaBoost classifier models with 88% percent of
accuracy in each.
Table 13 – Summary
|
Model Name |
Accuracy |
Precision |
Recall |
f1-Score |
Confusion Matrix Plot |
|||
|
0 |
1 |
0 |
1 |
0 |
1 |
|
||
|
Logistic Regression |
0.76 |
.76 |
.75 |
.75 |
.76 |
.76 |
.75 |
|
|
Naïve Bayes |
0.67 |
.69 |
.65 |
.58 |
.74 |
.63 |
.69 |
|
|
Decision Tree |
0.84 |
.91 |
.80 |
.76 |
.93 |
.83 |
.86 |
|
|
Neural Network |
0.79 |
.83 |
.76 |
.72 |
.85 |
.77 |
.80 |
|
|
Support Vector Machine |
0.77 |
.79 |
.76 |
.75 |
.80 |
.77 |
.78 |
|
|
Random Forest |
0.883 |
|
||||||
|
AdaBoost Classifier |
0.884 |
|
Predicting the MVP (Most Valuable Person) Award winner using
python:
The Most Valuable
Player Award is given annually to one player in each league. The award began in
1911 as the Chalmers Award, honoring the "most important and useful player
to the club and to the league". This award was discontinued in 1914. From
1922 to 1928 in the American League and from 1924 to 1929 in the National
League, an MVP award was given to "the baseball player who is of the greatest
all-around service to his club". Prior winners were not eligible to win
the MVP award again during this time. The current incarnation of the MVP award
was established in 1931. The Baseball Writers' Association of America (BBWAA)
votes on the MVP award at the conclusion of each season before the postseason
starts.
The dataset used
for modeling was the batting dataset which has the variables listed below:
·
H: Hits
·
BB: Walks by
batters
·
HBP: Batters hit
by pitch
·
AB: At Bats
·
SF: Sacrifice
flies
·
H, 2B, 3B: Hits, Doubles,
Triples
·
HR: Homeruns
·
RBI: Runs
batted in
·
SB: Stolen
Bases;
To perform the
modeling some variables had to be generated according to the baseball reference
website:
·
BA: Hits/At
Bats (H/AB); according to baseball reference website;
·
OBP: (H + BB +
HBP) / (AB + BB + HBP + SF); according to baseball reference website;
·
SLG: (H - X2B -
X3B - HR + 2 * X2B + 3 * X3B + 4 * HR) / AB; according to Max Marchi and Jim
Albert article;
Also, MVP
variable which is an indicator that a certain player has won the award or not
was added to the dataset based on the “awards” dataset. Also, several unused
variables were dropped that resulted the final table to be like this:
Figure 43
Just like the Cy Young award dataset, the MVP data was
large enough to perform cross validation, thus, it was split into training and
test datasets with the 80 to 20 ratios using the same techniques.
Handling the imbalanced dataset:
The training dataset contained 5-percent of MVP award winners and
95-percent none-winners. This indicated a severely imbalanced data set which
would adversely affect the model. This problem handled by simply filtering the
dataset based on variables such as: Year ID, BA, SLG, OBP, and HR which
resulted in a perfectly balanced dataset with the ratio of 51 to 48.
Figure 44
Predictions
In general MVP awards prediction models performed better
than Cy Young models. The highest accuracy achieved with Logistic Regression
and Random Forest models with the accuracy of 83% for each.
|
Model Name |
Accuracy |
Precision |
Recall |
f1-Score |
Confusion Matrix Plot |
|||
|
0 |
1 |
0 |
1 |
0 |
1 |
|
||
|
Logistic Regression |
0.83 |
.86 |
.80 |
.79 |
.87 |
.82 |
.83 |
|
|
Naïve Bayes |
0.80 |
.86 |
.75 |
.71 |
.88 |
.78 |
.81 |
|
|
Decision Tree |
0.78 |
.78 |
.77 |
.77 |
.78 |
.78 |
.78 |
|
|
Neural Network |
0.80 |
.91 |
.73 |
.66 |
.93 |
.77 |
.82 |
|
|
Support Vector Machine |
0.82 |
.80 |
.84 |
.87 |
.77 |
.83 |
.81 |
|
|
Random Forest |
0.83 |
|
||||||
|
AdaBoost Classifier |
0.81 |
|


| visibilityFuncs {shinyjs} | R Documentation |
Display or hide an HTML element.
show
makes an element visible, hide
makes
an element invisible, toggle
displays the element if it it
hidden and hides it if it is visible.
showElement
, hideElement
, and
toggleElement
are synonyms that may be safer to use if you're
working with S4 classes (since they don't mask any existing S4 functions).
If condition
is given to toggle
, that condition will be used
to determine if to show or hide the element. The element will be shown if the
condition evaluates to TRUE
and hidden otherwise. If you find
yourself writing code such as if (test()) show(id) else hide(id)
then you can use toggle
instead: toggle(id = id, condition = test())
.
show( id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, asis = FALSE ) showElement( id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, asis = FALSE ) hide( id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, asis = FALSE ) hideElement( id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, asis = FALSE ) toggle( id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, condition = NULL, asis = FALSE ) toggleElement( id = NULL, anim = FALSE, animType = "slide", time = 0.5, selector = NULL, condition = NULL, asis = FALSE )
id |
The id of the element/Shiny tag |
anim |
If |
animType |
The type of animation to use, either |
time |
The number of seconds to make the animation last |
selector |
JQuery selector of the elements to show/hide. Ignored if the
|
asis |
If |
condition |
An optional argument to |
If you want to hide/show an element in a few seconds rather than immediately,
you can use the delay
function.
If you use S4 classes, you should be aware of the fact that both S4 and
shinyjs
use the show()
function. This means that when using S4,
it is recommended to use showElement()
from shinyjs
, and to
use methods::show()
for S4 object.
shinyjs
must be initialized with a call to useShinyjs()
in the app's ui.
useShinyjs
,
runExample
,
hidden
,
delay
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useShinyjs(), # Set up shinyjs actionButton("btn", "Click me"), textInput("text", "Text") ), server = function(input, output) { observeEvent(input$btn, { # Change the following line for more examples toggle("text") }) } ) } ## Not run: # The shinyjs function call in the above app can be replaced by # any of the following examples to produce similar Shiny apps toggle(id = "text") delay(1000, toggle(id = "text")) # toggle in 1 second toggle("text", TRUE) toggle("text", TRUE, "fade", 2) toggle(id = "text", time = 1, anim = TRUE, animType = "slide") show("text") show(id = "text", anim = TRUE) hide("text") hide(id = "text", anim = TRUE) ## End(Not run) ## toggle can be given an optional `condition` argument, which ## determines if to show or hide the element if (interactive()) { shinyApp( ui = fluidPage( useShinyjs(), checkboxInput("checkbox", "Show the text", TRUE), p(id = "element", "Watch what happens to me") ), server = function(input, output) { observe({ toggle(id = "element", condition = input$checkbox) }) } ) }


Salary Calculator
Add Employees
Submit
Employee List
First Name
Last Name
ID Number
Title
Annual Salary
Delete
Total Monthly: $


PRIVATE PARTS A film review by Michael Redman Copyright 1997 Michael Redman
*** (out of ****)
First off I should confess that I am not a Howard Stern fan. I primarily attribute this to the fact that I have not lived in a market where I could hear him on the radio. I'll also have to admit that I never thought that my life was incomplete due to this lack of experience.
Until this film, "Howard Stern" was more of a concept than a person. Now we see the man behind the shock jock =97 at least we see the image that=
the man behind the shock jock wants us to see. Although it's impossible to determine the truth of the person, there is one fact that is indisputable: Stern is certainly the virtuoso of self-promotion.
>From a very early age, the outrageous radio personality wanted to be famous and discovered that scandal was a sure way to achieve that goal. After overcoming his initial on-air shyness, "Howierd" hit the country by storm although like most overnight sensations, it took him years to get there.
The rally where he accepts the honor of being New York's most popular DJ in front of thousands of screaming (and semi-nude) fans occupies a major point in the film and was obviously a major highlight in his life.
Stern's public persona is the man who pushes the envelope of decency as far as, if not further than, it can go. He sneaks the words you can't say on radio into a quiz show skit ("Complete the phrase: 'Blank Willow'.").  He conducts the world's first radio interview with a naked woman while she massages him on the studio floor.
His epic battles with the powers that be at NBC, especially his nemesis "Pig Vomit", are at the heart of the Howard Stern The Hero portion of the film. You can't help but root for the everyman jerk as he takes on the corporate jerks.
Now we have his new public image. He's also the man who fell in love and has stayed faithful to the same woman for over 20 years. He's the devoted father of a brood of lovely children. He's probably even kind to dogs. Methinks reality lies somewhere inbetween.
Stern plays himself as does his on-air team. They are all naturals at being themselves: a task undoubtedly more difficult than it seems. He and his partners-in-crime Robin Quivers and Fred Norris are often hilarious even as they go for the lowest level of humor possible.
With this film, Stern has made his splash in yet another medium. It remains to be seen if he can portray anyone other than himself, but he is magnificent in this role. Its the one he was born to play.
There are many similarities between "Private Parts" and "The People Versus Larry Flynt". Both feature men who are public sleazeballs shoving the limits of free speech, but privately have a heart of gold. Both are about figures that publicly treat women in a less than PC fashion, but behind closed doors conduct long term loving relationships.
Perhaps we are seeing the beginning of a new trend in films. I can't help but wonder if the next thing to look forward to is "Rush Limbaugh: The Movie".
[This appeared in the 3/20/97 "Bloomington Voice", Bloomington, Indiana. Michael Redman can be reached at<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


Welcome to Pandemic Dashboard
The Dashboard consist of Pandemic Diseases which has affect the world in massive way.
Mainly disease which occured 100's of years ago and some are happened in this century also.
User will be able to see the diseases like Covid-19, Spanish-flu, Ebola, Plague.
We are using an Open-Source API for Covid-19 which is a realtime. So, you might face a down.
If this scenario comes up, 'Refresh'.
Scroll Down


Home
Cars
Unsold cars
Sold Cars
Fraud
Logout
Home
Cars
Sold Cars
Manifacuter
Model
Type
Price
State
Status
Action
Volswagen
Golf
Car
3200.00
new
sold
Toyota
Passo
truck
3900.00
used
sold
BMW
mini
SportCar
3500.00
new
sold


Wallaroo is situated on a very open bay on the eastern side of the Spencer Gulf, about 50nm due south of Whyalla. It has a long jetty for handling grain exports. It is also a ferry port. Just north of this is the entrance to the very sheltered harbour of Copper Cove.
Position 33°55′S, 137°37′E.
The marina in Copper Cove offers complete protection.
In settled weather, it is possible to anchor off the beach north of the wharf.
Kadina is only a mile or so inland from Wallaroo. Both towns have a range of services which serve the fishing fleet.
Last updated January 2014.


{% extends "layout.html" %} {% from "_macros.html" import render_radio_buttons, render_phone_prop, render_email_prop, render_string_prop, render_field_with_errors, render_field, render_event_props, render_image_with_link, render_place, render_link_prop %} {%- block title -%} {{ event.name }} {%- endblock -%} {% block content %}
{{ _('Ask another organization to reference your event on their calendar.') }}
{% endblock %}


Orange snapshot: mms to share photos on twitter
Sometimes you are requested to do a quick job at work, that “should not last longer than 2/3 days”.
We’ve all been there, all done it and in my case in R&D with Orange, seen too many times the “project” end up in a drawer somewhere.
However, this time, I have been assigned on that “little project” called snapshot, for which the goal was simple: our team racing designer was creating the graphical design and I was translating that into XHTML/CSS as well as XHTML-MP templates for mobiles as quickly as I could
As you’d expect from super quick things like these (mind you I was already assigned 100% on two other high profile projects before that came on), we had to cut corners. For example, there is no support for older browsers like IE6 for the moment. No time to work on that unfortunately, but it should not be too difficult to adapt the templates and CSS and found yet again a hacky way around double margins, wrong positioning and lack of png support.
Integration was quick with the dev team, although not super smooth, but for once it was going to make it as a product! It’s now all on http://snapshot.orange.co.uk and it’s official
Some features might be added sooner or later to the site, but hopefully it will be kept simple!
From initial feedback, it seems the most wanted feature is the ability to rotate the pictures, and it will be done soon!
So for one of the very few R&D projects I worked on that actually made it to the market and I can showcase, it’s celebration day!
comments
Mark Watts-Jones Thu, 19 Nov 2009 - 16:42
It is great to get Snapshot to market and a great way to work with our teams I thought. Lets do more!
Matt Thu, 19 Nov 2009 - 16:49
Hi Mark, I agree, we should do more exchanges like this as Snapshot really proves we can deliver quickly. I liked working on it and I like even more that it made it out! Thanks


{{clock}}
You have to sign in before doing any operations!
Press OK to redirect to the login page.
Request has been sent!
You have to wait for the team approval.
{{suggestion.text}}
Advanced Search
Result type:
Both
Teams only
Members only
Constraints on searching teams
Destination:
--
Language for communication:
--
Preference:
--
Both male and female
Male
Female
Not yet full:
Not yet departed:
Constraints on searching members
Gender:
--
Male
Female
Home Country:
--
Desirable country:
--
Language Ability:
--
Available to travel:
{{debugMsg}} {{debugMsg2}}
{{(r.email==""?"Preference: ":"Gender: ")}}
{{(r.email==""?"No. of members/Max: ":"")}}
{{(r.email==""?"Departure date: ":"")}}
{{(r.email==""?"Language for communication: ":"Language abilities: ")}}
{{(r.email==""?"Destination: ":"Home country: ")}}
{{(r.email==""?"":"Desirable country: ")}}
{{(r.email!="")?"Email: ":""}}
Description:
{{(r.tags!=""?"Tags: ":"")}}
No results matched!


| Property | Description | Data Type |
|---|---|---|
|
protocol identifier
required |
Trial identifier used by lead organization, ie. Center for Experimental Therapeutics Program (CTEP) ID or Industry Sponsored ID. This is usually a short identifier. Example: E4412. | < string > |
|
assay creator
required |
Indicates what site is filling out the assay. |
<
string
>
|
|
batch identifier
required |
A unique identifier for this Olink upload | < string > |
|
panel
required |
Panel used for the assay. | < string > |
|
assay panel lot
required |
Lot number of the assay panel. | < string > |
| study-level combined file | Information about an NPX file. | npx |
| study-level combined npx manager version | Version of NPX manager used for the analysis. | < string > |
| batch-level combined file | Information about an NPX file. | npx |
| batch-level combined npx manager version | Version of NPX manager used for the analysis. | < string > |
Olink details
| Property | Description | Data Type |
|---|---|---|
|
chip barcode
required |
Chip barcode number. | < string > |
|
npx file
required |
Information about an NPX file. | npx |
|
raw ct file
required |
Information about a comma separated file. | csv |
|
run date
required |
Date when the Olink assay was run. | < string : date > |
|
run time
required |
Time when the Olink assay was run. | < string : time > |
|
instrument
required |
Instrument used for the Olink assay. | < string > |
|
fludigm application version
required |
Version of the Fluidgm application used. | < string > |
|
fludigm application build
required |
Build of the Fluidgm application used. | < string > |
|
probe type
required |
Probe Type. | < string > |
|
passive reference
required |
Passive Reference. | < string > |
|
quality threshold
required |
Threshold used for quality cutoff. | < number > |
|
baseline correction
required |
Method used for baseline correction. | < string > |
|
number of samples
required |
Number of samples analyzed in the assay. | < number > |
|
number of samples failed
required |
Number of samples failed in the assay. | < number > |
|
npx manager version
required |
Version of NPX manager used for the analysis. | < string > |


Browser : Operating System
Fairly early in my career as a programmer, I switched from the C and C++ path over to front-end web development. It was fun, in-demand, and provided a way to scratch my artistic and programming itches at the same time.
I spent a lot of that time wrestling with web browsers.
These days, I write most of my JavaScript for node, and run my programs on servers. I’ve found that wrestling with operating system differences is very similar to web browsers.
(Disclaimer: this is a joke. Please don’t email me.)
IE : Windows
Full of Microsoftisms. Most things mostly work, except that sometimes they don’t, and when they do, it’s usually in a completely foreign and strange way. So different that many people either don’t support it, or don’t support anything else.
Firefox : Linux
Mostly works, but always awkward. A perpetually broken mish-mash of components that often weren’t really intended to be used together. No two are alike, and nothing ever looks exactly right.
Shrouded in a religious belief that it is fixing the worlds problems. Any criticism is viewed as heresy (unless it comes with a patch).
WebKit/Safari/Chrome : Darwin/BSD
Very nice, very polished. Would probably die if not for the fact that a huge corporation decided to back it (since we already have a public option with Linux/Firefox). Mostly open source, but if you have to actually do things, you’ll inevitably be forced into the “blessed” APIs, which are not standard.
Opera : SunOS
All 12 of its users loudly agree it is superior in every way, and they have graphs to prove it.
Experts, Idiots, and Taste
My nerd rage on the topic of Fibers, co-routines, and compiled-to-js languages in node.js comes from seeing a non-problem solved in a way that makes it worse.
There are two really dangerous rationalizations in software design:
- “We need to make it easier for newcomers.”
- “Only experts will use this, anyway.”
Tower of Babel of Cards
They’re dangerous because each seems to imply that the other can be disregarded. The worst approach is to vacillate between them: “We need to make (async IO, object cleanup, database queries, whatever) easier for new users, so we’ll add this magic that experts will use to make intuitive APIs.”
It’s a vicious spiral. You can justify adding complexity, because “this is for experts only”, and also exposing the functionality in an obscured way in the name of making it “intuitive” for newcomers. The result is inevitably a towering house of cards. On a somewhat visceral level, I get this gut reaction to a “handing down from the mountain” mentality that is only harmful in the long run for everyone.
A better goal is to make an API such that when an expert uses it expertly, a newcomer can still understand it thoroughly. It requires an API (and more importantly, a culture) that limits experts, and educates newcomers. I don’t know the best way to approach problems to get there, but I’ve found pretty good results from thinking, “I’m probably going to mess this up the next time I touch it, so I’d better make it really obvious.” I usually fail at it, and end up cursing myself later when I rewrite the damn thing yet again.
Passing around a function that gets called later is not that hard. We’ve been doing that in JavaScript forever. Yes, newcomers to the language, especially if they come from a language without closures and first-class functions, have a little bit of a learning curve to get used to this phenomenon. In my opinion, you do them a disservice by trying to shield them from that.
(Passing around function pointers in C is actually a little bit better in some ways, because you can’t define your functions inline, and all the captured data must be passed around explicitly. This is a bit like using named functions instead of nested closures, which is a common low-complexity approach to the alleged callback problem.)
I’ve been writing JavaScript for a while now, and other languages for a few years before I got into JavaScript. I’m not the most expert at it, but I certainly don’t consider myself a newcomer. In that time, I’ve learned something:
We’re All Idiots
All of us, whether experts or newcomers.  We all write bugs, all the time. That is the normal state of software.
If your code uses step or async or slide or Q, I can read it, and I see a function getting called and passed some arguments. I can look at how you got that function from a require() statement, pull up that module, and look at its definition. These are lightweight abstractions that are highly penetrable. I’ve suggested in the past that everyone should write their own flow control lib, because it’s the best way to really understand how they work, and it’s not that hard. Once you grasp the basic concepts, reading someone else’s flow control utility is pretty easy.
If your code uses a compiled fibers library, or something that transforms the code, then it’s much harder for me to figure out what the heck is going on. The introspection is gone. The languages change. Stuff happens that isn’t present in the code I’m looking at. This is fundamentally different from a library that just passes functions around.
That means: I won’t use your library if there’s any alternative (including writing the exact same functionality myself). It’s nothing personal. I just would rather spend my time solving necessary problems rather than manufactured ones. I simply don’t believe that you’ve put the same level of thinking into your coro util that TC-39 and the v8 team has put into JavaScript, or that Bert and Ryan and Ben and Igor have put into libuv.
Not everyone is the same, and that’s great!! If you find that Fibers solve a problem for you, and they make the code that you write easier for you to manage and design, then that’s awesome. Use them. Understand them. Drop the illusory dichotomy of “experts” and “newcomers”, and realize that they are both idiots, and both you.
Every choice that isn’t completely boring will alienate someone. Pleasing everyone is a recipe for blandness. That’s why we keep the node-core standard lib super small, and encourage variation and repetition and iteration in userland modules.
Absolutes
If your goal is to please me (and other stodgy “javascript is fine, callbacks aren’t hard” types) with a compiled coroutine library that adds magic to the language, you should realize how horribly unlikely that is. I do actually think that this approach is fundamentally flawed. I’ve played with Marcel’s fibers lib a bit, and it’s about the nicest I’ve seen, but it still adds an unacceptable (for me!) amount of magic to programs.
 I’ve done it in this post, because I’m as lazy as anyone. Maybe you’re the exception, and you actually are smart enough to use Fibers or Streamline wisely and still know what’s going on when you read the code a year later. If the benefit is greater than the cost, then go for it.
When we are discussing things like this, it’s important to realize that we’re artists discussing matters of taste. If everyone agreed, then it would mean it wasn’t interesting. Maybe we should be less interested in convincing people of stuff, and more interested in just writing programs that do interesting things.


黒の手番です。21 はどう動かしますか？
19-14:25pt
pips Black=158 White=99
(CorrectAnswer= 0/0, ErrorScore= 0)
1. 6/4 5/4 eq:-0.248 46.12% (G: 8.77% B:0.33%) 53.88% (G:14.45% B:0.28%) 2. 10/9 10/8* eq:-0.309 (-0.061) 45.64% (G:12.00% B:0.53%) 54.36% (G:20.60% B:0.46%) 3. 10/8* 8/7 eq:-0.384 (-0.136) 44.26% (G:11.37% B:0.53%) 55.74% (G:22.88% B:0.50%) 4. 10/8* 6/5 eq:-0.467 (-0.219) 42.26% (G:10.35% B:0.47%) 57.74% (G:21.83% B:0.51%) 5. 10/8* 5/4 eq:-0.736 (-0.488) 42.62% (G:10.31% B:0.26%) 57.38% (G:32.50% B:1.22%)


Whatever your reason for going on to Higher Education, we are sure to have a course that meets your needs. Maybe you want a university education qualification to build a new career, or to move to that next step on an existing career path? Studying for a formal higher education qualification can increase your employability, your lifetime earnings and could help you find a fulfilling job.
| Course | UCAS Code | Entry Requirments |
|---|


“Aho buddhā aho dhammā,
aho no satthu sampadā;
Yattha etādisaṁ dhammaṁ,
sāvako sacchikāhiti.
Oh, the Buddhas! Oh, the Dhammas!
Oh, the accomplishments of the Teacher!
Here a disciple may realize
such a teaching for themselves.
Asaṅkheyyesu kappesu,
sakkāyādhigatā ahū;
Tesamayaṁ pacchimako,
carimoyaṁ samussayo;
Jātimaraṇasaṁsāro,
natthi dāni punabbhavo”ti.
… Kumārakassapo thero ….
Through countless eons
they obtained individual identities.
This is their last,
their very final body
in the transmigration through births and deaths;
now there are no more future lives.


{% extends "global/Page.html" %} {% load otree %} {% block title %} Demographics {% endblock %} {% block content %}
To start, please answer the following questions:


C source code and R wrappers for the tth/ttm TeX to HTML/MathML translators.
| Version: | 4.3-2-1 |
| Depends: | R (≥ 2.14.0) |
| Published: | 2016-04-15 |
| Author: | Ian H. Hutchinson [aut] (author of tth/ttm C sources), Friedrich Leisch [aut, cre] (author of R wrappers to tth/ttm), Achim Zeileis [aut] (author of R wrappers to tth/ttm) |
| Maintainer: | Friedrich Leisch <Friedrich.Leisch at R-project.org> |
| License: | GPL-2 |
| NeedsCompilation: | yes |
| Materials: | README NEWS |
| In views: | ReproducibleResearch |
| CRAN checks: | tth results |
| Reference manual: | tth.pdf |
| Package source: | tth_4.3-2-1.tar.gz |
| Windows binaries: | r-devel: tth_4.3-2-1.zip, r-release: tth_4.3-2-1.zip, r-oldrel: tth_4.3-2-1.zip |
| OS X binaries: | r-release: tth_4.3-2-1.tgz, r-oldrel: tth_4.3-2-1.tgz |
| Old sources: | tth archive |
| Reverse suggests: | exams |
Please use the canonical form https://CRAN.R-project.org/package=tth to link to this page.


[default] element index
Package indexes
Fields
Widgets
All elements
a
b
c
d
e
f
g
h
i
m
n
o
p
s
t
v
w
_
_
top
__construct
File::__construct()
in types.php
__construct
Phorm::__construct()
in phorms.php
__construct
Image::__construct()
in types.php
__toString
Phorm::__toString()
in phorms.php
Returns a string of all of the form's fields' HTML tags as a table.
a
top
as_list
Phorm::as_list()
in phorms.php
Returns the form fields as a series of list items. Does not include the list's opening and closing tags.
as_table
Phorm::as_table()
in phorms.php
Returns the form fields as a series of HTML table rows. Does not include the table's opening and closing tags, nor the table's tbody tags.
b
top
$bound
Phorm::$bound
in phorms.php
True when the form has user-submitted data.
$bytes
File::$bytes
in types.php
The size of the file in bytes.
c
top
$clean
Phorm::$clean
in phorms.php
Private storage for cleaned field values.
check_if_bound
Phorm::check_if_bound()
in phorms.php
Returns true if any of the field's names exist in the source data (or
cleaned_data
Phorm::cleaned_data()
in phorms.php
Returns an associative array of the imported form data on a bound, valid form. Returns null if the form is not yet bound or if the form is not valid.
clean_data
Phorm::clean_data()
in phorms.php
Processes each field's data in turn, calling it's get_value method to access its "cleaned" data.
close
Phorm::close()
in phorms.php
Returns the form's closing HTML tag.
d
top
$data
Phorm::$data
in phorms.php
A copy of the superglobal data array merged with any default field values provided during class instantiation.
define_fields
Phorm::define_fields()
in phorms.php
Abstract method that sets the Phorm's fields as class attributes.
e
top
$error
File::$error
in types.php
An error message, if there was an error uploading the file.
$errors
Phorm::$errors
in phorms.php
Private storage to collect error messages. Stored as $field_name => $msg.
f
top
$fields
Phorm::$fields
in phorms.php
Private field storage.
File
File
in types.php
File
find_fields
Phorm::find_fields()
in phorms.php
Internal method used by the constructor to find all of the fields in the class after the child's 'define_fields' is called. Returns an array of the field instances.
g
top
GET
Phorm::GET
in phorms.php
Causes the form to use $_GET as its data source.
getIterator
Phorm::getIterator()
in phorms.php
Returns an iterator that returns each field instance in turn.
get_errors
Phorm::get_errors()
in phorms.php
Returns the list of errors.
h
top
$height
Image::$height
in types.php
The image's height in pixels.
has_errors
Phorm::has_errors()
in phorms.php
Returns true if the form has errors.
i
top
Image
Image
in types.php
Image
is_bound
Phorm::is_bound()
in phorms.php
Returns true if the form is bound (i.e., there is data in the appropriate
is_valid
Phorm::is_valid()
in phorms.php
Returns true if all fields' data pass validation tests.
m
top
$method
Phorm::$method
in phorms.php
The form's method. Determines which superglobal array to use as the data source.
$multi_part
Phorm::$multi_part
in phorms.php
If true, $_FILES is included in the form data. Makes possible file fields.
move_to
File::move_to()
in types.php
Moves the files from the temporary directory to another location. The new file will have the original file's name.
n
top
$name
File::$name
in types.php
The name of the file.
o
top
open
Phorm::open()
in phorms.php
Returns the form's opening HTML tag.
p
top
Phorm
Phorm
in phorms.php
Phorm
phorms.php
phorms.php
in phorms.php
POST
Phorm::POST
in phorms.php
Causes the form to use $_POST as its data source.
s
top
set_data
Phorm::set_data()
in phorms.php
Sets the value of each field from the proper superglobal data array.
t
top
$tmp_name
File::$tmp_name
in types.php
The path of the temporary file.
$type
File::$type
in types.php
The mime type of the file.
types.php
types.php
in types.php
v
top
$valid
Phorm::$valid
in phorms.php
Memoized return value of the initial is_valid call.
w
top
$width
Image::$width
in types.php
The image's width in pixels.
a
b
c
d
e
f
g
h
i
m
n
o
p
s
t
v
w
_


data.head()
We will explore the data first and will try to modify the variables that make more sense in the dataset. Let's first look at the bar graphs of variables 'Education' and 'Marital_Status'.
barplot('Education')
barplot('Marital_Status')
Bar graphs reveal that some classes in columns 'Education' and 'Marital_Status' occur far more less frequently than its counterparts. So, we can bin these less frequent observations into a new value.
Binning reduces the final number of columns in the dataframe without much loss of information.
The 'Age' column is similarly binned into 6 factors as follows:
Age>=20 and Age<30 = 1
Age>=30 and Age<40 = 2
Age>=40 and Age<50 = 3
Age>=50 and Age<60 = 4
Age>=60 and Age<70 = 5
Age>=70 and Age<81 = 6
The column 'Credit_Limit' can be seen is skewed towards the right. To handle this skewness the variable is transformed using a log transformation, which makes it evenly distributed.
The histogram that are plotted below are good visualiztions of the original skewness and normalization after transformation.
sns.distplot(data['Credit_Limit'], bins=15);
sns.distplot(np.log(data['Credit_Limit']+1), bins=15); ## After applying Log transformation
The following step replaces, imputes and performs one-hot encoding using the ReplaceImputeEncode class.
Also, log transformation is applied on the 'Credit_Limit' column to deal with its skewness.
Now to improve the quality of prediction, we have to deal with columns which have a high correlation amongst themselves.
To check which all columns have high correlation we plot the Pearson correlation matrix.
CorrelationPlot(encoded_df)
Looking at the correlation between the variabls using the correlation matrix, we can see that following variables seem to be correlated to each other :
So, we can safely drop the above variables without affected the accuracy of the predictive models.
CorrelationPlot(encoded_df1)
plt.title('Pearson Correaltion of Features from final DataFrame')
plt.show();
Now, we will first perform cross validation on Logistic Regression, Random Forest, Decision Tree and Neural Networks to optimize the hyperparameters.
Since, the target variable in our dataset is unbalanced with 5000 default cases as opposed to 25000 non-defaulters, we will use class_weight='Balanced' in Logistic Regression, Random Forest and Decision Tree and this can be seen in the cross validated result of these three models below.
We will cross-validate Logistic Regression using two different solvers i.e 'sag' and 'newton-cg' and see which solver reach the local minima first.
In Random Forest, we will cross-validate using different number of tree and maximum number of features.
In Decision tree, we will identify the best max_depth.
And in Neural networks, we will cross-validate on different number of hidden layers and perceptrons.
## Splitting data into 70% training and 30% validation
X_train, X_validate, y_train, y_validate = train_test_split(X,y,test_size = 0.3, random_state=7)
## Cross-validation on Logistic Regression for two different Class weights:
LR()
## Validating on the test data
print("\nTraining Data\nRandom Selection of 70% of Original Data")
logreg.display_binary_split_metrics(lgr_train, X_train, y_train, \
X_validate, y_validate)
## Cross-validation on Random Forest for two different trees and Max number of features
RF()
## Validating on the test data
print("\nTraining Data\nRandom Selection of 70% of Original Data")
DecisionTree.display_binary_split_metrics(rfc_train, X_train, y_train, \
X_validate, y_validate)
DecisionTree.display_importance(rfc, encoded_df1.columns)
## Cross-validation on Decision Tree with different max_depth
DTC()
## Validating on the test data
print("\nTable of the metrics for 70/30 split")
DecisionTree.display_binary_split_metrics(dtc_train, X_train,y_train,X_validate, y_validate)
dtc_graph()
## Cross validation on Neural Networks with different number of hidden layers and perceptrons.
NN()
## Validating on the test data.
print("\nTable of the metrics for 70/30 split")
NeuralNetwork.display_binary_split_metrics(bestfnn, X_train, y_train,\
X_validate, y_validate)
roc_curves()
From the ROC curve above, we can see that Random Forest has the highest Area under the curve followed by Decision tree an logistic regression.
We predicted on 4 different models i.e. Logistic Regression, Random Forest, Decision trees and Neural Networks.


{% extends "base_generic.html" %} {% block pagetitle %}The Graveyard, Home of Domains Past{% endblock %} {% block content %}
Visit domains from the past who are now at rest:
| Domain | Health | DNS Flags | Cause of Death | |||
|---|---|---|---|---|---|---|
| {{ domain.name }} | {% if domain.health_status.health_status == "Healthy" %}{{ domain.health_status }} | {% else %}{{ domain.health_status }} | {% endif %} {% ifequal domain.health_dns "Healthy" %}{{ domain.health_dns }} | {% else %}{{ domain.health_dns }} | {% endifequal %} {% if domain.burned_explanation %}{{ domain.burned_explanation }} | {% else %}No reason given - burned. | {% endif %}
There are no domains marked as burned yet. Good work?
{% endif %} {% load static %}


Class CustomTriggerManager
Inheritance
Namespace: MonsterTrainModdingAPI.Managers
Assembly: MonsterTrainModdingAPI.dll
Syntax
public class CustomTriggerManager : Object
Constructors
CustomTriggerManager()
Declaration
public CustomTriggerManager()
Methods
ApplyCardTriggers(CardTrigger, CardState, Boolean, Int32, Boolean, CharacterState, Action)
A general function used to Apply a Card Trigger in different ways, dependant on parameters
Declaration
public static void ApplyCardTriggers(CardTrigger cardTrigger, CardState playedCard, bool fireAllMonsterTriggersInRoom = false, int roomIndex = -1, bool ignoreDeadInTargeting = true, CharacterState triggeredCharacter = null, Action cardTriggerFiredCallback = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CardTrigger | cardTrigger | CardTrigger to be Applied |
| CardState | playedCard | Card to apply triggers to |
| System.Boolean | fireAllMonsterTriggersInRoom | Whether Apply Card Triggers should fire on monster's Instead, requires Trigger to have an associated character trigger |
| System.Int32 | roomIndex | Room to fire triggers in, -1 defaults to selected room |
| System.Boolean | ignoreDeadInTargeting | Whether effects applied by the trigger should ignore dead in targetting |
| CharacterState | triggeredCharacter | Character used to determine how many times Card Trigger should be applied |
| System.Action | cardTriggerFiredCallback | Action to take after applying trigger |
AssociateTriggers(CardTrigger, CharacterTrigger)
Associates two triggers with eachother allowing MT to cast from one trigger to another
Declaration
public static void AssociateTriggers(CardTrigger cardTrigger, CharacterTrigger characterTrigger)
Parameters
| Type | Name | Description |
|---|---|---|
| CardTrigger | cardTrigger | CardTrigger to be Associated |
| CharacterTrigger | characterTrigger | CharacterTrigger to be Associated |
FireCardTriggers(CardTrigger, CardState, Int32, Boolean, CharacterState, Int32, Action)
A function used to fire a card trigger, causing the effects of the corresponding trigger on the playedCard to be fired.
Declaration
public static void FireCardTriggers(CardTrigger cardTrigger, CardState playedCard, int roomIndex = -1, bool ignoreDeadInTargeting = true, CharacterState triggeredCharacter = null, int fireCount = 1, Action cardTriggerFiredCallback = null)
Parameters
| Type | Name | Description |
|---|---|---|
| CardTrigger | cardTrigger | CardTrigger to be Fired |
| CardState | playedCard | Card to Fire Trigger on |
| System.Int32 | roomIndex | Room to fire trigger in, -1 is current room |
| System.Boolean | ignoreDeadInTargeting | Whether effect should ignore dead in targeting |
| CharacterState | triggeredCharacter | Character used for applying effects |
| System.Int32 | fireCount | how many times the trigger fires |
| System.Action | cardTriggerFiredCallback | Action to call after function is called |
GetAssociatedCardTrigger(CharacterTriggerData.Trigger)
Gets the Associated Card Trigger from a Character Trigger or null
Declaration
public static Nullable<CardTriggerType> GetAssociatedCardTrigger(CharacterTriggerData.Trigger trigger)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterTriggerData.Trigger | trigger | Trigger to get Associate for |
Returns
| Type | Description |
|---|---|
| System.Nullable<CardTriggerType> |
GetAssociatedCharacterTrigger(CardTriggerType)
Gets the Associated Character Trigger from a Card Trigger or null
Declaration
public static Nullable<CharacterTriggerData.Trigger> GetAssociatedCharacterTrigger(CardTriggerType trigger)
Parameters
| Type | Name | Description |
|---|---|---|
| CardTriggerType | trigger | Trigger to get Associate for |
Returns
| Type | Description |
|---|---|
| System.Nullable<CharacterTriggerData.Trigger> |
QueueAndRunTrigger(CharacterTrigger, CharacterState, Boolean, Boolean, CharacterState.FireTriggersData, Int32)
Used to Queue a Character Trigger then runs the trigger queue as though it was a key phase of combat.
Declaration
public static void QueueAndRunTrigger(CharacterTrigger charTrigger, CharacterState character, bool canAttackOrHeal = true, bool canFireTriggers = true, CharacterState.FireTriggersData fireTriggersData = null, int triggerCount = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterTrigger | charTrigger | CharacterTrigger to be queued |
| CharacterState | character | Character to Run the Trigger On |
| System.Boolean | canAttackOrHeal | Whether the Character being triggered can Attack or be Healed |
| System.Boolean | canFireTriggers | Whether the trigger can currently be fired |
| CharacterState.FireTriggersData | fireTriggersData | Additional Parameters for controlling how the trigger is fired |
| System.Int32 | triggerCount | Number of Times to Trigger |
QueueAndRunTrigger(CharacterTrigger, CharacterState[], Boolean, Boolean, CharacterState.FireTriggersData, Int32)
Used to Queue a Character Trigger then runs the trigger queue as though it was a key phase of combat.Queues and Runs a Trigger
Declaration
public static void QueueAndRunTrigger(CharacterTrigger charTrigger, CharacterState[] characters, bool canAttackOrHeal = true, bool canFireTriggers = true, CharacterState.FireTriggersData fireTriggersData = null, int triggerCount = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterTrigger | charTrigger | CharacterTrigger to be queued |
| CharacterState[] | characters | Characters to Run the Trigger On |
| System.Boolean | canAttackOrHeal | Whether the Character being triggered can Attack or be Healed |
| System.Boolean | canFireTriggers | Whether the trigger can currently be fired |
| CharacterState.FireTriggersData | fireTriggersData | Additional Parameters for controlling how the trigger is fired |
| System.Int32 | triggerCount | Number of Times to Trigger |
QueueAndRunTrigger<Manager>(CharacterTrigger, Boolean, Boolean, CharacterState.FireTriggersData, Int32)
Used to Queue a Character Trigger then runs the trigger queue as though it was a key phase of combat.Queues and Runs a Trigger
Declaration
public static void QueueAndRunTrigger<Manager>(CharacterTrigger charTrigger, bool canAttackOrHeal = true, bool canFireTriggers = true, CharacterState.FireTriggersData fireTriggersData = null, int triggerCount = 1)
where Manager : IProvider, ICharacterManager
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterTrigger | charTrigger | CharacterTrigger to be queued |
| System.Boolean | canAttackOrHeal | Whether the Character being triggered can Attack or be Healed |
| System.Boolean | canFireTriggers | Whether the trigger can currently be fired |
| CharacterState.FireTriggersData | fireTriggersData | Additional Parameters for controlling how the trigger is fired |
| System.Int32 | triggerCount | Number of Times to Trigger |
Type Parameters
| Name | Description |
|---|---|
| Manager | Type of Manager to Queue and Run Triggers to |
QueueTrigger(CharacterTrigger, CharacterState, Boolean, Boolean, CharacterState.FireTriggersData, Int32)
Used to queue a Character Trigger to be automatically executed during key phases of combat. If you need to ensure that your trigger is executed at other times, please use QueueAndRunTrigger with a coroutine.
Declaration
public static void QueueTrigger(CharacterTrigger charTrigger, CharacterState character, bool canAttackOrHeal = true, bool canFireTriggers = true, CharacterState.FireTriggersData fireTriggersData = null, int triggerCount = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterTrigger | charTrigger | CharacterTrigger to be queued |
| CharacterState | character | Character to Queue the Trigger On |
| System.Boolean | canAttackOrHeal | Whether the Character being triggered can Attack or be Healed |
| System.Boolean | canFireTriggers | Whether the trigger can currently be fired |
| CharacterState.FireTriggersData | fireTriggersData | Additional Parameters for controlling how the trigger is fired |
| System.Int32 | triggerCount | Number of Times to Trigger |
QueueTrigger(CharacterTrigger, CharacterState[], Boolean, Boolean, CharacterState.FireTriggersData, Int32)
Used to queue a Character Trigger to be automatically executed during key phases of combat. If you need to ensure that your trigger is executed at other times, please use QueueAndRunTrigger with a coroutine.
Declaration
public static void QueueTrigger(CharacterTrigger charTrigger, CharacterState[] characters, bool canAttackOrHeal = true, bool canFireTriggers = true, CharacterState.FireTriggersData fireTriggersData = null, int triggerCount = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterTrigger | charTrigger | CharacterTrigger to be queued |
| CharacterState[] | characters | Characters to Queue trigger on |
| System.Boolean | canAttackOrHeal | Whether the Character being triggered can Attack or be Healed |
| System.Boolean | canFireTriggers | Whether the trigger can currently be fired |
| CharacterState.FireTriggersData | fireTriggersData | Additional Parameters for controlling how the trigger is fired |
| System.Int32 | triggerCount | Number of Times to Trigger |
QueueTrigger<Manager>(CharacterTrigger, Boolean, Boolean, CharacterState.FireTriggersData, Int32)
Used to queue a Character Trigger to be automatically executed during key phases of combat. If you need to ensure that your trigger is executed at other times, please use QueueAndRunTrigger with a coroutine.
Declaration
public static void QueueTrigger<Manager>(CharacterTrigger charTrigger, bool canAttackOrHeal = true, bool canFireTriggers = true, CharacterState.FireTriggersData fireTriggersData = null, int triggerCount = 1)
where Manager : ICharacterManager, IProvider
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterTrigger | charTrigger | CharacterTrigger to be queued |
| System.Boolean | canAttackOrHeal | Whether the Character being triggered can Attack or be Healed |
| System.Boolean | canFireTriggers | Whether the trigger can currently be fired |
| CharacterState.FireTriggersData | fireTriggersData | Additional Parameters for controlling how the trigger is fired |
| System.Int32 | triggerCount | Number of Times to Trigger |
Type Parameters
| Name | Description |
|---|---|
| Manager | Type of Manager to Queue and Run Triggers to |
RunTriggerQueueRemote()
Remotely Runs the Trigger Queue of the CombatManager
Declaration
public static void RunTriggerQueueRemote()


URL Shortener
- I can pass a URL as a parameter and I will receive a shortened URL in the JSON response.
- If I pass an invalid URL that doesn't follow the valid http://www.example.com format, the JSON response will contain an error instead.
- When I visit that shortened URL, it will redirect me to my original link.
Usage
http://www.tosp.net.au:3001/new/http://www.freecodecamp.org
http://www.tosp.net.au:3001/<short_url>