AUTOFS_LDAP_AUTH.CONF
Section: File Formats (5)Updated: 19 Feb 2010
Index Return to Main Contents
NAME
autofs_ldap_auth.conf - autofs LDAP authentication configurationDESCRIPTION
LDAP authenticated binds, TLS encrypted connections and certification may be used by setting appropriate values in the autofs authentication configuration file and configuring the LDAP client with appropriate settings. The default location of this file is /etc/autofs_ldap_auth.conf. If this file exists it will be used to establish whether TLS or authentication should be used. An example of this file is:
-
<?xml version="1.0" ?> <autofs_ldap_sasl_conf usetls="yes" tlsrequired="no" authrequired="no" authtype="DIGEST-MD5" user="xyz" secret="abc" />
If TLS encryption is to be used the location of the Certificate Authority certificate must be set within the LDAP client configuration in order to validate the server certificate. If, in addition, a certified connection is to be used then the client certificate and private key file locations must also be configured within the LDAP client.
OPTIONS
This files contains a single XML element, as shown in the example above, with several attributes.- The possible attributes are:
- usetls="yes"|"no"
- Determines whether an encrypted connection to the ldap server should be attempted.
- tlsrequired="yes"|"no"
- This flag tells whether the ldap connection must be encrypted. If set to "yes", the automounter will fail to start if an encrypted connection cannot be established.
- authrequired="yes"|"no"|"autodetect"|"simple"
- This option tells whether an authenticated connection to the ldap server is required in order to perform ldap queries. If the flag is set to yes, only sasl authenticated connections will be allowed. If it is set to no then authentication is not needed for ldap server connections. If it is set to autodetect then the ldap server will be queried to establish a suitable sasl authentication mechanism. If no suitable mechanism can be found, connections to the ldap server are made without authentication. Finally, if it is set to simple, then simple authentication will be used instead of SASL.
- authtype="GSSAPI"|"LOGIN"|"PLAIN"|"ANONYMOUS"|"DIGEST-MD5|EXTERNAL"
-
This attribute can be used to specify a preferred authentication mechanism.
In normal operations, the automounter will attempt to authenticate to the
ldap server using the list of supportedSASLmechanisms obtained from the
directory server. Explicitly setting the authtype will bypass this selection
and only try the mechanism specified. The EXTERNAL mechanism may be used to
authenticate using a client certificate and requires that authrequired
set to "yes" if using SSL or usetls, tlsrequired and authrequired all set to
"yes" if using TLS, in addition to authtype being set to EXTERNAL.
If using authtype EXTERNAL two additional configuration entries are required:
external_cert="<client certificate path>"
This specifies the path of the file containing the client certificate.
external_key="<client certificate key path>"
This specifies the path of the file containing the client certificate key.
These two configuration entries are mandatory when using the EXTERNAL method as the HOME environment variable cannot be assumed to be set or, if it is, to be set to the location we expect.
- user="<username>"
- This attribute holds the authentication identity used by authentication mechanisms that require it. Legal values for this attribute include any printable characters that can be used by the selected authentication mechanism.
- secret="<password>"
- This attribute holds the secret used by authentication mechanisms that require it. Legal values for this attribute include any printable characters that can be used by the selected authentication mechanism.
- encoded_secret="<base64 encoded password>"
- This attribute holds the base64 encoded secret used by authentication mechanisms that require it. If this entry is present as well as the secret entry this value will take precedence.
- clientprinc="<GSSAPI client principal>"
-
- When using GSSAPI authentication, this attribute is consulted to determine the principal name to use when authenticating to the directory server. By default, this will be set to "autofsclient/<fqdn>@<REALM>.
- credentialcache="<external credential cache path>"
- When using GSSAPI authentication, this attribute can be used to specify an externally configured credential cache that is used during authentication. By default, autofs will setup a memory based credential cache.
SEE ALSO
auto.master(5),AUTHOR
This manual page was written by Ian Kent<EMAIL_ADDRESS>Index
This document was created by man2html, using the manual pages.
Time: 05:33:59 GMT, December 24, 2015


Bring the YouView user experience into the modern day, utalizing a more cutting edge back end to incorperate the future of BT and TalkTalk TV packages for their customers
BT / TalkTalk
2016-2019
Product Designer
Youview was launched in 2012 and the user interface was starting to
look dated when the original concept of a redesign came around. The project was worked on for a
long time behind the scenes before release and is a complete rebuild
from the ground up incorperating new technologies as well as a fresh design ethos.
I was at various times placed in every single area of this project whilst also retaining
responsibility for leading
agile teams spanning the Settings, Setup, Help and Discover areas.
Every box since release had to support the next generation project
A philosophy that different hardware could have different levels of software to enable the higher end devices to have a more robust feature set
The whole project would be rewritten from Flash into the more recent HTML5 to allow easy in updating the software for fast iterative changes
Every box since release had to support the next generation project
A philosophy that different hardware could have different levels of software to enable the higher end devices to have a more robust feature set
The whole project would be rewritten from Flash into the more recent HTML5 to allow easy in updating the software for fast iterative changes
We reworked the navigation across all areas of the User Interface. The goal was to create easy
navigation which allowed users to find the content that they were currently paying for. Feedback
from previous designs showed that users had content available for free that they were just
unaware they had access to.
Since the first launch of the platform Tv technology had
also dramatically changed with an increase in both TV sizes and display resolution since the
original launch. We retained the horizontal scroll people expected of the product but iterated
on the design principles to introduce more features to users whilst retaining the ability to
grow in scale and size as new features were introduced.
We worked hard to map out journeys that allowed the user to discover new content whilst also
seeing the films and tv shows they love.
As the introduction to the service, we wanted the Set Up journeys to be an engaging way to
show the benefits of the platform to the user.
I worked with the Creative Director and an external agency to create a short marketing video
which would play as the platform was searching for TV channels as a blank screen would not
be an engaging experience.
The setup journey also consisted of a subset of educational videos, on how a user could
connect the set-top box to their internet or add premium channels. Working with a freelance
motion designer, a collection of animated videos were created. These had to sit harmoniously
inside the UI design that we were created to reinforce the branding of the platform.
As the project was primarily used to power the TV service by both BT and TalkTalk we also
created bespoke themed interfaces for both these subsets of users, incorporating corporate
iconography, branding and typography.
We wanted to ensure that existing customers of this service understood that the product in
their homes was related to the billing that they paid, but we also wanted to retail the
YouView branding and ecosystem.
We also had to have early previews into any branding changes both BT and TalkTalk may
undertake in the future. By utilizing SVG in the main areas of the UI it allowed me to work
directly with developers to tweak and adjust the branding instantly for stakeholder feedback
whilst presenting.
The whole design of the product was also revamped, allowing the content available on the service to shine. The opportunity for content providers to entice new viewers with imagery dynamically catered to the platform. By basing the interface on this content imagery it also allowed people to easily find recognisable content that relates to their viewing history and interests. This content-driven approach filtered its way across the whole UI so that favourite shows & films were always recognisable further throughout navigation
Here you can see how the visual content improved across the device, giving users the ability to instantly recognise the content they enjoy to watch. The imagery also allowed users to see more content on the screen at one time, reducing the need to scroll through more items than necessary. We kept the iconography the same with the change so that existing users did not have to relearn a new visual language. An extra additional benefit to using imagery was creating an easier to digest page for people with additional needs, as words were not the only way for users to learn the content
As the imagery is provided by the external third party companies, the challenge with
incorporating visual assets was in the way that we present information to the end
user.
There would have been no point in using programme images if the vital
information was not clear. We spent a lot of time perfecting this, ending up layering
gradients and visual effects to ensure legibility of text
We created a Sketch based design system utilizing the software’s capabilities in crafting components with multiple overrides to ensure consistency across the design team and to help with a handoff to different developers, who might not always be based in the same location. This set of shared components that gave every designer on the project the ability to craft experiences following the project guidelines with the same grid, layout guidelines and design materials
YouView is powered by its stakeholders and gives its users the wide range of content available to them. From the BBC to Channel 4 and Internet-powered channels such as BT sport, it was all brought to the forefront for the user. We made sure to bring this content front and centre so the users could find the best content instantly
Content is king when it relates to viewing habits so by utilising the visual approach we were given the ability to discover content a much easier practise. Imagery supplied by the content teams led to a much higher conversion rate between a user searching for a TV show and them playing the content. The streamlined navigation also gave the user the ability to play personalised content with only two button clicks from the main menu, reaffirming the ease of the interactions
Working with shareholders and partners we were able to integrate content from a variety of
sources into the metadata of the products.
The advantage here for the user is that they no longer had to open a third-party platform to
see the content they are paying for.
This worked across all the major partners in the interface and ensured that it was simple
for a user to find all the content they pay for in one place
By allowing third party content on the Menu sections of the UI saw a considerable growth in
users clicking on content, with great feedback in User Testing sessions. It was also noted
how the tiles could in the future be customised to a user’s preferences for the content they
watch
The most important aspect for the user was the ability to see the content they love in the least amount of steps. The UI was redesigned to be a much more visible design, no more reading a show name when there is a big content image. This is turn makes life much easier to find your favourites
We wanted to ensure that our own bias as designers was not affecting the project so we made
use of as much user testing as possible. We ensured to test as much as possible, usually
consisting of multiple variant testing, bringing actual users in house and A/B testing with
live software being pushed to a subset of users.
By creating interactive prototypes using Framer, we were able to create a version of the
interface that could be iteratively tweaked in front of the user for instant feedback and
comments.
This iterative feedback then helped to fuel the decisions made alongside the product
roadmap.
Alongside user testing, we also utilised live anonymous user
information as they used the product. This allowed us to track where users were interacting
with the interface and even into specifics regarding time durations inside journeys and
clicks to get to their final destinations.
This information proved invaluable into
tweaking
our journeys to customer expectations whilst also directing the success metrics for new
features being launched
The next generation redesign of the YouView software was seen as a product worthy of recognition and I was lucky enough to be part of the team which was nominated and won a variety of awards
‘International Contribution to User Experience’
'Best interactive TV technology or application'
‘Best TV/Video Service Update or Launch.'
‘People's Choice Award'
'Best TV Platform'
‘Best Cloud-Based Video Service'
‘TV, Film and Broadcasting Technology of the Year’
‘Advanced TV Innovation of the Year’


Expression of carrot coding and noncoding RNAs. ( A) PCA analysis of the global gene expression of the 12 evaluated libraries (three replicates for each color-phenotype and tissue type combination). ( B) Differentially expressed genes (up- and down-regulated) between purple and orange carrots (Bonferroni’s adjusted p value < 0.01) distributed by coding and noncoding transcripts.


Resolved to create and keep up a positive contrast to your staffing needs, we at Conduxit, are a headhunting and People recruitment firm of high notoriety and affirmation. We have picked up this distinguished by giving praiseworthy our brother's administration and able representatives to assorted corporates. We are in the matter of viably understanding your Manpower necessities and building trusting connections. Separated from conventional practices to source applicants (like promoting in daily papers), we likewise join imaginative intends to get right experts. Our specialists power the force of innovation built recruitment and center with respect to online media to verify that our customers get the most suitable applicants for their association.


DojoX Charting Theme Tester
Choose a theme from the list below; the charts will be rendered using it.
Available themes:


Important
Clarification on cost projections
As a non-profit research project, Project Jupyter does not offer, recommend, or sell cloud deployment services for JupyterHub.
The information in this section is offered as guidance as requested by our users. We caution that costs can vary widely based on providers selected and your use cases.
Below are several links to cost estimators for cloud providers:
Google Cloud Platform cost calculator
Amazon AWS cost calculator
Microsoft Azure cost claculator
Cost estimates depend highly on your deployment setup. Several factors that significantly influence cost estimates, include:
Computational resources provided to users
Number of users
Usage patterns of users
Memory (RAM) makes up the largest part of a cost estimate. More RAM means that your users will be able to work with larger datasets with more flexibility, but it can also be expensive.
Persistent storage for users, if needed, is another element that will impact the cost estimate. If users don’t have persistent storage, then disks will be wiped after users finish their sessions. None of their changes will be saved. This requires significantly fewer storage resources, and also results in faster load times.
For an indicator of how costs scale with computational resources, see the Google Cloud pricing page.
The number of users has a direct relationship to cost estimates. Since a deployment may support different types of users (i.e. researchers, students, instructors) with varying hardware and storage needs, take into account both the type of users and the number per type.
Another important factor is what usage pattern your users will have. Will they all use the JupyterHub at once, such as during a large class workshop? will users use JupyterHub at different times of day?
The usage patterns and peak load on the system have important implications for the resources you need to provide. In the future JupyterHub will have auto-scaling functionality, but currently it does not. This means that you need to provision resources for the maximum expected number of users at one time.
Here are a few examples that describe different use cases and the amount of resources used by a particular JupyterHub implementation. There are many factors that go into these estimates, and you should expect that your actual costs may vary significantly under other conditions.
The Data 8 course at UC Berkeley used a JupyterHub to coordinate all course material and to provide a platform where students would run their code. This consisted of many hundreds of students, who had minimal requirements in terms of CPU and memory usage. Ryan Lovett put together a short Jupyter notebook estimating the cost for computational resources depending on the student needs.


Your participation in {{ club }} so far. The more you attend, the greater your participation.
{{ att_percent }}%
MEETINGS ATTENDED
Number of meetings that you have attended for the period. You attended {{ meets_attended }} out of {{ meets_total}} total meetings.
{{ part_percent }}%
PARTICIPATIONS PERCENTAGE
Percentage of meetings in which you participated in table topics, speeches, evaluations or big three roles. You participated in {{ part_count }} out of {{ meets_attended }} meetings you attended.
{{ tt_percent }}%
TABLE TOPICS PARTICIPATION
Percentage of meetings in which you participated in Table Topics. You participated in table topics in {{ tt_count }} out of {{ meets_attended}} meetings you attended.
{{ speech_count }}
SPEECHES DELIVERED
Total number of speeches that you have delivered.
{{ evaluation_count }}
EVALUATIONS DELIVERED
Total number of evaluations you have done for the other speakers.


Select your Character:
Professor Plum
Miss Scarlet
Colonel Mustard
Mrs. Peacock
Mr. Green
Mrs. White
Your character is:
Select a room or hallway to move to:
Study
Hall
Lounge
Library
Billiard Room
Dining Room
Conservatory
BallRoom
Kitchen
Hall-Study
Hall-Lounge
Library-Study
Billiard room-Hall
Dining room-Lounge
Billiard room-Library
Billiard room-Dining room
Conservatory-Library
Ballroom-Billiard room
Dining room-Kitchen
Ballroom-Conservatory
Ballroom-Kitchen
Move to room:
End Turn


Kanye West wants to build amphitheater on his Wyoming ranch
CODY, Wyo. (AP) - Officials in Wyoming have received a building permit application from Kanye West for a proposed amphitheater on property owned by the rapper.
West recently announced that he plans to move the headquarters of his shoe and clothing company, Adidas Yeezy, to Cody.
He also wants to build a 70,000-square-foot (6,500-square-meter) amphitheater on his 4,000-acre (1,600-hectare) ranch.
TOP STORIES
Franklin Graham calls on nation to pray for Trump as impeachment effort gains speed
Nancy Pelosi goes for slam dunk -- and crashes to court
Skeptics chuckle as climate activist Greta Thunberg sets sail for Europe on 'plastic yacht'
The Cody Enterprise reports the Park County Planning and Zoning Commission plans to discuss the proposed “West Meditation Space Large Impact Structure” on Tuesday.
West has worked on or recorded his past three albums in Wyoming, including the recently released “Jesus Is King.”
The planning commission will recommend whether county commissioners should approve the project.
Cody, a town with 10,000 people, was named for wild West showman William Frederick “Buffalo Bill” Cody.
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


[gecode-users] Scheduling
Guido Tack
tack at gecode.org
Wed Mar 13 11:29:07 CET 2013
Hi,
there's no direct way to model this using the scheduling constraints in Gecode. On workaround I could imagine would be to make an array x of all start and end times, and then use the "sort" constraint to produce a sorted array y. On a unary resource, this should mean that the start and end times in y are still in the right order, and you can post the constraint y[i+1]-y[i] <= Tmax for i in 1,3,5,7...
Hope this helps,
Guido
On 13/03/2013, at 20:30 , Mitrych Jiří <Jiri.Mitrych at rtscs.cz> wrote:
> Hi,
>
> I have following problem to solve. I have one resource and some tasks with starting times and durations. The constraint for scheduling is unary, it ensures no overlaying in time. To that point it is clear for me. But what to do, when I want to constrain the time gap between two consequential tasks not bigger then let’s say Tmax? The complication is, that consequetial tasks from time’s point of view haven’t got fixed positions in array, so I don’t know, between which elements of array I should make a constraint for that Tmax.
>
> Best regards
> Jiri Mitrych
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
--
Guido Tack,
http://www.csse.monash.edu/~guidot/
More information about the users
mailing list


Prototype Site review
UX Designer: Rafal Drewnowski
UX Designer: Katrina Doyle
Site review journey - work in progress
UX Designer: Rafal Drewnowski
UX Designer: Katrina Doyle
Site review journey - work in progress


When including a header file (libdill.h
or libdillimpl.h
) you can define following macros:
DILL_DISABLE_SOCKETS
: Don't declare socket-related symbols.DILL_DISABLE_RAW_NAMES
: Each name in libdill has two variants. One is raw ("go", "WS_TEXT", "struct iolist"), another one has a prefix ("dill_go", "DILL_WS_TEXT", "struct dill_iolist"). Defining this macro causes raw variants not to be declared. Use this option if you want to avoid name colisions with third party header files.When building the library you can pass the following options to ./configure
:
--disable-shared
: Generate only a static library. This option causes tests to be linked with libdill statically, thereby making debugging easier.--disable-sockets
: Don't build libdill's socket library. Build only the core functionality.--disable-threads
: Can be used with single-threaded programs. It will make libdill a little bit faster and make it not depend on the pthread library.--enable-census
: When this option is set, the library keeps track of stack space used by individual coroutines. It prints statistics when the process exits.--enable-debug
: Add debug info to the library.--enable-gcov
: Generate coverage report using gcov.--enable-tls
: Build TLS protocol. To be able to build with this option you need OpenSSL 1.1.0. or later installed on your machine.--enable-valgrind
: Valgrind gets confused by libdill's coroutines. Setting this option helps valgrind make sense of what's going on. It's not 100% foolproof but it helps eliminate many false positives.


Rails 5.0.2 (March 01, 2017)
- No changes.
Rails 5.0.1 (December 21, 2016)
- No changes.
Rails 5.0.1.rc2 (December 10, 2016)
- No changes.
Rails 5.0.1.rc1 (December 01, 2016)
Fix
Type::Date#serialize
to cast a value to a date object properly. This casting fixes queries for finding records by date column.Fixes #25354.
Ryuta Kamizono
Rails 5.0.0 (June 30, 2016)
Dirty
's*_changed?
methods now return an actual singleton, nevernil
, as in 4.2. Fixes #24220.Sen-Zhang
Ensure that instances of ::ActiveModel::Errors can be marshalled. Fixes #25165.
Sean Griffin
Allow passing record being validated to the message proc to generate customized error messages for that object using I18n helper.
Prathamesh Sonpatki
Validate multiple contexts on
valid?
andinvalid?
at once.Example:
class Person include ActiveModel::Validations attr_reader :name, :title validates_presence_of :name, on: :create validates_presence_of :title, on: :update end person = Person.new person.valid?([:create, :update]) # => false person.errors. # => {:name=>["can't be blank"], :title=>["can't be blank"]}
Dmitry Polushkin
Add case_sensitive option for confirmation validator in models.
Akshat Sharma
Ensure
method_missing
is called for methods passed to ActiveModel::Serialization#serializable_hash that don't exist.Jay Elaraj
Remove
ActiveModel::Serializers::Xml
from core.Zachary Scott
Add
ActiveModel::Dirty#[attr_name]_previously_changed?
andActiveModel::Dirty#[attr_name]_previous_change
to improve access to recorded changes after the model has been saved.It makes the dirty-attributes query methods consistent before and after saving.
Fernando Tapia Rico
Deprecate the
:tokenizer
option forvalidates_length_of
, in favor of plain Ruby.Sean Griffin
Deprecate ActiveModel::Errors#add_on_empty and ActiveModel::Errors#add_on_blank with no replacement.
Wojciech Wnętrzak
Deprecate ActiveModel::Errors#get, ActiveModel::Errors#set and ActiveModel::Errors#[]= methods that have inconsistent behavior.
Wojciech Wnętrzak
Allow symbol as values for
tokenize
ofLengthValidator
.Kensuke Naito
Assigning an unknown attribute key to an ActiveModel instance during initialization will now raise
ActiveModel::AttributeAssignment::UnknownAttributeError
instead ofNoMethodError
.Example:
User.new(foo: 'some value') # => ActiveModel::AttributeAssignment::UnknownAttributeError: unknown attribute 'foo' for User.
Eugene Gilburg
Extracted ::ActiveRecord::AttributeAssignment to ::ActiveModel::AttributeAssignment allowing to use it for any object as an includable module.
Example:
class Cat include ActiveModel::AttributeAssignment attr_accessor :name, :status end cat = Cat.new cat.assign_attributes(name: "Gorby", status: "yawning") cat.name # => 'Gorby' cat.status # => 'yawning' cat.assign_attributes(status: "sleeping") cat.name # => 'Gorby' cat.status # => 'sleeping'
Bogdan Gusiev
Add ActiveModel::Errors#details
To be able to return type of used validator, one can now call
details
on errors instance.Example:
class User < ActiveRecord::Base validates :name, presence: true end user = User.new; user.valid?; user.errors.details #=> {name: [{error: :blank}]}
Wojciech Wnętrzak
Change
validates_acceptance_of
to accepttrue
by default besides'1'
.The default for
validates_acceptance_of
is now'1'
andtrue
. In the past, only"1"
was the default and you were required to passaccept: true
separately.mokhan
Remove deprecated
ActiveModel::Dirty#reset_#{attribute
} andActiveModel::Dirty#reset_changes
.Rafael Mendonça França
Change the way in which callback chains can be halted.
The preferred method to halt a callback chain from now on is to explicitly
throw(:abort)
. In the past, returningfalse
in an Active Modelbefore_
callback had the side effect of halting the callback chain. This is not recommended anymore and, depending on the value of the ActiveSupport.halt_callback_chains_on_return_false option, will either not work at all or display a deprecation warning.claudiob
Please check 4-2-stable for previous changes.


Popeyes’ fried chicken sandwich released early at 4 Hawaii locations | Honolulu Star-Advertiser
Editor’s Note: A Popeyes spokesman said tonight all Hawaii locations will not be selling fried chicken sandwiches on Saturday, a day before the official launch.
—
Popeyes Louisiana Kitchen chicken sandwiches are available now, two days ahead of their originally scheduled Hawaii debut.
The sandwiches are being sold at the Dillingham, Navy Exchange Mall, Pearl City and Waipahu locations, a spokesman for Popeyes Hawaii said this afternoon.
Social media posts from the Dillingham location reported the wait was as long as an hour, but crowds were limited.
>> RELATED: How does a Popeyes chicken sandwich compare?
They might also become available ahead of Sunday’s official launch at the two other Popeyes restaurants, at Kapahulu and Mililani.
“It might change,” the spokesman said. “It could be as early as tonight or tomorrow. But by Sunday all locations will be selling the sandwiches.”
>> RELATED: Popeyes’ famous — or infamous? — fried chicken sandwich makes long-anticipated Hawaii debut
The fried chicken sandwiches sold so fast after they debuted on the mainland in August that Popeyes ran out, and relaunched sales earlier this month. Today is the first time they have been sold in Hawaii.
The sandwiches cost $6 and come in two varieties, one with a spicy Cajun sauce and one without.


Cheif Executive Officer
Cheif Interface Officer
Cheif Product Officer
Cheif Technology Officer
Cheif Front End Officer
Cheif Marketing Officer
Cheif React Officer
Help get all unused tech into the right hands


What version of Ruby does Command-T need to compile?
-
anonymous
I'm getting some errors with 1.8, perhaps I don't have ruby development header or something similar?
-
Greg Hurrell
The code itself is compatible with either Ruby 1.8 or 1.9, but you don't actually have a choice: you must use the exact version of Ruby that was used when building Vim itself.
This is pretty easy on UNIX-y systems, because even if you don't know what version was used to build Vim, building Vim from source is trivial.
On Windows things are a bit trickier as the entire open source ecosystem is hampered by Microsoft's efforts to make development with free tools unpleasant. One known working combination is listed in the docs. Other people have reported their success in various posts on these forums and in the issue tracker. Unfortunately (or rather, fortunately) I don't use Windows myself, so I can't offer any support for troubleshooting Windows problems beyond advising people to look at the posts by other Windows users.
Reply
This topic is now closed.


| DOSE: T+ 0:00 |
1 bowl |
smoked |
Cannabis |
(plant material) |
| T+ 0:05 |
12 mg |
oral |
2C-I |
(powder / crystals) |
| T+ 2:05 |
5.0 mg |
oral |
2C-I |
(powder / crystals) |
| T+ 2:25 |
5.0 mg |
oral |
2C-I |
(powder / crystals) |
Tues, Nov 18, 2003 T=6:00
T-2:00 I pick up my 2C-I from the mail.
T-1:00 Using the graph paper method, I arrange my 500mgs into a 5x5 square. I separate one side, then cut it up into (roughly) 20mg squares. (This is not hard as the 2C-I was very clumpy). I toss one square into 200mL of water, and give another to my roommate, C. Taking a small dab of the substance, it tastes odd. Itís not a bad taste, but strong. This isnít the most accurate way of measuring, but, from what Iíve read, it should work for 2C-I.
T-0:30 Light dinner, all carbs.
T-0:05 Smoked a small bowl of marijuana.
T-0:00 I drink 100mL of the water (10mg). The taste is barely noticeable in water. It is presently 6pm. I know no one personally who has tried this drug before, but I have researched it online and am intrigued. My drug history is limited to lots of marijuana, 5 shroom trips (one of which was incredibly intense), E once and some painkillers. C has done weed and shrooms.
T+0:30 Nothing yet; Iím in my dorm room, spent the last 10 minutes writing this report.
T+0:40 Maybe a little something, maybe placebo.
T+0:45 Somethingís there, a little body load. Semi-nausea when lying down.
T+1:00 A little body buzz and some fuzzy thinking
T+1:10 Shpongle on, music is intensified. Contemplating adding another 5 or 10mg. The drug seems to come in waves. [This will continue throughout the entire experience]
T+1:30 Lost my pencil, itís in my pocket. I left the room because my roommate left the door slightly opened when he went out for a cig. The RA knocked on the door and it opened slightly. I went out the back door, not wanting to deal with her, especially if it smells like weed. Very slight visuals, wavy floors, some difficulty reading. Roommate remarks on how easy it was to talk with the RA when he was returning from his cigarette.
T+1:50 Definite visuals, not overwhelming though. General good feeling. There is a slight jaw clench, but much less than on E. Contemplating another 5-10mgs. Will decide at 8.
T+2:00 I take another 50mL (5mg) of water, roommate takes another 10mg
T+2:20 Iím feeling pretty good, and take that last 5mg.
T+2:40 Iíve now ingested roughly 22mg. The effects are entirely different from mushrooms. Iím not getting any mindfuck at all. We keep losing things though.
T+2:50 I decide to take a bong hit
T+3:10 Roommate has severe time dilation. Bong hit definitely increased the visuals, still not overwhelming though. Majority of the visuals come from colors; most of the real world just looks a little different.
T+3:30 Psychedelic mindfuck is increasing a little bit. Strong time dilation. Wood grain produces interesting visuals.
 The last 10 minutes have felt like hours to the both of us. [Right here, the wavy effect is in full force. One moment, Iím tripping like crazy, then I almost feel like Iím coming down, then something will thrust me back into it. At this point, this cycle is happening, if I had to guess, about once a minute]
T+4:30 And then all of a sudden itís half an hour later. I smoke another bowl.
T+4:45 Strong visuals now, but still not overwhelming like shrooms.
T+5:00 Leaving for friendís room, itís pouring rain and dark, looks sort of like a movie out there. Iíve had a bit of energy throughout the trip, but havenít really expended it. Now, I run, avoiding the puddles of water which are almost everywhere is fun.
T+7:30 Back, tired, well on my way down, going to smoke a bowl, take a shower and go to sleep, have to reflect on the experience tomorrow.
T+9:00 That didnít work, I canít sleep at all. I get on my computer and talk to people.
T+9:30 I smoke another bowl and try to sleep again.
T+12:00 This is getting annoying, I want to sleep, but just canít. I have an intermittent headache.

T+14:30 I finally fall asleep.
2C-I is an interesting drug, it warrants further exploration. The comedown, however, was pretty rough. C didnít have quite as hard a time with it as I, but he also had trouble sleeping. Marijuana didnít seem to help, perhaps something with a stronger sedative effect?
I never felt any negativity to the drug and my mind was often very clear. Thus, I concur with the sentiment that this could be a good intro to psychedelics, especially if a way could be found to reduce the comedown. Also, this seems like it would be a good rave drug, with its energy and affinity for music and colors.
Sun, Jan 04, 2004
Since the writing of my first report, I have experimented twice more with this material as well as having shared it with almost 10 others. All three of my trips have been vastly different; as well, every report that I have gotten from others have been very different. The reports that I have received from those who I have given the drug to, all at a dose of roughly 20mg, have varied from ďdidnít really feel anythingĒ to ďI think Iím in love with 2C-I.Ē One female who took 2C-I as her first psychedelic really enjoyed it.
I think that setting has an enormous impact on the experience. Trips spent in dorm rooms have generally been subdued. My second experience was at a friendís (who also dosed) house, with other friends coming and going, with a lot of weed smoking. 2C-I worked well in this setting; while not a mind-blowing trip, it was just a good time, less of the energy of my first trip and more chill. My third trip was at a new years party, where there was a lot of alcohol and a little marijuana, but I was the only person tripping. This trip actually reminded me of a moderate dose of mushrooms, I had far more visuals, and things were fairly confusing. The whole night seemed really weird. Fun, but weird. Of course, I donít know how much of the weirdness was the drugs and how much was reality, as my friends who were just drunk and stoned said that it was really weird.
2C-I continues to be a drug which interests me. The comedown was not nearly as hard on my subsequent trips, nor on anyone else. I should shortly be receiving an accurate scale, which will help cut down on the variables involved in exploring the experience. One hypothesis I have at the moment is that taking the whole dose up front increases potency by a good margin. My strongest trip by far was the one where I took it all within an hour of dosing.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


public interface IQueryPage
A query page is single page of query results, where a page is a chunk of a total result set. Paging is used to manage the processing of query results in a manner that protects system memory and response size. Additionally the query page has information unique to a given query invocation, such as the total result size and a token that is a key to retrieve other pages of the query result.
IItemQueryPage
,
IDataQueryPage
| Modifier and Type | Method and Description |
|---|---|
int |
getNextStartPosition()
Answers the zero-based start position of the page that immediately
succeeds this page, or -1 if this page is the last page of the result.
|
int |
getResultSize()
Total size of the result of the query.
|
int |
getSize()
Answers the size of this query result page.
|
int |
getStartPosition()
Answers the zero-based start position of this page relative to the full
result set
|
UUID |
getToken()
Provides the token that uniquely identifies the executed query.
|
boolean |
hasNext()
Indicates if there are more results on the server beyond this page.
|
int getStartPosition()
int getNextStartPosition()
-1
if this is the last
page.hasNext()
int getSize()
int getResultSize()
boolean hasNext()
UUID getToken()


Please ensure your GPS and Network are on!!
Additional information will be uploaded here
Use the tabs to move betwen pages


chapter package¶
Submodules¶
chapter.five_exercises module¶
-
chapter.five_exercises.
question_1
()[source]¶ Posterior of a mixture of conjugate priors is a mixture of conjugates.
\[\begin{split}p(\theta|D) &= \frac{p(\theta, D)}{p(D)},~&\textrm{Def. Cond. Prob},\\ &= \frac{\sum_k p(z=k)p(\theta, D | z=k)}{\sum_{k'} p(z=k')p(D|z=k')},~&\textrm{Law of Total Prob},\\ &= \frac{\sum_k p(z=k)p(D|z=k)p(\theta|D,z=k)}{\sum_{k'} p(z=k')p(D|z=k')},~&\textrm{Chain Rule of Prob.},\\ &= \sum_k p(z=k|D)p(\theta|D,z=k),~&\textrm{Bayes Thm.}\end{split}\]So we have the posterior of a mixture equal to the weighted sum of the posterior of each individual posterior, with the weights being the posteriors of the mixture distribution.
Returns: None.
-
chapter.five_exercises.
question_3
()[source]¶ Reject options.
Basically, you have C possible classes that you can select as your prediction (as defined by a particular problem) plus another option: you can reject making a prediction. The cost of a misprediction is \(\lambda_s\), while the cost for rejecting is \(\lambda_r\).
- Figure out the minimum risk attained given the above parameters.
We were given \(p(y=j|x) = \theta\), but the trick is to figure out where the threshold \(T\) is between getting a rejection and misprediction error. That probability is \(p(\hat{y}=j|x) > T\), so we can state the loss function in terms of \(T\) and go from there. Make sure you pay attention to \(\hat{y}\) versus \(y\)! Once the expected value expression is available, we take the derivative and set it equal to 0 to find where it is maximized.
\[\begin{split}\mathbb{E}[\ell p(\hat{y}=j|x)] &= \int_0^T \lambda_r t dt+ \int_T^1 \lambda_s (1-\theta) t dt,~\textrm{Def. of Expected Value}\\ &= \frac{\lambda_rT^2}{2} + \lambda_s(1-\theta)\left[\frac{1}{2} - \frac{T^2}{2}\right]\\ 0 &= \frac{\lambda_rT^2}{2} + \lambda_s(1-\theta)\left[\frac{1}{2} - \frac{T^2}{2}\right]\frac{d}{dT}\\ &= \lambda_rT - \lambda_s(1-\theta)T\\ \frac{\lambda_rT}{\lambda_sT} &= 1-\theta\\ 1-\frac{\lambda_r}{\lambda_s} &= \theta.\end{split}\]
- Qualitatively, we see a linear function in terms of the cost matrix and the max class \(j\).
As loss due to rejection grows from 0 to the cost of a misprediction error, we see at first that the system must be 100% confident in its prediction to go forward with it, otherwise it’s free to reject. when the two equal each other then there is no benefit to rejecting anything anymore and the majority prediction will be selected at all times instead of the reject option.
Returns: None.
-
chapter.five_exercises.
question_4
()[source]¶ More reject options.
Based on question 3 we know that the risk threshold when a reject option is in play is \(1-\frac{\lambda_r}{\lambda_s}\), and given the table in this problem, we see that it is a safer decision to reject a prediction if it is less than \(1-\frac{3}{10} = 0.7\). Using this fact we can solve the next couple of questions:
- Suppose \(p(y=1|x) = 0.2\). Which decision minimizes the expected loss? \(\hat{y} = 0\)
- Its probability is 0.8.
- Suppose \(p(y=1|x) = 0.4\). Which decision minimizes the expected loss? Reject.
- The maximum confidence is 0.6 < 0.7.
- The thresholds can be specified a little more crisply than the previous question where there were C classes.
- In the binary case, predict 0 if \(p_1 < \frac{\lambda_r}{\lambda_s} = \theta_0\), predict 1 if \(p_1 > 1-\frac{\lambda_r}{\lambda_s} = \theta_1\), and reject if \(\theta_0 \leq p_1 \leq \theta_1\). The idea is that any posterior distribution is a distribution and therefore sums to one. If \(p_1\) is small, then \(p_0\) is large and we should select that, and vice versa. Maximum uncertainty occurs when \(p_1=p_0=0.5\) in which case we should reject as long as the cost for doing so is less than the cost of a misprediction. The reject region grows wider (symmetrically around 0.5 if the loss is equal for a misprediction in either class) as the cost of a rejection grows smaller proportional to the cost of a misprediction.
Returns: None.
chapter.four module¶
chapter.four_exercises module¶
-
chapter.four_exercises.
question_17
()[source]¶ Misclassification error rate of QDA and LDA.
Looks like they’re both the same for the Height and Weight data: 11.9%.
Returns: None.
-
chapter.four_exercises.
question_19
()[source]¶ Stretched LDA.
This is LDA with the additional parameter that we can multiply the grouped covariance matrix by a class-specific value to stretch the Gaussians.
This change will cause the resulting model to still be quadratic in \(x\) because we can’t eliminate all of the squared terms as we did with LDA.
\[\begin{split}p(y=c|x,\theta) &= \frac{\pi_c|2\pi\Sigma|^{-\frac{1}{2}}\exp(-\frac{1}{2}(x-\mu_c)^T\Sigma^{-1}(x-\mu_c))}{\Sigma_{c'}\pi_{c'}|2\pi\Sigma|^{-\frac{1}{2}}\exp(-\frac{1}{2}(x-\mu_{c'})^T\Sigma^{-1}(x-\mu_{c'}))}\\ &= \frac{\pi_ck_c^n\exp(-\frac{1}{2}(x-\mu_c)^T\Sigma^{-1}(x-\mu_c))}{\Sigma_{c'}\pi_{c'}k_{c'}^n\exp(-\frac{1}{2}(x-\mu_{c'})^T\Sigma^{-1}(x-\mu_{c'}))}\\ &= \frac{\pi_ck_c^n\exp(-\frac{1}{2}k_cx^T\Sigma^{-1}x)\exp(-\frac{1}{2}k_c\mu_c^T\Sigma^{-1}\mu_c+k_c\mu_c^T\Sigma^{-1}x}{\Sigma_{c'}\pi_{c'}k_{c'}^n\exp(-\frac{1}{2}k_{c'}x^T\Sigma^{-1}x)\exp(-\frac{1}{2}k_{c'}\mu_{c'}^T\Sigma^{-1}\mu_{c'}+k_{c'}\mu_{c'}^T\Sigma^{-1}x}\\\end{split}\]Returns: None.
-
chapter.four_exercises.
question_22
()[source]¶ QDA with 3 classes.
Side effect: prints the answer that we’re looking for!
Point [-0.5, 0.5] is classified as 1, while [0.5, 0.5] is classified as 2.
Interestingly, they’re both very close to the decision boundary, with the first point almost in the 3rd class, and the second point almost in the 1st class. The results may be an artifact due to numerical instability in the code, but visual inspection marks them as the class labels given above.
Returns: None.
-
chapter.four_exercises.
question_23
()[source]¶ Scalar QDA.
- Side-effect:
We found the QDA values for each class as desired, and got an 83% probability for a 72 inch student to be a male at this university.
The meatier question is about how to extend this method to the situation if we had multiple attributes per person. The clear answer would be to simply run QDA as implemented earlier, but I think that’s not what the question is really getting at. I think you could run an ensemble of 1D QDA’s and then take the average of the predicted values for each class across the set of 1D classifiers. This would ignore correlations between variables, but would take into account the multiple features.
Returns: None.
chapter.one_exercises module¶
-
chapter.one_exercises.
question_2
()[source]¶ This code has some external dependencies. Namely, it uses FLANN and the python bindings for it. Unfortunately, the maintainer of those bindings hasn’t fixed some compatibility issues so a pull request needs to be used to allow it to work with python 3. Or, you can fix the few compatibillity errors yourself .
git clone https://github.com/primetang/pyflann.git cd pyflann git fetch origin pull/7/head:python36 git checkout python36 python setup.py install
In the end, the speedup is quite drastic. As the sample size doubles from 500 to 1000 to 2000 there is almost no change in speed for the FLANN version; however, the time increases substantially for the Linear version.
chapter.six module¶
This module covers some tests from chapter 6: Frequentist Methods.
-
class
chapter.six.
MajorityClassifier
[source]¶ Bases:
object
Selects the majority label from the training data.
This classifier only works on random data, with a binary label it’s not meant to be used for actually problems.
-
prob
¶ float – the probability of the majority class.
-
-
class
chapter.six.
ProbabilisticClassifier
(seed=None)[source]¶ Bases:
object
Selects a class label by the proportion of labels in the training data.
-
prob
¶ float – the probability of getting 1 the data.
-
chapter.six_exercises module¶
-
chapter.six_exercises.
question_1
()[source]¶ Pessimism of LOOCV. I didn’t like the question because I thought it was a little too open…
You want to show that LOOCV can be a really bad estimate of error in some situations. For example, if you have a random class label that you’re trying to predict (binary, equal proportions), LOOCV can report a really bad error bound. You’re asked what the best classifier is for this data and what happens when you do its LOOCV estimate.
The question is leading (though not prescribing) you towards a simple majority classifier. It will be right the maximum number of times (0.5), and it’s LOOCV error rate will be extremely pessimistic, at 100%. The reason is simple enough - if you remove a single sample, then the other class becomese the majority so you’ll predict that but it’s only the majority because the test sample belonged to the other class and so you’ll be wrong every time.
But this isn’t the only optimal classifier specification for this problem. You can also have a probabilistic classifier that outputs a label in proportion to the input. In this case you’ll again achieve an accuracy of 0.5, but the LOOCV will essentially also be 0.5 as the training data grows. For small amounts of training data the process will give you something closer to a 0.49 error rate, but it’s still not that bad.
In short, the LOOCV is pessimistic, but to get the wild swing desired by the question it should have been explicit and asked the reader to investigate the majority classifier (as is done in the source discussion referred to in the question (Witten, Frank, Hall p.154 in Data mining 3rd edition).
See
chapter.six.demo_loocv
for simulation study of this question.Returns: None.
chapter.three_exercises module¶
Worked examples and exercises from Chapter 3.
-
class
chapter.three_exercises.
Concept
(name, extension=[], prior=-1)[source]¶ Bases:
object
This is a concept or hypothesis from the Numbers Game.
-
name
¶ str – The common name of the concept.
-
extension
¶ list int – The values in the event space this concept describes.
-
prior
¶ float – The prior probability of this concept being selected.
-
-
class
chapter.three_exercises.
NumberGame
(*, seed=None)[source]¶ Bases:
object
The game as described in Chapter 3 but used by Joshua Tenenbaum in his PhD Thesis.
The game demonstrates that it is possible to select a correct hypothesis using only positive examples from the target.
Note: It is critical that all the candidate concepts are distinct. This might seem obvious, but there are often many ways to describe the same concept in language. For example, consider
multiples of 10
andends in 0
for the space \([1, 100]\). These are clearly different ideas, but they have the same extension in the space. This means that if one is the target, the other is equally likely. This causes the optimization to converge to 0.5 instead of 1.0, playing havoc with the program.-
concepts
¶ list Concept – The possible concepts in the game.
-
active_concept
¶ (Concept): The current target of the game, selected at random from
concepts
.
-
plugin_distribution
(samples)[source]¶ What is the probability that any point belongs to the target concept given that we “plug in” the most likely concept a posteriori?
Parameters: samples – the samples seen so far. Returns: List of the posterior probabilities using the plug-in estimator.
-
post_predictive_distribution
(samples)[source]¶ What is the probability that any point belongs to the target concept given the data we’ve seen so far?
\[p(\tilde{x} \in C|\mathcal{D}) = \Sigma_h p(y=1|\tilde{x},h)p(h|\mathcal{D}).\]Where \(\tilde{x}\) is a future observation and \(y=1\) states that the observation is consistent with the given concept.
Parameters: samples (list int) – the samples from the target concept we’ve observed so far. Returns: the posterior predictive distribution at this time. Return type: list float
-
posterior
(samples)[source]¶ Generate the full posterior probability of all
concepts
.Computes the posterior \(p(C|\mathcal{D}) = \frac{p(\mathcal{D}|h)p(h)}{p(\mathcal{D})}\), substituting all possible concepts for \(h\).
Parameters: (list (samples) – int): All samples generated by the target concept so far. Returns: the posterior probability of all concepts
.Return type: list float
-
-
chapter.three_exercises.
question_1
()[source]¶ Optimize the log likelihood of \(p(\mathcal{D}|\theta) = \theta^{N_1}(1-\theta)^{N_0}\) to prove \(\frac{N_1}{N}\), the MLE of the Bernoulli/binomial model.
\[\begin{split}log(p(\mathcal{D}|\theta) &= log(\theta^{N_1}(1-\theta)^{N_0})\\ &= N_1 log(\theta)+ N_0 log(1-\theta)\\ &= N_1 log(\theta)+ (N-N_1)log(1-\theta).\end{split}\]Now, optimizing for \(\theta\) by taking the derivative of the above and setting it equal to 0.
\[\begin{split}\frac{d}{d\theta} [N_1 log(\theta)+ (N-N_1)log(1-\theta)] &= \frac{N_1}{\theta} - \frac{N-N_1}{1-\theta}\\ 0 &= \frac{N_1}{\theta} - \frac{N-N_1}{1-\theta}\\ N_1(1-\theta) &= (N-N_1)\theta\\ N_1 - N_1\theta &= N\theta - N_1\theta\\ N_1 &= N\theta\\ \frac{N_1}{N} &= \theta\\\end{split}\]Returns: None.
-
chapter.three_exercises.
question_10
()[source]¶ Taxicab hijinks.
You go to a city and see a taxi numbered 100. Can we figure out how many taxis there are in this city?
a) Assuming we start with a \(Pareto(\theta,0,0)\) distribution on the number, what’s the posterior after seeing that first taxicab numbered 100?
\[\begin{split}p(\theta|\mathcal{D}) &= Pareto(\theta|N+K,max(0,100))\\ &= Pareto(\theta|1,100)\end{split}\]Compute the posterior mean, mode, and median:
- mean = DNE, the rate parameter needs to be bigger.
- mode = 100, we’ve only seen 1 data point!
- median = 200…
\[\begin{split}P(\theta \leq 0.5) &= \\ 0.5 &= \int_m^x km^k\theta^{-(k+1)}d\theta\\ &= 100\int_{100}^x \theta^{-2}d\theta\\ &= 100\left[-\theta^{-1}\rvert_{100}^x\right]\\ &= \frac{100}{100} - \frac{100}{x}\\ 0.5 &= \frac{100}{x}\\ x = 200.\end{split}\]Derive an expression for the posterior predictive after \(\mathcal{D}=\{100\}\).
\[\begin{split}p(\mathcal{D'}|\mathcal{D},\alpha) &= \int p(\mathcal{D'}|\theta)p(\theta|\mathcal{D},\alpha)d\theta\\ &= \int_c^{\infty} Unif(x|\theta)Pareto(\theta|N+K,m)d\theta\\ &= \int_c^{\infty}\theta^{-1}(N+K)m^{N+K}\theta^{-(N+K+1)}d\theta\\ &= (N+K)m^{N+K}\int_c^{\infty}\theta^{-(N+K+2)}d\theta\\ &= (N+K)m^{N+K}\left[\left.\frac{-1}{(N+K+1)\theta^{N+K+1}}\right|_c^{\infty}\right]\\ &= \frac{m^{N+K}}{c^{N+K+1}}.\end{split}\]This is all predicated on \(c = max(\mathcal{D'},m)\). We need to notice that the likelihood of a future point falling into the existing range doesn’t need to stretch the max, so any future value less than the current max will get equal probability of happening. If we want to predict the probability of a higher numbered taxi, then we need to start the integral from that point forward given the evidence we’ve collected so far, so that should be less likely than a uniform distribution up to that number (since we haven’t seen such a large value before). Using this formula, we can see that:
- \(p(x=50|\mathcal{D},\alpha) = \frac{1}{100}\)
- \(p(x=100|\mathcal{D},\alpha) = \frac{1}{100}\)
- \(p(x=150|\mathcal{D},\alpha) = \frac{1}{225}\)
e) There aren’t an infinite number of taxis, so there should be a reasonable upper bound in the integral. The prior should also be set to a more reasonable value because the 150 case seems unusually low.
Returns: None.
-
chapter.three_exercises.
question_11
()[source]¶ Bayesian analysis of the exponential distribution.
Derive the MLE of \(Expon(x|\theta)\).
\[\begin{split}p(x|\theta) &= Expon(x|\theta)\\ &= \theta e^{-x_1\theta}\cdots\theta e^{-x_n\theta}\\ &= \theta^n e^{-\theta \sum_i x_i},~&\textrm{Take the der. and set to 0}\\ 0 &= n\theta^{n-1}e^{-\theta \sum_i x_i} - \theta^n \sum_i x_i e^{-\theta \sum_i x_i}\\ \theta^n \sum_i x_i &= n\theta^{n-1}\\ \frac{\sum_i x_i}{n} &= \frac{1}{\theta}\\ \bar{x} &= \frac{1}{\theta}\\ \frac{1}{\bar{x}} &= \theta.\end{split}\]Given 3 observations of \(X, {5, 4, 6}\), what is the MLE of this data? \(\theta = \frac{1}{5}\).
c) An expert thinks \(p(\theta) = Expon(\theta|\lambda)\). Choose the prior \(\hat{\lambda}\) such that \(\mathbb{E}[\theta] = 1/3\). We can do the MLE route again, to see that \(\theta = \frac{1}{\lambda}\) so we end up with \(\hat{\lambda} = 3\) to get the desired expected value of \(\theta\).
What is the posterior, \(p(\theta|\mathcal{D},\hat{\lambda})\)?
\[\begin{split}p(\theta|\mathcal{D},\hat{\lambda}) &= p(\theta)p(\mathcal{D}|\theta\hat{\lambda})\\ &\propto Expon(\theta|\hat{\lambda})Expon(x|\theta)\\ &= \theta e^{-\theta\hat{\lambda}}\theta^{n}e^{-\theta\sum_i x_i}\\ &= \theta^{n+1}e^{-\theta(\sum_i x_i + \hat{\lambda}}\\ &= Gamma(\theta|n+2, \sum_i x_i + \hat{\lambda}).\end{split}\]
e) The exponential prior is not conjugate to the exponential likelihood. It results in a Gamma, but it turns out that the exponential we selected was just a special case of the Gamma distribution. In general, based on this analysis, I would say that we used a \(Gamma(\theta|2,\hat{\lambda})\) prior and not a \(Expon(\theta|\hat{\lambda})\) prior since the posterior distribution should be the same form as the prior if it was conjugate.
- The posterior mean is \(\frac{n+2}{\sum_i x_i + \hat{\lambda}}\) based on the statistics of the Gamma dist.
g) The MLE and the posterior mean differ because there wasn’t a prior involved in the MLE derivation. The prior suggests that the rate of failure is somewhat shorter than we have observed so far, and this additional information wasn’t available in just the likelihood alone. The posterior mean is probably more reasonable assuming the experts can give a reaonable prior estimate from their experience of studying other machines produced by a similar process.
Returns: None.
-
chapter.three_exercises.
question_12
()[source]¶ Bernoulli MAP estimate with non-conjugate priors.
What if you used a prior: \(p(\theta) = 0.5 if \theta = 0.5, 0.5 if \theta = 0.4, 0 otherwise\).
\[\begin{split}p(\theta|D) &= p(\theta)p(D|\theta)\\ &= p(\theta)\binom{N}{N_1}\theta^{N_1}(1-\theta)^{N-N_1}\\ &= 0.5\binom{N}{N_1}0.5^{N_1}0.5^{N-N_1}+0.5\binom{N}{N_1}0.4^{N_1}0.6^{N-N_1}\\ &= 0.5\binom{N}{N_1}\left[0.5^{N}+0.4^{N_1}0.6^{N-N_1}\right].\end{split}\]
b) What if the true parameter is \(\theta = 0.41\). Which prior works better? For small \(N\), we’ll likely find that the new prior is more accurate because it wants a \(\theta\) close to 0.45. Unfortunately, its effect never really diminishes with increasing trials and so the data doesn’t really overwhelm it. The Beta prior is more likely to have greater errors in the early stages (unless very specific parameters are selected), but instead of blending two specific values of \(\theta\) in fixed amounts, the blending is a part of the data collections and in the limit will converge to the true value.
Returns: None.
-
chapter.three_exercises.
question_2
()[source]¶ Show that:
\[\frac{[(\alpha_1)\cdots(\alpha_1 + N_1 - 1)][(\alpha_0)\cdots(\alpha_0+N_0-1)]}{(\alpha)\cdots(\alpha+N-1)}\]Can be reduced to:
\[\frac{[\Gamma(\alpha_1+N_1)\Gamma(\alpha_0+N_0)]}{\Gamma(\alpha_1+\alpha_0+N)}\frac{\Gamma(\alpha_1+\alpha_0)}{\Gamma(\alpha_1)\Gamma(\alpha_0)}\]Using \((\alpha-1)! = \Gamma(\alpha)\).
\[\begin{split}\frac{[(\alpha_1)\cdots(\alpha_1 + N_1 - 1)][(\alpha_0)\cdots(\alpha_0+N_0-1)]}{(\alpha)\cdots(\alpha+N-1)} &=\\ \frac{[(\alpha_1)\cdots(\alpha_1 + N_1 - 1)][(\alpha_0)\cdots(\alpha_0+N_0-1)]}{(\alpha)\cdots(\alpha+N-1)}\cdot\frac{(\alpha-1)!}{(\alpha-1)!} &=\\ \frac{[(\alpha_1)\cdots(\alpha_1 + N_1 - 1)][(\alpha_0)\cdots(\alpha_0+N_0-1)]}{(\alpha+N-1)!}\cdot\frac{(\alpha-1)!}{1} &=~,~&\textrm{Def. of factorial}\\ \frac{[(\alpha_1)\cdots(\alpha_1 + N_1 - 1)][(\alpha_0)\cdots(\alpha_0+N_0-1)]}{(\alpha+N-1)!}\cdot\frac{(\alpha-1)!(\alpha_1-1)!(\alpha_0-1)!}{(\alpha_1-1)!(\alpha_0-1)!} &=\\ \frac{(\alpha_1 + N_1 - 1)!(\alpha_0+N_0-1)!}{(\alpha+N-1)!}\cdot\frac{(\alpha-1)!}{(\alpha_1-1)!(\alpha_0-1)!} &=~,~&\textrm{Def. of factorial}\\ \frac{\Gamma(\alpha_1 + N_1)\Gamma(\alpha_0+N_0)}{\Gamma(\alpha+N)}\cdot\frac{\Gamma(\alpha)}{\Gamma(\alpha_1)\Gamma(\alpha_0)} &=~,~&\textrm{By the given}\\ \frac{\Gamma(\alpha_1 + N_1)\Gamma(\alpha_0+N_0)}{\Gamma(\alpha_1+\alpha_0+N)}\cdot\frac{\Gamma(\alpha_1+\alpha_0)}{\Gamma(\alpha_1)\Gamma(\alpha_0)} &=~,~&\textrm{Def.}~\alpha = \alpha_1+\alpha_0\end{split}\]So we see that even without appealing to the Beta distribution, we can by sheer counts of the probability of the data occurring arrive at the marginal likelihood for the Beta-Bernoulli model.
Returns: None.
-
chapter.three_exercises.
question_3
()[source]¶ Posterior predictive for Beta-Binomial model
Prove that \(p(x|n, \mathcal{D})=\frac{B(x+\alpha_1',n-x+\alpha_0')}{B(\alpha_1',\alpha_0')}\binom{n}{x}\) reduces to \(p(\tilde{x}=1|\mathcal{D})=\frac{\alpha_1'}{\alpha_1'+\alpha_0'}\) when \(n=1\).
\[\begin{split}\frac{B(x+\alpha_1',n-x+\alpha_0')}{B(\alpha_1',\alpha_0')}\binom{n}{x} &=\\ \frac{B(x+\alpha_1',1-x+\alpha_0')}{B(\alpha_1',\alpha_0')}\binom{1}{x} &=~&,~\textrm{Given}\\ \frac{B(1+\alpha_1',1-1+\alpha_0')}{B(\alpha_1',\alpha_0')}\cdot 1 &=~&,~\textrm{Given}~x=1\\ \frac{\Gamma(1+\alpha_1')\Gamma(\alpha_0')\Gamma(\alpha_1'+\alpha_0')}{\Gamma(1+\alpha_1'+\alpha_0')\Gamma(\alpha_1')\Gamma(\alpha_0')} &=~&,~\textrm{Def. of}~Beta\\ \frac{\alpha_1'\Gamma(\alpha_1')\Gamma(\alpha_1'+\alpha_0')}{(\alpha_1'+\alpha_0')\Gamma(\alpha_1'+\alpha_0')\Gamma(\alpha_1')} &=~&,~\Gamma(a+1)=a\Gamma(a)\\ \frac{\alpha_1'}{\alpha_1'+\alpha_0'}.\end{split}\]So we can see that after a single trial, the posterior predictive of getting a 1 in that trial is simply the rate of getting a 1 as given by the prior, which makes sense because we haven’t yet observed any data. :returns: None.
-
chapter.three_exercises.
question_4
()[source]¶ Simple mixture distribution.
Let’s say we tossed a fair coin 5 times and know that < 3 heads appeared. Compute the posterior up to normalization constant..
\[\begin{split}p(X < 3 | \theta) &= p(X=0 | \theta) + p(X=1 | \theta) + p(X=2|\theta),~&\textrm{Union of mutually exclusive events.}\\ &\propto B(\theta|1,1)Bin(0|\theta,5) + B(\theta|1,1)Bin(1|\theta,5) + B(\theta|1,1)Bin(2|\theta,5),~&\textrm{Bayes law}\\ &\propto B(\theta|1,6) + B(\theta|2,5) + B(\theta|3,4),~&\textrm{Conjugate prior}.\end{split}\]Returns: None.
-
chapter.three_exercises.
question_5
()[source]¶ Uninformative prior for log-odds ratio.
Let \(\phi = \textrm{logit}(\theta) = log\frac{\theta}{1-\theta}\). Show that if \(p(\phi) \propto 1\), then \(p(\theta) \propto Beta(\theta|0, 0)\).
\[\begin{split}p(\phi) &= p(\theta)\left\vert\frac{d \theta}{d \phi}\right\vert,~&\textrm{Change of variables}\\ &= log\frac{\theta}{1-\theta}\left\vert\frac{d\theta}{d\phi}\right\vert,\\ &= log\theta - log(1-\theta)\left\vert\frac{d\theta}{d\phi}\right\vert,\\ &= \frac{1}{\theta} + \frac{1}{1-\theta},\\ &= \frac{\theta + 1 - \theta}{\theta(1-\theta)},\\ &= \frac{1}{\theta(1-\theta)},\\ &= \theta^{-1}(1-\theta)^{-1},\\ &= B(\theta|0, 0),~&\textrm{Def. of Beta}.\end{split}\]Returns: None.
-
chapter.three_exercises.
question_6
()[source]¶ MLE for the Poisson distribution. \(Poi(x|\lambda) = e^{-\lambda}\frac{\lambda^x}{x!}\). Derive the MLE.
\[\begin{split}p(\lambda|x_1,\ldots,x_n) &= e^{-\lambda}\frac{\lambda^{x_1}}{x_1!}\cdots e^{-\lambda}\frac{\lambda^{x_n}}{x_n!},~&X~\sim~Poi(\lambda)\\ &= e^{-n\lambda}\frac{\lambda^{x_1+\cdots+x_n}}{\prod_i^n x_i!}.\end{split}\]Set take the derivative and set it equal to 0 to find the maximum:
\[\begin{split}\frac{d}{d\lambda}p(\lambda|x_1,\ldots,x_n) &= -ne^{-n\lambda}\frac{\lambda^{x_1+\cdots+x_n}}{\prod_i^n x_i!} + e^{-n\lambda}\frac{(x_1+\cdots+x_n)\lambda^{x_1+\cdots+x_n-1}}{\prod_i^n x_i!},\\ ne^{-n\lambda}\frac{\lambda^{x_1+\cdots+x_n}}{\prod_i^n x_i!} &= e^{-n\lambda}\frac{(x_1+\cdots+x_n)\lambda^{x_1+\cdots+x_n-1}}{\prod_i^n x_i!},\\ n\lambda^{x_1+\cdots+x_n} &= (x_1+\cdots+x_n)\lambda^{x_1+\cdots+x_n-1},\\ n\lambda &= \sum_i^n x_i,\\ \lambda &= \frac{1}{n}\sum_i^n x_i.\end{split}\]Returns: None.
-
chapter.three_exercises.
question_7
()[source]¶ Bayesian derivation of Poisson MLE.
- Derive the posterior assuming a conjugate prior \(p(\lambda) = Ga(\lambda|a,b) \propto \lambda^{a-1}e^{-\lambda b}\).
From the above, the likelihood of the Poisson distribution is: \(e^{-n\lambda}\frac{\lambda^{x_1+\cdots+x_n}}{\prod_i^n x_i!}\), so we can write the posterior as:
\[\begin{split}p(\lambda|D) &\propto \lambda^{a-1}e^{-\lambda b}e^{-n\lambda}\lambda^{x_1+\cdots+x_n}\\ &= e^{-\lambda b -\lambda n}\lambda^{a+x_1+\cdots+x_n-1}\\ &= Ga(a+x_1+\cdots+x_n-1, b+n)\end{split}\]- The MLE of the posterior looks can be found:
\[\begin{split}0 &= \frac{d}{d\lambda}e^{-\lambda b -\lambda n}\lambda^{a+x_1+\cdots+x_n-1}\\ &= -(b+n)e^{-\lambda(b+n)}\lambda^{a+x_1+\cdots+x_n-1}+e^{-\lambda b -\lambda n}(a+x_1+\cdots+x_n-1)\lambda^{a+x_1+\cdots+x_n-2}\\ (b+n)e^{-\lambda(b+n)}\lambda^{a+x_1+\cdots+x_n-1} &= e^{-\lambda b -\lambda n}(a+x_1+\cdots+x_n-1)\lambda^{a+x_1+\cdots+x_n-2}\\ (b+n)\lambda^{a+x_1+\cdots+x_n-1} &= (a+x_1+\cdots+x_n-1)\lambda^{a+x_1+\cdots+x_n-2}\\ (b+n)\lambda &= a+x_1+\cdots+x_n-1\\ \lambda &= \frac{a-1+\sum_i x_i}{b+n}.\end{split}\]If we look at what happens as the prior parameters \(a, b \rightarrow 0\), we see that the mean of the posterior approaches the MLE of the Poisson distribution.
Returns: None.
-
chapter.three_exercises.
question_8
()[source]¶ MLE for the uniform distribution.
- What is the MLE for data \(x_1,\ldots,x_n\)?
\[\begin{split}p(a|x_1,\ldots,x_n) &= \frac{\sum_i x_i}{(2a)^2}&\\ &= \frac{-\sum_i x_i}{8a},~&\textrm{Der. with respect to}~a\\ 0 &= \frac{-\sum_i x_i}{8a},~&\textrm{Set equal to 0 to find maximum}.\end{split}\]This is where some insight comes in. Solving for \(a\) doesn’t really work, but if you think about plotting this function (for some fixed sum of data), you see that it approaches 0 as \(a\) increases. The MLE occurs when \(\hat{a} = max |x_i|, x_i \in {x_1,\ldots,x_n}\) since it captures all the data seen so far and there’s no support for anything further out in magnitude on the number line.
- The probability the model would assign to point \(x_{n+1}\) is:
\[\begin{split}p(x_{n+1}|\hat{a}) &= \frac{1}{2\hat{a}},\\ &= \frac{1}{2x_{\textrm{max}}}.\end{split}\]- This doesn’t make a great deal of sense, especially if only a few data points have been observed.
It states that the only points that will be observed will be no bigger than \(|x_{\textrm{max}}|\). In reality, the only thing we know for sure is that \(a\) is at least that large. We may instead set a prior on \(a\) that takes into account the range of feasible values based on the specific problem. It would have the effect of broadening the range of values we expect to see, eventually tightening to all the points we’ve seen so far.
Returns: None.
-
chapter.three_exercises.
question_9
()[source]¶ Bayesian analysis of the uniform dist.
Given a Pareto prior, the joint distribution of \(\theta\) and \(\mathcal{D}\) is \(p(\mathcal{D}, \theta) = \frac{Kb^K}{\theta^{N+K+1}}\mathbb{I}(\theta \geq max(\mathcal{D},b))\). We’re also given \(p(\mathcal{D})\), and are asked to derive the posterior \(p(\theta|\mathcal{D})\). So…
\[\begin{split}p(\theta|\mathcal{D}) &= \frac{p(\theta)p(\mathcal{D}|\theta)}{p(\mathcal{D})},~&\textrm{Bayes rule}\\ &= \frac{p(\theta)p(\mathcal{D},\theta)}{p(\theta)p(\mathcal{D})},~&\textrm{Def. of Cond Prob.}\\ &= \frac{p(\mathcal{D},\theta)}{p(\mathcal{D})}\\ &= \frac{Kb^K}{\theta^{N+K+1}}\cdot\frac{(N+K)m^{N+K}}{Kb^K},~&\textrm{If max is }\geq b,~\textrm{or}\\ &= \frac{(N+K)m^{N+K}}{\theta^{N+K+1}},\\ &= \frac{Kb^K}{\theta^{N+K+1}}\cdot\frac{(N+K)b^{N}}{K},~&\textrm{If max is }< b,\\ &= \frac{(N+K)b^{N+K}}{\theta^{N+K+1}},\\ &= Pareto(\theta|N+K, max(\mathcal{D},b)),~&\textrm{Def. of the Pareto distribution}.\end{split}\]Returns: None.
chapter.two_exercises module¶
-
chapter.two_exercises.
question_1
()[source]¶ p(gender=boy) = 0.5 p(gender=girl) = 0.5
Possible outcomes of 2 children: boy, girl boy, boy girl, boy girl, girl
a) If you know the neighbor has at least one boy, what is the probability the neighbor has a girl? Sample space: (b,g), (b,b), (g,b). 2/3 events have a girl involved, and they all have equal probability so 2/3.
b) What is the probability that the other child is a girl if you see that one is a boy? Sample space: (b,g), (b,b). 1/2. The children are independent of each other, so it’s the same as the probability of one child being a girl.
Returns: None.
-
chapter.two_exercises.
question_10
()[source]¶ Derive the inverse gamma distribution.
If \(X \sim Ga(a, b)\), and \(Y = 1/X\), show that \(Y \sim IG(a, b)\).
\[\begin{split}p_y(y) &= p_x(x)\left|\frac{dy}{dx}\frac{1}{X}\right|\\ &= \frac{b^a}{\Gamma(a)}\left(\frac{1}{x}\right)^{a-1}e^{-b/x}x^{-2}\\ &= \frac{b^a}{\Gamma(a)}x^{-(a-1)}e^{-b/x}x^{-2}\\ &= \frac{b^a}{\Gamma(a)}x^{-(a+1)}e^{-b/x}\\ &= IG(a, b).\end{split}\]Returns: None.
-
chapter.two_exercises.
question_11
()[source]¶ Derive the 1D Gaussian normalization constant.
We’re going to need to do a little u-substitution:
\[\begin{split}u &= \frac{r^2}{2\sigma^2}\\ du &= \frac{2r}{2\sigma^2}dr\\ \frac{\sigma^2}{r}du &= dr.\end{split}\]\[\begin{split}Z^2 &= \int_0^{2\pi}\int_0^{\infty}r exp\left(\frac{-r^2}{2\sigma^2}\right) dr d\theta\\ &= \int_0^{2\pi}\int_0^{\infty}r exp\left(\frac{-r^2}{2\sigma^2}\right) dr d\theta\\ &= \int_0^{2\pi}\int_0^{\infty}re^{-u} du\frac{\sigma^2}{r}d\theta\\ &= \sigma^2\int_0^{2\pi}\int_0^{\infty}e^{-u} du d\theta\\ &= \sigma^2\int_0^{2\pi} \left.-e^{-u}\right|_0^{\infty} d\theta\\ &= \sigma^2\int_0^{2\pi} 1 d\theta\\ &= \sigma^2\left.\theta\right|_0^{2\pi}\\ &= \sigma^2 2\pi\\ Z &= \sqrt{\sigma^2 2\pi}\\\end{split}\]Returns: None.
-
chapter.two_exercises.
question_12
()[source]¶ Express I(X,Y) as entropy…
\[\begin{split}I(X,Y) &= \Sigma_x\Sigma_y p(x,y) \log\frac{p(x,y)}{p(x)p(y)}\\ &= \Sigma_x\Sigma_y p(x|y)p(y) \log\frac{p(x|y)p(y)}{p(x)p(y)}\\ &= \Sigma_x\Sigma_y p(x|y)p(y) \left[\log p(x|y) - \log p(x)\right]\\ &= \Sigma_x\Sigma_y p(x|y)p(y)\log p(x|y) - \Sigma_x\Sigma_y p(x|y)p(y)\log p(x)\\ &= \Sigma_y p(y) \Sigma_x p(x|y)\log p(x|y) - \Sigma_x \log p(x) \Sigma_y p(x|y)p(y)\\ &= -H(X|Y) - \Sigma_x \log p(x) \Sigma_y p(x|y)p(y),~&\textrm{Def. of Cond. Entropy}\\ &= -H(X|Y) - \Sigma_x p(x)\log p(x),~&\textrm{Law of Total Prob.}\\ &= -H(X|Y) + H(X),~&\textrm{Def. of Cond. Entropy}\\ &= H(X) - H(X|Y).\end{split}\]You could simply change the way you go from joint to conditional variables in first step of the proof.
Returns: None.
-
chapter.two_exercises.
question_14
()[source]¶ Show that normalized mutual information is a type of correlation.
\(r = 1-\frac{H(Y|X)}{H(X)}\).
Show \(r = \frac{I(X,Y)}{H(X)}\):
\[\begin{split}r &= 1 - \frac{H(Y|X)}{H(X)}\\ &= \frac{H(X)}{H(X)} - \frac{H(Y|X)}{H(X)}\\ &= \frac{H(Y) - H(Y|X)}{H(X)},~&\textrm{X and Y are identically distributed.}\\ &= \frac{I(X,Y)}{H(X)},~&\textrm{From Q2.12}.\end{split}\]
b) Show \(0 \leq r \leq 1\). We need to minimize and maximize the numerator. It is minimized when the \(log\frac{p(x,y)}{p(x)p(y)}\) is minimized, so:
\[\begin{split}0 &= \log\frac{p(x,y)}{p(x)p(y)}\\ \log(p(x)p(y)) &= \log p(x,y)\\ \log(p(x)p(y)) &= \log(p(x)p(y)),~&X \perp Y.\end{split}\]If this term is 0 (and it can be if \(X \perp Y\)), then the numerator is 0 and \(r=0\). The numerator is maximized when \(X=Y\).
\[\begin{split}I(X,X) &= \Sigma_x \Sigma_y p(x,x) \log\frac{p(x,x)}{p(x)p(x)}\\ &= \Sigma_x \Sigma_y p(x) \log\frac{1}{p(x)}\\ &= \Sigma_x p(x) \log\frac{1}{p(x)}\\ &= \Sigma_x p(x) \log 1 - \Sigma_x p(x) \log p(x)\\ &= 0 + H(X)\\.\end{split}\]So we end up with \(\frac{H(X)}{H(X)} = 1\). So we’ve seen the min and max and we have shown that \(0 \leq r \leq 1\).
- \(r = 0\) when \(X \perp Y\).
- \(r = 1\) when \(X = Y\).
Returns: None.
-
chapter.two_exercises.
question_16
()[source]¶ Mean, median, and mode of the Beta distribution.
Mean:
\[\begin{split}\mathbb{E}[X] &= \int_0^1 x B(a,b)dx\\ &= \int_0^1 x\frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}x^{a-1}(1-x)^{b-1}dx\\ &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\int_0^1 x^a(1-x)^{b-1}dx\\ &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\int_0^1 x^{(a+1)-1}-x^{a+b-1}dx\\ &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}B(a+1,b),~&\textrm{Integral form of Beta}\\ &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\frac{\Gamma(a+1)\Gamma(b)}{\Gamma(a+b+1)},~&\textrm{Def. of Beta}\\ &= \frac{\Gamma(a+b)}{\Gamma(a)}\frac{a\Gamma(a)}{(a+b)\Gamma(a+b)},~&\textrm{Def. of }\Gamma,\\ &= \frac{a}{(a+b)}.\end{split}\]- Mode:
We’re going to take the derivative, set to 0, and solve to see what we get…
\[\begin{split}B(a, b) &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}x^{a-1}(1-x)^{b-1}dx\\ 0 &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\left[(a-1)x^{a-2}(1-x)^{b-1}-x^{a-1}(b-1)(1-x)^{b-2}\right]\\ 0 &= (a-1)(1-x)-x(b-1)\\ 0 &= a-x-1-ax-xb+x\\ ax+bx-2x &= a-1\\ x &= \frac{a-1}{a+b-2}.\end{split}\]
- Variance:
Just going to use the standard formula and hope for the best!
\[\begin{split}Var(B(a,b)) &= \int_0^1\frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\left(x-\frac{a}{a+b}\right)^2 x^{a-1}(1-x)^{b-1}dx\\ &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\int_0^1\left(x^2-\frac{2xa}{a+b}+\frac{a^2}{(a+b)^2}\right) x^{a-1}(1-x)^{b-1}dx\\ &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\left[\int_0^1 x^{(a+2)-1}(1-x)^{b-1}dx -\frac{2a}{a+b}\int_0^1 x^{(a+1)-1}(1-x)^{b-1}dx+\frac{a^2}{(a+b)^2}\int_0^1 x^{a-1}(1-x)^{b-1}dx\right]\\ &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\left[B(a+2,b) -\frac{2a}{a+b}B(a+1,b)+\frac{a^2}{(a+b)^2}B(a,b)\right]\\ &= \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\left[\frac{\Gamma(a+2)\Gamma(b)}{\Gamma(a+b+2)} -\frac{2a}{a+b}\frac{\Gamma(a+1)\Gamma(b)}{\Gamma(a+b+1)}+\frac{a^2}{(a+b)^2}\frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}\right]\\ &= \frac{\Gamma(a+b)}{\Gamma(a)}\left[\frac{(a+1)a\Gamma(a)}{(a+b+1)(a+b)\Gamma(a+b)} -\frac{2a}{a+b}\frac{a\Gamma(a)}{(a+b)\Gamma(a+b)}+\frac{a^2}{(a+b)^2}\frac{\Gamma(a)}{\Gamma(a+b)}\right]\\ &= \frac{(a+1)a}{(a+b+1)(a+b)} -\frac{2a}{a+b}\frac{a}{(a+b)}+\frac{a^2}{(a+b)^2}\\ &= \frac{a^2+a}{(a+b+1)(a+b)} -\frac{2a^2}{(a+b)^2}+\frac{a^2}{(a+b)^2}\\ &= \frac{(a^2+a)(a+b) - (2a^2)(a+b+1) + a^2(a+b+1)}{(a+b+1)(a+b)^2}\\ &= \frac{a^3+a^2b+a^2+ab - 2a^3-2a^2b-2a^2 + a^3+a^2b+a^2}{(a+b+1)(a+b)^2}\\ &= \frac{ab}{(a+b+1)(a+b)^2}.\end{split}\]
Returns: None.
-
chapter.two_exercises.
question_17
(k=2, trials=1000, seed=1337)[source]¶ Expected value of the minimum of 2 uniformly distributed numbers…
The trick here is figuring out how to express the max function over two variables… Assuming \(x_1,x_2 \sim Unif(0,1)\).
\[\begin{split}\mathbb{E}[min(x_1,x_2)] &= \int_0^1\int_0^1 x_2\mathbb{I}(x_2 \leq x_1) + x_1\mathbb{I}(x_1 < x_2)dx_2 dx_1\\ &= \int_0^1\int_0^1 x_2\mathbb{I}(x_2 \leq x_1) dx_2 dx_1 + \int_0^1\int_0^1 x_1\mathbb{I}(x_1 < x_2)dx_2 dx_1\\ &= \int_0^1\int_0^{x_1} x_2 dx_2 dx_1 + \int_0^1\int_0^{x_2} x_1dx_1 dx_2\\ &= 2\int_0^1\int_0^{x_1} x_2 dx_2 dx_1\\ &= 2 \frac{1}{2\cdot 3}\\ &= \frac{1}{3}.\end{split}\]In general, if you have \(n\) variables from this distribution you can find the expected value of the min as \(n!\int_0^1\cdot\int_0^{x_n}x_n dx_n\cdots dx_1 = \frac{1}{n+1}\) if you’re talking about the uniform.
Also, as part of experimenting to get this solution, I also did a categorical case, which is very similar except you need to worry about the situation where the two variables are equal (which has 0 probability in the continuous case): \(\frac{2}{n^2}\sum_{i=1}^n\sum_{j=1}^i x_j - \sum_{i=1}^n x_i\), where \(n\) is the number of elements in the space and they are in ascending order. I believe going from 2 to \(k\) draws will be similar, replacing the numerator with \(k!\) and the denominator with \(k\).
Parameters: - k (int) – Number of draws from the distribution to compute the min over.
- trials (int) – Number of random min samples to select before computing the expected value.
- seed (int) – Random seed for reproducibility.
Returns: the expected value of the min of
k
uniformly distributed variables.Return type: float
-
chapter.two_exercises.
question_2
()[source]¶ There is a blood found at a crime scene that has no innocent explanation. The blood is of a type found in 1% of the population.
a) Prosecutor’s fallacy: 1% chance that the defendant would have the crime scene blood type if he was innocent, therefore there is a 99% chance that he is guilty.
This is not what the evidence states: 1% of the population could have committed the crime because only they have the suspect blood type. The defendant has that blood type, so he is 1/K people who are in consideration for committing the crime, not 99% likely to have committed the crime. 99% of the population is not in consideration for the crime at all, but based on the blood evidence alone we cannot state the likelihood of this single defendent having committed this crime, only that he is in the consideration set.
b) Defendant’s fallacy: There are 800K people in the city, 8000 have the blood type in question. There is just 1 in 8000 chance that the defendant is guilty and so has no relevance.
While it is true that the defendant is just 1 of 8000 city dwellers that have the matching blood type, the blood is relevant. The true culprit must have that blood type, and so it establishes that further evidence must be produced to establish the innocence or guilt of the defendant. This is far from the situation that we can ignore the blood type, the guilty part(ies) must have that match to be considered for the crime.
Returns: None.
-
chapter.two_exercises.
question_3
()[source]¶ Variance of a sum.
\[\begin{split}cov[X, Y] &= \mathbb{E}[[X - \mathbb{E}[X]][Y - \mathbb{E}[Y]]]\\ &= \mathbb{E}[XY - X\mathbb{E}[Y] - Y\mathbb{E}[X] + \mathbb{E}[X]\mathbb{E}[Y]]\\ &= \mathbb{E}[XY] - \mathbb{E}[X]\mathbb{E}[Y] - \mathbb{E}[X]\mathbb{E}[Y] + \mathbb{E}[X]\mathbb{E}[Y]\\ &= \mathbb{E}[XY] - \mathbb{E}[X]\mathbb{E}[Y]\end{split}\]\[\begin{split}var[X + Y] &= \mathbb{E}[(X + Y - \mathbb{E}[X+Y])^2]\\ &= \mathbb{E}[X^2] + \mathbb{E}[XY] - \mathbb{E}[X\mathbb{E}[X+Y]] + \mathbb{E}[XY] + \mathbb{E}[Y^2] - \mathbb{E}[Y\mathbb{E}[X+Y]] - \mathbb{E}[X\mathbb{E}[X+Y]] - \mathbb{E}[Y\mathbb{E}[X+Y]] + \mathbb{E}[X+Y]^2\\ &= \mathbb{E}[X^2] - \mathbb{E}[X]^2 - \mathbb{E}[X]\mathbb{E}[Y] + \mathbb{E}[Y^2] - \mathbb{E}[Y]^2 - \mathbb{E}[X]\mathbb{E}[Y] +2\mathbb{E}[XY] - \mathbb{E}[X]^2 - 2\mathbb{E}[X]\mathbb{E}[Y] - \mathbb{E}[Y]^2 + \mathbb{E}[X+Y]^2\\ &= var(X) + var(Y) + 2\mathbb{E}[XY] - 4\mathbb{E}[X]\mathbb{E}[Y] - \mathbb{E}[X]^2 - \mathbb{E}[Y]^2 + \mathbb{E}[X+Y]^2\\ &= var(X) + var(Y) + 2cov(X, Y) - 2\mathbb{E}[X]\mathbb{E}[Y] - \mathbb{E}[X]^2 - \mathbb{E}[Y]^2 + \mathbb{E}[X]^2 + 2\mathbb{E}[X]\mathbb{E}[Y] + \mathbb{E}[Y]^2\\ &= var(X) + var(Y) + 2cov(X, Y)\\\end{split}\]Returns: None.
-
chapter.two_exercises.
question_4
()[source]¶ Given:
\[\begin{split}P(T=p|D=p) &= 0.99\\ P(T=n|D=n) &= 0.99\\ P(D=p) &= 1/10,000\end{split}\]This is an application of Bayes Theorem since we want to update the prior probability of having the disease after knowing the test came back positive. So we have:
\[\begin{split}P(D=p|T=p) &= \frac{P(T=p|D=p) \cdot P(D=p)}{P(T=p)}, &~\textrm{Bayes Thm.}\\ &= \frac{P(T=p|D=p) \cdot P(D=p)}{\Sigma_d P(T=p|D=d)\cdot P(D=d)}, &~\textrm{Law of Total Prob.}\\ &= \frac{P(T=p|D=p) \cdot P(D=p)}{P(T=p|D=p) \cdot P(D=p) + P(T=p|D=n) \cdot P(D=n)}, &~\textrm{Notation}\\ &= \frac{0.99 \cdot 0.0001}{0.99 \cdot 0.0001 + 0.01 \cdot 0.9999}, &~\textrm{Law of Total Prob.}\\ &\approx 0.0098.\end{split}\]This means that the good news is the probability of having the disease is still a little less than 1/100. Also, The second application of the Law of Total Probability is actually two applications:
\[\begin{split}1 &= P(D=p) + P(D=n)\\ 1 &= P(T=p|D=p) + P(T=p|D=n)\end{split}\]Returns: None.
-
chapter.two_exercises.
question_5
(num_samples=1000000, seed=1337)[source]¶ The Monty Hall Problem using Bayes theorem.
We’re interested in determining whether switching doors is better than sticking with the original.
Let \(C \sim Unif(3)\) be the random variable representing where the car (prize) is, \(F \sim Unif(3)\) be the random variable representing the first selection made by the contestant, and \(O\) be the random variable representing which door is opened after the first selection is made. This variable is deterministic when the first guess does not equal the prize value but has a choice otherwise.
\[\begin{split}P(F=P|O, P) &= \frac{P(O|F=P) \cdot P(F=P)}{P(O|P=F)},~&\textrm{Bayes Theorem}\\ &= \frac{1/2 \cdot 1/3}{1/2},~&\textrm{Counting}\\ &= 1/3.\\ P(F\neq P|O, P) &= \frac{P(O|F\neq P) \cdot P(F\neq P)}{P(O|P\neq F)},~&\textrm{Bayes Theorem}\\ &= \frac{1 \cdot 2/3}{1},~&\textrm{Counting}\\ &= 2/3.\end{split}\]So from this we see that our first guess has a 2/3 chance of being wrong given the open door, so switching would give us a 2/3 of being correct in that case. Additionally, by the Law of Total Probability, we could’ve computed the chances of the first guess being correct (1/3) and taking the complement of that.
- Side-effect:
- This code runs a simulation of the Monty Hall Problem to compute the probabilities and prints the probability of being right when staying with the original choice or switching to the remaining door.
Parameters: - num_samples (int) – the number of times to sample the distribution, must be positive.
- seed (int) – the random seed to ensure repeatability.
Returns: None.
-
chapter.two_exercises.
question_6
()[source]¶ Want to know if you can compute \(P(H|e_1,e_2)\) with different givens.
Let’s look at what this formula looks like after rearranging.
\[\begin{split}P(H|e_1,e_2) &= \frac{P(e_1,e_2|H) \cdot P(H)}{P(e_1,e_2)},~&\textrm{Bayes Thm.}\\ &= \frac{P(e_1|H) \cdot P(e_2|H) \cdot P(H)}{P(e_1,e_2)},~&\textrm{Def. of Cond. Ind.}\\ &= \frac{P(e_1|H) \cdot P(e_2|H) \cdot P(H)}{\Sigma_h P(e_1,e_2|H) \cdot P(H)},~&\textrm{Total Probability}\\ &= \frac{P(e_1|H) \cdot P(e_2|H) \cdot P(H)}{\Sigma_h P(e_1|H)\cdot P(e_2|H) \cdot P(H)},~&\textrm{Def. of Cond. Ind.}\end{split}\]- \(P(e_1,e_2), P(H), P(e_1|H), P(e_2|H)\). This is sufficient from the second line above if we assume independence between the \(E\) variables.
- \(P(e_1,e_2), P(H), P(e_1,e_2|H)\). This is sufficient from the first line above, a single applications of Bayes Theorem.
- \(P(e_1|H), P(e_2|H), P(H)\). This is sufficient from the last line, after applying the Law of total probability and Conditional Independence.
So (ii) is the answer to part a), when we don’t know anything about the relationship between \(E_1\) and \(E_2\). All sets of givens are sufficient if we know the two variables are conditionally independent.
Returns: None.
-
chapter.two_exercises.
question_7
()[source]¶ Pairwise independence does not imply mutual independence.
Mutual independence means that \(P(X_i|X_S) = P(X_i) \forall S \subseteq \{1,\ldots,n\}\setminus\{i\}\) and so the joint distribution of \(P(X_{1:n}) = \prod_{i=1}^n P(X_i)\).
So it would be enough to show that for 3 variables that are all pairwise independent that they are not mutually independent.
Consider a 5x5 grid where one variable \((X_1)\) is true only along the bottom 5 squares, another is true only along the right side \((X_2)\), and a third is true only along the main diagonal \((X_3)\). The only overlap any variable has with any other is in the lower right corner square.
\[\begin{split}P(X_1=T) &= 5/25\\ P(X_1=F) &= 20/25\\ P(X_1=T,X_2=T) &= 1/25 = 5/25*5/25 = P(X_1=T)P(X_2=T)\\ P(X_1=T,X_2=F) &= 4/25 = 5/25*20/25 = P(X_1=T)P(X_2=F)\\ P(X_1=F,X_2=T) &= 4/25 = 20/25*5/25 = P(X_1=F)P(X_2=T)\\ P(X_1=F,X_2=F) &= 16/25 = 20/25*20/25 = P(X_1=F)P(X_2=F)\\\end{split}\]In this way, we see that each pair of variable is conditionally independent. The question is if they are mutually independent. If they were, then \(P(X_1,X_2,X_3) = P(X_1)P(X_2)P(X_3)\), but we see for \(P(X_1=T,X_2=T,X_3=T) = 1/25\) (the lower right corner), but \(P(X_1=T)P(X_2=T)P(X_3=T) = 1/125\) so we see that being pairwise conditionally independent does not imply mutual independence.
Returns: None.
-
chapter.two_exercises.
question_8
()[source]¶ Conditional independence iff joint factorizes.
Prove that \(p(x,y|z)=g(x,z)h(y,z)~\textrm{iff}~X \perp Y | Z.\)
First, let \(g(x,z) = p(x|z), h(y,z) = p(y|z)\) since conditional probabilities are functions of random variables these are permissible definitions of \(g, h\).
\(\textrm{The forward direction:}~X \perp Y | Z \Rightarrow p(x,y|z)=g(x,z)h(y,z).\)
\[\begin{split}p(x,y|z) &= p(x|z)p(y|z),~&\textrm{Def. of Cond. Ind.}\\ &= g(x,z)h(y,z),~&\textrm{Defined above.}.\end{split}\]Lemma: \(p(x|y,z) = p(x|z)~\textrm{if}~X \perp Y | Z.\)
Proof:
\[\begin{split}p(x|y,z) &= \frac{p(x,y,z)}{p(y,z)},~&\textrm{Def. of Cond. Prob.}\\ &= \frac{p(x,y|z)p(z)}{p(y|z)p(z)}~&\textrm{Def. of Cond. Prob.}\\ &= \frac{p(x|z)p(y|z)p(z)}{p(y|z)p(z)}~&\textrm{Def. of Cond. Ind.}\\ &= p(x|z).\end{split}\]\(\textrm{The reverse direction:}~p(x,y|z)=g(x,z)h(y,z) \Rightarrow X \perp Y | Z.\)
\[\begin{split}p(x,y|z) &= \frac{p(x,y,z)}{p(z)},~&\textrm{Def. of Cond. Prob.}\\ &= \frac{p(z)p(y|z)p(x|y,z)}{p(z)},~&\textrm{Chain rule of prob.}\\ &= p(y|z)p(x|z),~&\textrm{By the above lemma, Def. Cond. Ind.}\\ &= g(x,z)h(y,z),~&\textrm{Defined above.}\end{split}\]Returns: None.
-
chapter.two_exercises.
question_9
()[source]¶ Conditional independence statements…
Does \((X \perp W|Z,Y) \wedge (X \perp Y|Z) \Rightarrow (X \perp Y,W|Z)\)? Yes.
\[\begin{split}p(X,Y,W|Z) &= \frac{p(X,Y,W,Z)}{p(Z)},~&\textrm{Def. Cond. Prob.}\\ &= \frac{p(X,W|Z,Y)p(Z,Y)}{p(Z)},~&\textrm{Def. Cond. Prob.}\\ &= \frac{p(X|Z,Y)p(W|Z,Y)p(Z,Y)}{p(Z)},~&\textrm{First given; Def. Cond. Ind.}\\ &= \frac{p(X,Z,Y)p(W|Z,Y)p(Z,Y)}{p(Z,Y)p(Z)},~&\textrm{Def. Cond. Prob.}\\ &= \frac{p(X,Y|Z)p(Z)p(W|Z,Y)}{p(Z)},~&\textrm{Def. Cond. Prob.}\\ &= p(X|Z)p(Y|Z)p(W|Z,Y),~&\textrm{Second given; Def. Cond. Ind.}\\ &= \frac{p(X|Z)p(Y|Z)p(W,Z,Y)}{p(Z,Y)},~&\textrm{Def. Cond. Prob.}\\ &= \frac{p(X|Z)p(Y|Z)p(Y,W|Z)p(Z)}{p(Z,Y)},~&\textrm{Def. Cond. Prob.}\\ &= \frac{p(X|Z)p(Y,Z)p(Y,W|Z)p(Z)}{p(Z,Y)p(Z)},~&\textrm{Def. Cond. Prob.}\\ &= p(X|Z)p(Y,W|Z).\end{split}\]Does \((X \perp Y|Z) \wedge (X \perp Y|W) \Rightarrow (X \perp Y|Z,W)?\) No.
If W and Z are describing the same event, then this is a true statement, but in general, it fails. If we construct another discrete example using a 4x4 grid where X is true along the bottom, Y is true along the right side, Z is true along the main diagonal and W is true in the bottom right corner, the top left corner, and along the minor diagonal in the middle two rows (not where Z is true), then we’ll have a contradiction. We get the first two statements as being true, \((X \perp Y |Z) \wedge (X \perp Y|W)\), but we’ll find that \(p(X|W,Z) = p(Y|W,Z) = 1/2\) while \(p(X,Y|W,Z) = 1/2\) not 1/4, giving us a contradiction and allowing us to say that the result is not true.
Returns: None.


{% extends '../layout.html' %} {% block title %}BayonJS{% endblock %} {% block content %} BayonJS Say goodbye to callback hell Download A JavaScript server side MVC framework that support ECMAScript 6 Build based on JavaScript I/O A JavaScript platform built on Chrome's V8 runtime. This project began as a fork of Joyent's Node.js™ Learn More Express Fast, unopinionated, minimalist web framework for Node.js Learn More ECMAScript 6 Code support generator function route handler Learn More Socket.IO Socket.IO enables real-time bidirectional event-based communication.  This project began as a fork of Joyent's Node.js™
Fast, unopinionated, minimalist web framework for Node.js
Code support generator function route handler
Socket.IO enables real-time bidirectional event-based communication.
Featuring the fastest and most reliable real-time engine


Agile, enterprising leader skilled at delivering large projects and insightful analytics seeking to implement analytics initiatives following MBA completion.
GPA: 3.63
GPA: 3.70, Cum Laude
Apart from being immersed in analytics, I enjoy spending my time improving my barre skills and biking around Boston. When I am in more tropical locales, I make time to scuba dive.
When indoors, I follow a number of movies and television shows, playing unusual tabletop board games, and I spend a large amount of my free time exploring the latest technology advancements in the world.


Overview
There is increasing need for a source-of-truth for design and front-end development at TeleTracking, and I was given the task of envisioning such a system during my summer internship. Through research, ideation ,and iteration, I brought out a game plan for building a design system and got stakeholder buy-in. I helped the design team transition from older tools to Sketch and started building the web component library.
My Role
UX Intern
The Team
Anna Knabe
(UX Intern)
Timeline
May 2017 - December 2017
1. Workflow Optimization
2. Web Component Library
3. Design System Reference Site Concept
There is no comprehensive repository of recurring UI components and guidelines in either design or front-end development, which makes maintaining consistency throughout the platform a difficult and time-consuming task. Both design and development spend much time communicating about minute pixel details and it is affecting the efficiency of production. There is increasing need for a design system, a source of truth that integrates design and front-end.
Facing the problem with little prior knowledge and guidance, I decided to start from comparative anlaysis and learn about current best practices. After analyzing eight of the best design systems on the market from four dimensions, we found that a good design system uses a taxonomy that fits the needs of the organization, fits in the team's workflow, outlines clear solutions to complex design decisions, is easy to use and share, and is always in sync with the evolution of the product.
We are only human. Currently we are relying on memory and communication. And we have the mentality and drive and communication in place, but the system is not there.
To tailor the current best practices to the needs of our team, we conducted 15 one-on-one interviews with designers, developers, and product managers, and generated over 500 notes. We made an affinity wall of these notes to tell the story of why we need a design system and how we can build a good one. I also asked interviewees about their work flow and made a work flow map from the to highlight the current painpoints in our workflow and places where the design system can help improve.
To analyze the current UI inconsistencies and start building standard UI componenets, I audited all the UI elements across the new cloud-based web applications with my fellow intern. We put the current UI components into emerging categories that will serve as the taxonomy of the new design system. We also categorized the current inconsistencies into visual design, interaction, functionalities, and code bugs.
At the end of the internship, we made the following suggestions:
We presented our project to the entire technology team at the end of the internship and got stakeholder buy-in. Developers started asking when the design system will go live immediately after the presentation, and the design system project had a kick start.
During the internship, I also demonstrated the advantage of using Sketch to build a component-driven design system and helped the team transition from other tools to Sketch. After the internship, I started building the Sketch web component library. Several developers have been building a Javascript plugin to connect our Sketch color palette to CSS variables and lay the foundation for a living design system that can stay in sync with the product.
Navigation
I not only worked on the design system but also thought about different ways of improving the products. One problem I found was that the current top navigation can have three levels of flyouts on hover. It becomes cumbersome and difficult for users to discover. I explored many different navigation options, among which side navigation and mega menu are the two most promising. Side navigation frees more vertical space and indicates user's current location in the complicated hierarchy, but it is harder to implement and may be too different for many users. Mega menu is good for handling three levels of hierarchy, but some tabs do not have that many links to fill a mega menu.
Surgeon Timeline
Involved in the mobile initiative, I brainstormed different ways of showing a surgeon's timeline. The start time of the procedures is usually scheduled beforehand, but the end time is unknown. The problem can be solved by either providing an estimation of the end time or showing the appointments with a gradient block in the schedule.


Mondrian
Choose colors and their distribution,
set up hyperparemetres
and generate picture
Save color chance (%)
Stop chance (%)
Min depth
Max depth
Elongation coefficient
Split round
Split min margin (%)


Heading 1
This is plan text, and is boring
this is special
Here is a
link
Ann Address, Somewhere, AState 00000


Hi guys, girls, wekas.
I am Mathieu and this is my website. It's a project part of my studies at the Enspiral DevAcademy in Wellington.
I am 27, french from Paris, France and I settled down in wellington last November. I really enjoy my time here and I plan to stay a little bit longer. Unfortunately my last job as a recruiter didn't give me the thrill anymore so I decided to look for something else, something new to do where I could use my brain and my will to solve problems.
so I decided to enroll at DevAcademy.
I hope you enjoy this website. Have fun.
Mat


Still working on a dedicated page, but some example projects from class are below.
Pyber required students do produce visualizations which analyzed differet aspects of the fake company Pyber, a not so subtle fictional Uber-like car sharing company.
A large group project in which we determined a hypothetical LCI (Longitudinal Chaos Index) based on analysis of data from the National Longitudinal Survey of Youth 1997.
Data Analytics Certificate Program
Master of Business Administration
Bachelor of Arts, Psychology


Frequency
This command lets user to change the current frequency in MHz.
Velocity Factor
This command prompts user to change the velocity factor. The default value is 1.
The velocity factor is the same for all transmission lines.
Characteristic Impedance
This command lets user to change the characteristic impedance Zo. The default is 50 Ohms.
Transmission lines can have different Zo values.
Transmission Line Design Frequency
This command lets user to change Transmission line design frequency which can be different from the analysis frequency. The Transmission line design frequency is also known as reference frequency.
Element Q
This command lets user to change the Q value of each element.
Since all elements have finite Q values, the Q values are included in the analysis to get more practical results.
The default Q value is 1000000.
Set To Defaults
This command sets the Frequency, Velocity Factor, Zo, Transmission line frequency and Element Qs to their default values.


Pack cell values from separate columns per data type into one list-column
pack( cells, types = data_type, name = "value", drop_types = TRUE, drop_type_cols = TRUE ) unpack(cells, values = value, name = "data_type", drop_packed = TRUE)
| cells | A data frame of cells, one row per cell. For |
|---|---|
| types | For |
| name | A string. For |
| drop_types | For |
| drop_type_cols | For |
| values | For |
| drop_packed | For |
When cells are represented by rows of a data frame, the values of the cells
will be in different columns according to their data type. For example, the
value of a cell containing text will be in a column called chr
(or
character
if it came via tidyxl). A column called data_type
names, for
each cell, which column its value is in.
pack()
rearranges the cell values in a different way, so that they are all
in one column, by
taking each cell value, from whichever column.
making it an element of a list.
naming each element according to the column it came from.
making the list into a new list-column of the original data frame.
By default, the original columns are dropped, and so is the data_type
column.
unpack()
is the complement.
This can be useful for dropping all columns of cells
except the ones that
contain data. For example, tidyxl::xlsx_cells()
returns a very wide data
frame, and to make it narrow you might do:
select(cells, row, col, character, numeric, date)
But what if you don't know in advance that the data types you need are
character
, numeric
and date
? You might also need logical
and
error
.
Instead, pack()
all the data types into a single column, select it, and
then unpack.
pack(cells) %>% select(row, col, value) %>% unpack()
unpack
: Unpack cell values from one list-column into separate columns per data type
#> foo bar #> 1 1 a #> 2 2 b# The same data, represented by one row per cell, with integer values in the # `int` column and character values in the `chr` column. x <- as_cells(w) x#> # A tibble: 4 x 5 #> row col data_type chr int #> <int> <int> <chr> <chr> <int> #> 1 1 1 int NA 1 #> 2 2 1 int NA 2 #> 3 1 2 chr a NA #> 4 2 2 chr b NA# pack() and unpack() are complements pack(x)#> # A tibble: 4 x 3 #> row col value #> <int> <int> <named list> #> 1 1 1 <int [1]> #> 2 2 1 <int [1]> #> 3 1 2 <chr [1]> #> 4 2 2 <chr [1]>unpack(pack(x))#> # A tibble: 4 x 5 #> row col data_type chr int #> <int> <int> <chr> <chr> <int> #> 1 1 1 int NA 1 #> 2 2 1 int NA 2 #> 3 1 2 chr a NA #> 4 2 2 chr b NA# Drop non-data columns from a wide data frame of cells from tidyxl if (require(tidyxl)) { cells <- tidyxl::xlsx_cells(system.file("extdata", "purpose.xlsx", package = "unpivotr")) cells pack(cells) %>% dplyr::select(row, col, value) %>% unpack() }#>#> # A tibble: 1,721 x 7 #> row col data_type blank character error numeric #> <int> <int> <chr> <lgl> <chr> <chr> <dbl> #> 1 1 1 character NA The data is 'Sense of purpose by h… NA NA #> 2 2 1 character NA It can be found in the section 'Pe… NA NA #> 3 3 1 character NA The description provided by Statis… NA NA #> 4 5 1 character NA The 2014 New Zealand General Socia… NA NA #> 5 6 1 character NA It provides new and redeveloped da… NA NA #> 6 7 1 character NA Symbols used in this table: NA NA #> 7 8 1 character NA S - Data has been suppressed. NA NA #> 8 9 1 character NA * - Relative sampling error of 50 … NA NA #> 9 10 1 character NA For more tables using the NZGSS 20… NA NA #> 10 11 1 character NA Data quality NA NA #> # … with 1,711 more rows


Trent Boult likely to miss second Test due to pain in ribs
by AgenciesHAMILTON: Trent Boult is likely to miss the second Test of New Zealand’s series against England after leaving the field due to a pain in the right-hand side of his ribs on the fifth day of the first Test.
Boult, who bowled one over on the final day before going off, will undergo an MRI scan tomorrow to determine the extent of the injury. In his absence, his fellow left-arm quick Neil Wagner stepped up with five wickets to seal an innings-and-65-run victory.
The second Test at Hamilton starts on Friday, and with New Zealand starting a three-match series in Australia soon after that fixture, it seems unlikely he will be risked. Lockie Ferguson and Matt Henry are the other seam-bowling options in the 15-man squad.
Boult has missed only three Tests since 2016, and just six of New Zealand’s 70 since his debut.
“A lot was taken out of both teams in this Test,” Kane Williamson, New Zealand’s captain, said. “It was a really tough effort for long periods. But we have that squad of 15 and all the guys will meet up in Hamilton and we will have to assess the fitness of everybody.”


We got networks!
- incubate impactful ROI
- exploit mission-critical portals
- enhance world-class content
- leverage vertical niches
- enable wireless synergies
- maximize synergistic web-readiness
- implement distributed architectures
- recontextualize one-to-one models
- redefine impactful interfaces


Online Meeting Planner
Plan your meeting without hassle!
Event
Event created!
Indicate your availability by clicking on the time slot now.
Click to copy the event code:
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30