2020
-
Three-Dimensional Active Defect Loops
Binysh, J.,
Kos, Z.,
Copar, S.,
Ravnik, M.,
and
Alexander, G. P.
Phys. Rev. Lett.
2020
- Editors Suggestion at PRL. Recommended with commentary by the Journal Club for Condensed Matter Physics.
[HTML]
-
Geometry of Bend: Singular Lines and Defects in Twist-Bend Nematics
Binysh, J.,
Pollard, J.,
and
Alexander, G. P.
Phys. Rev. Lett.
2020
[HTML]
2019
-
Stable and unstable vortex knots in excitable media
Binysh, J,
Whitfield, C. A.,
and
Alexander, G. P.
Phys. Rev. E
2019
[HTML]
2018
-
Maxwell’s theory of solid angle and the construction of knotted fields
Binysh, J,
and
Alexander, G. P.
J. Phys. A: Math. Theor.
2018
[HTML]


Prediction methods where explanatory information is coded as a matrix of distances between individuals. Distances can either be directly input as a distances matrix, a squared distances matrix, an inner-products matrix or computed from observed predictors.
| Version: | 1.0.5 |
| Depends: | R (≥ 2.10.0), cluster, pls |
| Suggests: | proxy |
| Published: | 2017-10-17 |
| Author: | Boj, Eva, Caballe, Adria, Delicado, Pedro and Fortiana, Josep. |
| Maintainer: | Josep Fortiana <fortiana at ub.edu> |
| License: | GPL-2 |
| NeedsCompilation: | no |
| Materials: | NEWS |
| In views: | FunctionalData |
| CRAN checks: | dbstats results |
| Reference manual: | dbstats.pdf |
| Package source: | dbstats_1.0.5.tar.gz |
| Windows binaries: | r-devel: dbstats_1.0.5.zip, r-release: dbstats_1.0.5.zip, r-oldrel: dbstats_1.0.5.zip |
| OS X binaries: | r-release: dbstats_1.0.5.tgz, r-oldrel: dbstats_1.0.5.tgz |
| Old sources: | dbstats archive |
Please use the canonical form https://CRAN.R-project.org/package=dbstats to link to this page.


volume carbon HWP wood substitution effect domestic storage production HWPs change reduction year energy emissions future consumption derived forests roundwood building scenario, annual mitigation represents use wooden scenarios BAU furniture civil forest usage MtC \documentclass[pt]{minimal} \setlength{\oddsidemargin}{-pt} \usepackage{amsbsy} \usepackage{amsfonts} \usepackage{amsmath} \usepackage{amssymb} \usepackage{mathrsfs} \usepackage{upgreek} \usepackage{wasysym} attributable climate material Carbon Fig. Japan, estimated logging used {border-style Japan assumed balance nationwide construction model products px;} residue, stock using #ffffff;} Agg increase region Climate intensity proportion taken \cdot engineering flow current west (kgC harvested non-wooden Forestry Ministry construction, effect, emission residue Change However, Research Sci previous scenario study waste Policy \left( central location overall paper processing production, promotion Environ Forest Int Japanese east guardrails lifetime piles plywood produced sawnwood scenarios, (sawnwood, Japan. Manag Mod Plan aggressive area based changes forestry maximum new plywood) px; result volume, {font-family Balance Exp Kyoto \right)} account cylindrical engineering, equivalent font-size forests. furniture, generated harvesting moderate product rate regions shown use, value (.) Agriculture, Ecol Energy Eqs. Kayo Material Parties Tonosaki actual addition, approach breakdown central, domestically double; floor forests, global integrated metal potential r\left( research substitution, (half-life) (tC (the (year) ./j.envsci... ./s--- Environmental Looking Protocol Report Table Tsunetsugu United Wood according application approach, border-color border-width consumption, demand expected figure fossil gas given impact kgC large line making management model, outlined plywood, regards relating residue. sawnwood, significant solid; study, unit {font-style {font-weight (east, (including (roundwood, ./j.foreco... Annual Eq. Forestry, Forests Furthermore, Hashimoto Institute Intergovernmental KAKENHI National Panel Products \left\{ \right) \right\}$$\end{document} \sum_{n} assigned bold buildings business compared conducted conservation consideration consumed country’s courier; dioxide distributed effect. em; estimation fuels greenhouse increases level manuscript. poles) promoted, pt;} regional relevant remain report. results scenario. section. sector set statistics supply tree usage, usual values wood. years). yielded {\text{Exp}}\left\{ −), −).


Practical Magic (1998) - Sandra Bullock, Nicole Kidman, Stockard Channing, Dianne Wiest, and lots of people we'll never hear from again because this movie utterly ruined their careers
I don't know why, but witchcraft sells movie tickets. From "The Craft" to "The Witches of Eastwick," movies can instantly make a respectable profit just by invoking the magic of, well, magic.
In deference to 100 years of Hollywood, I won't delve into the myriad religious inaccuracies all those movies, and the new "Practical Magic," are filled with. The truth about witches wouldn't sell many tickets.
Sandra Bullock and Nicole Kidman, on the other hand, sell tickets in spades. In "Practical Magic" they play sisters, Sally and Gillian Owens, trying to shake off a family curse.
Of course, this happens to Sally's husband (Mark Feuerstein), then to Gillian's latest fling, Jimmy Angelov (Goran Visnjic).  He keeps coming back from the dead, and hilarity ensues.
Or at least it's supposed to.
For some reason, "Practical Magic" is billed as a dark romantic comedy. (No, it doesn't sound terribly romantic or even funny.) There is a bit of comedy, though it's sparse and not terribly well-done. There's even a bit of romance, but it doesn't show up until nearly an hour into the film. When it does, it finally takes the form of Aidan Quinn as a cop from Arizona trying to track Jimmy down.
The cast is top-notch. Bullock and Kidman are both capable actresses and have plenty of on-screen chemistry. They laugh and fight and jug as sisters do, and in the process almost manage to save the movie from the bottom of the barrel.
Stockard Channing and Dianne Wiest play the family's eccentric aunts, but they seem restrained and not nearly as eccentric as they should be. Visnjic, in the inherently juicy role of villain, is fun to watch in that guilty-pleasure sort of way, but he doesn't get as much screen time as his subplot deserves.
Sadly, even magic can't salvage very much of what was a very good idea. "Practical Magic" is based on the novel by Alice Hoffman; for the five bucks your movie ticket will cost, you can take the book home with you. The only reason to see the movie would be the popcorn.
...dave
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Cookies are read and written through ActionController#cookies. The cookies being read are what were received along with the request, the cookies being written are what will be sent out with the response. Cookies are read by value (so you won’t get the cookie object itself back — just the value it holds). Examples for writing:
cookies[:user_name] = "david" # => Will set a simple session cookie cookies[:login] = { :value => "XJ-122", :expires => Time.now + 360} # => Will set a cookie that expires in 1 hour
Examples for reading:
cookies[:user_name] # => "david" cookies.size # => 2
Example for deleting:
cookies.delete :user_name
All the option symbols for setting cookies are:
- value - the cookie’s value or list of values (as an array).
- path - the path for which this cookie applies. Defaults to the root of the application.
- domain - the domain for which this cookie applies.
- expires - the time at which this cookie expires, as a Time object.
- secure - whether this cookie is a secure cookie or not (default to false). Secure cookies are only transmitted to HTTPS servers.
Methods
Protected Instance methods
Deprecated cookie writer method
[ show source ]
# File vendor/rails/actionpack/lib/action_controller/cookies.rb, line 34 34: def cookie(*options) 35: @response.headers["cookie"] << CGI::Cookie.new(*options) 36: end
Returns the cookie container, which operates as described above.
[ show source ]
# File vendor/rails/actionpack/lib/action_controller/cookies.rb, line 29 29: def cookies 30: CookieJar.new(self) 31: end


GxCellEditors
Classes
GxCellEditorAbstract
GxCellEditorBasicBoolean
GxCellEditorBasicBooleanRichSelect
GxCellEditorBasicBooleanSelect
GxCellEditorBasicDate
GxCellEditorBasicDateTime
GxCellEditorBasicNumber
GxCellEditorBasicText
GxCellEditorBasicTime
GxCellEditorBasicTimestamp
GxCellEditorComparator
GxCellEditorLargeText
GxCellEditorPopupSelect
GxCellEditorPopupText
GxCellEditorRichSelect
GxCellEditorSelect
GxCellEditorSuggestion
GxCellEditorSuggestionResolver
GxCellEditorText
Interfaces
GxCellEditorInterface
GxCellEditorSuggestionResolverInterface


The index view in this demo application fetches the latest 3 orders and products and makes them available as context variables orders and products.
Check out the home/index.html template
This is the Django template you are currently looking at. It is located at:
home/templates/home/index.html
Have a look at the markup and Django template code to see how the Shopify API is being used.
Additional documentation
Become an expert:
API documentationThe reference: what you can do with the Shopify API.
WikiGet more information and share your knowledge.
ForumAsk questions and see what others already wanted to know.
Once you're ready
We'd love to see what you create using the Shopify API.
Find out how to share your application with the world and read the latest information on the API Publishing Page.


If you need help planning a web project or have one ready to go why not reach out. We can help.
Today see's the launch of Beach Hut's new website. We wanted something distinctive, bold and colorful and a little different from most of the other online web deisgn websites and I think we have acheived that. I'm sure it will go through some iterations and tweaks in the coming weeks but we hope you like it.
A well designed website is now more important than ever for companies and individuals to succeed online.
A lot of work goes into building and branding a new website and sometimes you can lose track of your overall goals during the process but our goals have always been simple. We want to do great work for great clients.
A well designed website is now more important than ever for companies and individuals to succeed online. Consumers expectations for websites have increased significantly especially in recent years. Also the shift to mobile viewing with over 50% of all web traffic being viewed on mobile devices predicted by the end of this year, means mobile has never been more important.


The tab allows you to compare the VD, VJ and DJ heatmaps of multiple donors to each other.
By ticking the include box of a donor, the three heatmaps of this donor is visualized underneath eachother. By clicking the include box of multiple replicates the heatmaps of these replicates are visualized next to each other allowing easy comparison of heatmaps.


Predefined spaces¶
-
model.predefined_spaces.
ConstraintsForLineExtremeNodes
(lineSet, constraint)¶ Apply constraint on the extreme nodes of a model line.
-
model.predefined_spaces.
ConstraintsForLineInteriorNodes
(lineSet, constraint)¶ Apply constraint on the interior nodes of a model line.
-
class
model.predefined_spaces.
PredefinedSpace
(nodes, dimSpace, numGdls)¶ Bases:
object
-
setBearing
(iNod, bearingMaterials, orientation=None)¶ Modelize a bearing on X, XY or XYZ directions.
- Args:
param iNod: (int) node identifier (tag). param bearingMaterials (list): material names for the zero length element. param orientation: (list) vectors used to orient the zero length element; (x,yp) x: axis of the element, yp: vector that lies on the xy plane of the element. - Returns:
rtype: (int, int) new node tag, new element tag.
-
setBearingBetweenNodes
(iNodA, iNodB, bearingMaterials, orientation=None)¶ Modelize a bearing between the nodes
- Args:
param iNodA: (int) first node identifier (tag). param iNodB: (int) second node identifier (tag). param bearingMaterials: (list) material names for the zero length element. param orientation: (list) vectors used to orient the zero length element; (x,yp) x: axis of the element, yp: vector that lies on the xy plane of the element.
Returns: newly created zero length element that represents the bearing.
-
setBearingOnX
(iNod, bearingMaterial)¶ Modelize a bearing on X direction.
- Args:
iNod (int): node identifier (tag). bearingMaterial (string): material name for the zero length
element.
-
setBearingOnXYRigZ
(iNod, bearingMaterials)¶ Modelize a non rigid on X and Y directions and rigid on Z bearing.
- Args:
iNod (int): node identifier (tag). bearingMaterial (string): material name for the zero length
element.
-
setFulcrumBetweenNodes
(nodeTagA, pivotNode)¶ Create a fulcrum between the nodes passed as parameters.
Creates a rigid link between the nodes. It’s called fulcrumb because it’s pinned on pivotNode.
Parameters: - nodeTagA – tag of the master node.
- nodeTagB – tag of the pivot (slave node).
-
setPreprocessor
(preprocessor)¶ Sets suitable values for the members from the dimension of the space and the number of DOFs for each node obtained from the argument.
Parameters: preprocessor – preprocessor of the finite element problem.
-
setPrescribedDisplacements
(nodeTag, prescDisplacements)¶ Prescribe displacement for node DOFs.
Parameters: - nodeTag – tag of the node.
- prescDisplacements – (list) values of the displacements.
-
setRigidBeamBetweenNodes
(nodeTagA, nodeTagB)¶ Create a rigid rod between the nodes passed as parameters.
Parameters: - nodeTagA – tag of the master node.
- nodeTagB – tag of the slave node.
-
setRigidRodBetweenNodes
(nodeTagA, nodeTagB)¶ Create a rigid rod between the nodes passed as parameters.
Parameters: - nodeTagA – tag of the master node.
- nodeTagB – tag of the slave node.
-
setUniaxialBearing2D
(iNod, bearingMaterial, direction)¶ Modelize an uniaxial bearing on the defined direction.
- Args:
iNod (int): node identifier (tag). bearingMaterial (str): material name for the zero length
element.- Returns:
rtype: (int, int) new node tag, new element tag.
-
-
class
model.predefined_spaces.
SolidMechanics2D
(nodes)¶ Bases:
model.predefined_spaces.PredefinedSpace
-
getDisplacementDOFs
()¶ Return the indices of the displacement DOFs.
-
getDisplacementVector
(nodeTag)¶ Return a vector with the displacement components of the node motion.
-
getRotationalDOFs
()¶ Return the indices of the rotational DOFs.
-
-
class
model.predefined_spaces.
SolidMechanics3D
(nodes)¶ Bases:
model.predefined_spaces.PredefinedSpace
-
fixNode000
(nodeTag)¶ Restrain all three node DOFs (i. e. make them zero).
-
getDisplacementDOFs
()¶ Return the indices of the displacement DOFs.
-
getDisplacementVector
(nodeTag)¶ Return a vector with the displacement components of the node motion.
-
getRotationalDOFs
()¶ Return the indices of the rotational DOFs.
-
-
class
model.predefined_spaces.
StructuralMechanics2D
(nodes)¶ Bases:
model.predefined_spaces.PredefinedSpace
-
fixNode000
(nodeTag)¶ Restrain all three node DOFs (i. e. make them zero).
-
fixNode00F
(nodeTag)¶ Restrain only displacement DOFs (i. e. Ux= 0 and Uy= 0).
-
fixNode0F0
(nodeTag)¶ Restrain all three node DOFs (i. e. make them zero).
-
fixNode0FF
(nodeTag)¶ Restrain only X displacement DOF (i. e. Ux= 0).
-
fixNodeF0F
(nodeTag)¶ Restrain only Y displacement DOF (i. e. Uy= 0).
-
fixNodeFF0
(nodeTag)¶ Restrain only rotation DOF (i. e. Theta= 0).
-
fixNodesLine
(line)¶ Restrain all DOFs of the line nodes.
-
getDisplacementDOFs
()¶ Return the indices of the displacement DOFs.
-
getDisplacementVector
(nodeTag)¶ Return a vector with the displacement components of the node motion.
-
getRotationalDOFs
()¶ Return the indices of the rotational DOFs.
-
newCorotCrdTransf
(trfName)¶ Creates a new 2D corotational transformation.
Parameters: trfName – name for the new transformation.
-
newLinearCrdTransf
(trfName)¶ Creates a new 2D linear transformation.
Parameters: trfName – name for the new transformation.
-
newPDeltaCrdTransf
(trfName)¶ Creates a new 2D PDelta transformation.
Parameters: trfName – name for the new transformation.
-
-
class
model.predefined_spaces.
StructuralMechanics3D
(nodes)¶ Bases:
model.predefined_spaces.PredefinedSpace
-
LstNodes6DOFConstr
(lstNodes, constrCond)¶ Constraint the nodes in the list passed as parameter according to given 6-values set of constraints conditions
Parameters: - preprocessor – preprocessor
- lstNodes – list of nodes to which apply the constraints
- constrCond –
- list of constraint conditions, expressed as
- [uX, uY, uZ,rotX, rotY, rotZ], where:
- uX, uY, uZ: translations in the X, Y and Z directions;
- rotX, rotY, rotZ: rotations about the X, Y and Z axis
- ‘free’: means no constraint values
-
fixNode
(DOFpattern, nodeTag)¶ Restrain DOF of a node according to the DOFpattern, which is a given string of type ‘0FF_00F’ that matches the DOFs (uX,uY,uZ,rotX,rotY,rotZ) where ‘F’ means FREE and ‘0’ means constrained with value=0 Note: DOFpaterns ‘0FF_00F’,‘0FF00F’,‘0_FF_0_0F’, ... are equivalent
-
fixNode000_000
(nodeTag)¶ Restrain all six node DOFs (i. e. make them zero).
-
fixNode000_00F
(nodeTag)¶ Restrain all DOFs except for the rotation about Z axis.
-
fixNode000_0F0
(nodeTag)¶ Restrain all DOFs except for the rotation about Y axis.
-
fixNode000_0FF
(nodeTag)¶ Restrain the displacements (Ux,Uy and Uz) and the rotation about X axis.
-
fixNode000_F00
(nodeTag)¶ Restrain all DOFs except for the rotation about X axis.
-
fixNode000_F0F
(nodeTag)¶ Restrain the displacements (Ux,Uy and Uz) and the rotation about Y axis.
-
fixNode000_FF0
(nodeTag)¶ Restrain the displacements (Ux,Uy and Uz) and the rotation about Z axis.
-
fixNode000_FFF
(nodeTag)¶ Restrain only displacement DOFs (i. e. Ux= 0, Uy= 0 and Uz= 0).
-
fixNode0F0_FFF
(nodeTag)¶ Restrain only displacement DOFs (i. e. Ux= 0 and Uz= 0).
-
fixNodeF00_00F
(nodeTag)¶ Restrain all DOFs except for X displacement and the rotation about Z axis.
-
fixNodeF00_0F0
(nodeTag)¶ Restrain all DOFs except for X displacement and the rotation about Y axis.
-
fixNodeF00_0FF
(nodeTag)¶ Restrain all DOFs except for X displacement and the rotations about Y and Z axis.
-
fixNodeF00_F00
(nodeTag)¶ Restrain all DOFs except for X displacement and the rotation about X axis.
-
fixNodeFFF_000
(nodeTag)¶ Restrain only rotations (i. e. ThetaX= 0, ThetaY= 0 and ThetaZ= 0).
-
getDisplacementDOFs
()¶ Return the indices of the displacement DOFs.
-
getDisplacementVector
(nodeTag)¶ Return a vector with the displacement components of the node motion.
-
getRotationalDOFs
()¶ Return the indices of the rotational DOFs.
-
newCorotCrdTransf
(trfName, xzVector)¶ Creates a new 3D corotational transformation.
Parameters: - trfName – name for the new transformation.
- xzVector – vector defining transformation XZ plane.
-
newLinearCrdTransf
(trfName, xzVector)¶ Creates a new 3D linear transformation.
Parameters: - trfName – name for the new transformation.
- xzVector – vector defining transformation XZ plane.
-
newPDeltaCrdTransf
(trfName, xzVector)¶ Creates a new 3D PDelta transformation.
Parameters: - trfName – name for the new transformation.
- xzVector – vector defining transformation XZ plane.
-
setHugeBarBetweenNodes
(nodeTagA, nodeTagB, nmbTransf)¶ Creates a very stiff bar between the two nodes being passed as parameters. (it was a workaround to the problem with the reactions values in nodes when using multipoint constraints. This problem has been be solved with the implementation of MFreedom_ConstraintBase::addResistingForceToNodalReaction).
Parameters: - nodeTagA – tag of bar’s from node.
- nodeTagB – tag of bar’s to node.
- nmbTransf – name of the coordinate transformation to use for the new bar.
-
-
model.predefined_spaces.
gdls_elasticidad2D
(nodes)¶ Defines the dimension of the space: nodes by two coordinates (x,y) and two DOF for each node (Ux,Uy)
Parameters: nodes – nodes loader
-
model.predefined_spaces.
gdls_elasticidad3D
(nodes)¶ - Defines the dimension of the space: nodes by three coordinates (x,y,z)
- and three DOF for each node (Ux,Uy,Uz)
Parameters: nodes – preprocessor nodes loader
-
model.predefined_spaces.
gdls_resist_materiales2D
(nodes)¶ Defines the dimension of the space: nodes by two coordinates (x,y) and three DOF for each node (Ux,Uy,theta)
Parameters: nodes – preprocessor nodes loader
-
model.predefined_spaces.
gdls_resist_materiales3D
(nodes)¶ Define the dimension of the space: nodes by three coordinates (x,y,z) and six DOF for each node (Ux,Uy,Uz,thetaX,thetaY,thetaZ)
Parameters: nodes – preprocessor nodes loader
-
model.predefined_spaces.
getModelSpace
(preprocessor)¶ Return a PredefinedSpace from the dimension of the space and the number of DOFs for each node obtained from the preprocessor.
Parameters: preprocessor – preprocessor of the finite element problem.
-
model.predefined_spaces.
getStructuralMechanics2DSpace
(preprocessor)¶ Return a PredefinedSpace from the dimension of the space and the number of DOFs for each node obtained from the preprocessor.
Parameters: preprocessor – preprocessor of the finite element problem.
-
model.predefined_spaces.
getStructuralMechanics3DSpace
(preprocessor)¶ Return a PredefinedSpace from the dimension of the space and the number of DOFs for each node obtained from the preprocessor.
Parameters: preprocessor – preprocessor of the finite element problem.


Synergy Stopped Scrobbling
-
insaneidiot
Since I updated Synergy yesterday, it has stopped scrobbling to last.fm. Does anyone know how to fix this issue? I entered my information for last.fm and it still won't scrobble.
On another note, is there a way to get Synergy to start at startup but not launch iTunes? Any help would be appreciated.
-
Greg Hurrell
I am guessing that you are using the 3.5 alpha series. The Audioscrobbler issues is being investigated here:
http://wincent.com/a/support/bugs/show_bug.cgi?id=641
Please contribute logs to that bug report if you have any.
iTunes launching at start up is being tracked here:
http://wincent.com/a/support/bugs/show_bug.cgi?id=639
That one should be fairly straightforward to fix, so keep an eye on that report for updates.
-
Greg Hurrell
Ah, and I should note that if either of this problems is a "show stopper" for you, the 3.2 series is still available for download here:
http://wincent.com/a/products/synergy-classic/download/tiger/
Unlike the 3.5 series which is a total rewrite and definitely "experimental", the 3.2 series is rock-solid and works on any version of Mac OS X from Jaguar through to Leopard.
-
insaneidiot
Ok, I will check those out. Thanks for the help. Audio scrobbling is what I basically bought Synergy for because the last.fm one really blows. Hopefully the scrobbling issue will be solved in 3.5 soon. I'll go back to 3.2 for now.
-
Greg Hurrell
For your information, the scrobbler issue was fixed a few days ago. The latest nightlies include the fix:
http://wincent.com/a/about/wincent/weblog/nightlog/archives/synergy/
And I'll be doing a 3.5a5 release soon.
-
insaneidiot
Thanks for the update. I'm looking forward to future releases. I'll stick to 3.2 for now. Also, one thing that was bugging me today was that the artist's font was really small in the heads up display when a new song plays. Could you add a function that lets us modify the font size or is there already that function in 3.2 that I missed?
-
Greg Hurrell
Originally Posted By: insaneidiotCould you add a function that lets us modify the font size or is there already that function in 3.2 that I missed?
Not yet, but I have quiet a few different customization options in mind for the Floater.
Reply
This topic is now closed.


I would like propose to your attention the list of hotkeys, the use of which makes the work with the Windows 7 more usability. Some hotkeys may be available in Windows 8.
Manage windows
- Win + Home - Minimize/Maximize all windows, but active. («Shake» the window)
- Win + Space - Make all windows transparent
- Win + Up - Maximize active window full screen.
- Win + Down - Minimize active window or restore previous size, if it maximized on full screen.
- Shift + Win + Up - Expand the window height (drag the bottom border of the window to the taskbar)
- Win + left/Right - Take the window left / right side of the monitor, or restore the size (drag the window to the left / right all the way)
Taskbar
- Win + digit - Run the program with that number, or switch to it.
- Shift + Win + digit - Launch a new copy of the program under this number (click on the wheel icon).
- Ctrl + Win + digit - Switch to the next window in that number (click, hold Ctrl).
- Alt + Win + digit - Open jump list program under this number.
- Win + T(+ Shift) - Switch between all open windows on the taskbar thumbnails in the forward (reverse) order.
- Win + B - Focus on the tray.
- Ctrl + Shift + Click - Run this program as an administrator.
- Shift + Right-click - Show the window menu / group.
Explorer (and Desktop)
- Ctrl + Shift + N - Create new folder.
- Alt + Up - To rise to a higher level by folder.
- Alt + P - Enable file browsing panel.
- Shift + Right-Click (on file) - Adds a context menu item “Copy path” and a lot of additional items in the menu “Send”
- Shift + Right-Click (on a folder) - Adds a context menu that lets you open a command prompt in that folder.
Other
- Win + P - Open setting menu presentation (second monitor - projector)
- Win + (+/-) - zoom in / zoom out (causes Magnifier).
- Win + G - Switch between running gadgets.


Seems your browser doesn't support Javascript! Websocket relies on Javascript being enabled. Please enable Javascript and reload this page!
Connect
Connect binary
Disconnect
Disconnect binary
What is your name?
Send
What is your binary name?
Send binary


Recommended Reading:
Our basic assumption when we derived the OLS equations was to assume that our output is determined by a given continuous function \( f(\boldsymbol{x}) \) and a random noise \( \boldsymbol{\epsilon} \) given by the normal distribution with zero mean value and an undetermined variance \( \sigma^2 \).
We found above that the outputs \( \boldsymbol{y} \) have a mean value given by \( \boldsymbol{X}\hat{\boldsymbol{\beta}} \) and variance \( \sigma^2 \). Since the entries to the design matrix are not stochastic variables, we can assume that the probability distribution of our targets is also a normal distribution but now with mean value \( \boldsymbol{X}\hat{\boldsymbol{\beta}} \). This means that a single output \( y_i \) is given by the Gaussian distribution
$$ y_i\sim \mathcal{N}(\boldsymbol{X}_{i,*}\boldsymbol{\beta}, \sigma^2)=\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}. $$We assume now that the various \( y_i \) values are stochastically distributed according to the above Gaussian distribution. We define this distribution as
$$ p(y_i, \boldsymbol{X}\vert\boldsymbol{\beta})=\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}, $$which reads as finding the likelihood of an event \( y_i \) with the input variables \( \boldsymbol{X} \) given the parameters (to be determined) \( \boldsymbol{\beta} \).
Since these events are assumed to be independent and identicall distributed we can build the probability distribution function (PDF) for all possible event \( \boldsymbol{y} \) as the product of the single events, that is we have
$$ p(\boldsymbol{y},\boldsymbol{X}\vert\boldsymbol{\beta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}=\prod_{i=0}^{n-1}p(y_i,\boldsymbol{X}\vert\boldsymbol{\beta}). $$We will write this in a more compact form reserving \( \boldsymbol{D} \) for the domain of events, including the ouputs (targets) and the inputs. That is in case we have a simple one-dimensional input and output case
$$ \boldsymbol{D}=[(x_0,y_0), (x_1,y_1),\dots, (x_{n-1},y_{n-1})]. $$In the more general case the various inputs should be replaced by the possible features represented by the input data set \( \boldsymbol{X} \). We can now rewrite the above probability as
$$ p(\boldsymbol{D}\vert\boldsymbol{\beta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}. $$It is a conditional probability (see below) and reads as the likelihood of a domain of events \( \boldsymbol{D} \) given a set of parameters \( \boldsymbol{\beta} \).
In statistics, maximum likelihood estimation (MLE) is a method of estimating the parameters of an assumed probability distribution, given some observed data. This is achieved by maximizing a likelihood function so that, under the assumed statistical model, the observed data is the most probable.
We will assume here that our events are given by the above Gaussian distribution and we will determine the optimal parameters \( \beta \) by maximizing the above PDF. However, computing the derivatives of a product function is cumbersome and can easily lead to overflow and/or underflowproblems, with potentials for loss of numerical precision.
In practice, it is more convenient to maximize the logarithm of the PDF because it is a monotonically increasing function of the argument. Alternatively, and this will be our option, we will minimize the negative of the logarithm since this is a monotonically decreasing function.
Note also that maximization/minimization of the logarithm of the PDF is equivalent to the maximization/minimization of the function itself.
We could now define a new cost function to minimize, namely the negative logarithm of the above PDF
$$ C(\boldsymbol{\beta})=-\log{\prod_{i=0}^{n-1}p(y_i,\boldsymbol{X}\vert\boldsymbol{\beta})}=-\sum_{i=0}^{n-1}\log{p(y_i,\boldsymbol{X}\vert\boldsymbol{\beta})}, $$which becomes
$$ C(\boldsymbol{\beta})=\frac{n}{2}\log{2\pi\sigma^2}+\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}. $$Taking the derivative of the new cost function with respect to the parameters \( \beta \) we recognize our familiar OLS equation, namely
$$ \boldsymbol{X}^T\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right) =0, $$which leads to the well-known OLS equation for the optimal paramters \( \beta \)
$$ \hat{\boldsymbol{\beta}}^{\mathrm{OLS}}=\left(\boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}! $$If we combine the conditional probability with the marginal probability and the standard product rule, we have
$$ p(X\vert Y)= \frac{p(X,Y)}{p(Y)}, $$which we can rewrite as
$$ p(X\vert Y)= \frac{p(X,Y)}{\sum_{i=0}^{n-1}p(Y\vert X=x_i)p(x_i)}=\frac{p(Y\vert X)p(X)}{\sum_{i=0}^{n-1}p(Y\vert X=x_i)p(x_i)}, $$which is Bayes' theorem. It allows us to evaluate the uncertainty in in \( X \) after we have observed \( Y \). We can easily interchange \( X \) with \( Y \).
The quantity \( p(Y\vert X) \) on the right-hand side of the theorem is evaluated for the observed data \( Y \) and can be viewed as a function of the parameter space represented by \( X \). This function is not necesseraly normalized and is normally called the likelihood function.
The function \( p(X) \) on the right hand side is called the prior while the function on the left hand side is the called the posterior probability. The denominator on the right hand side serves as a normalization factor for the posterior distribution.
We will play around with a study of the values for the optimal parameters \( \boldsymbol{\beta} \) using OLS, Ridge and Lasso regression. For OLS, you will notice as function of the noise and polynomial degree, that the parameters \( \beta \) will fluctuate from order to order in the polynomial fit and that for larger and larger polynomial degrees of freedom, the parameters will tend to increase in value for OLS.
For Ridge and Lasso regression, the higher order parameters will typically be reduced, providing thereby less fluctuations from one order to another one.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import linear_model
def R2(y_data, y_model):
return 1 - np.sum((y_data - y_model) ** 2) / np.sum((y_data - np.mean(y_data)) ** 2)
def MSE(y_data,y_model):
n = np.size(y_model)
return np.sum((y_data-y_model)**2)/n
# Make data set.
n = 10000
x = np.random.rand(n)
y = np.exp(-x**2) + 1.5 * np.exp(-(x-2)**2)+ np.random.randn(n)
Maxpolydegree = 5
X = np.zeros((len(x),Maxpolydegree))
X[:,0] = 1.0
for polydegree in range(1, Maxpolydegree+1):
for degree in range(polydegree):
X[:,degree] = x**(degree)
# We split the data in test and training data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# matrix inversion to find beta
OLSbeta = np.linalg.pinv(X_train.T @ X_train) @ X_train.T @ y_train
print(OLSbeta)
ypredictOLS = X_test @ OLSbeta
print("Test MSE OLS")
print(MSE(y_test,ypredictOLS))
# Repeat now for Lasso and Ridge regression and various values of the regularization parameter using Scikit-Learn
# Decide which values of lambda to use
nlambdas = 4
MSERidgePredict = np.zeros(nlambdas)
MSELassoPredict = np.zeros(nlambdas)
lambdas = np.logspace(-3, 1, nlambdas)
for i in range(nlambdas):
lmb = lambdas[i]
# Make the fit using Ridge and Lasso
RegRidge = linear_model.Ridge(lmb,fit_intercept=False)
RegRidge.fit(X_train,y_train)
RegLasso = linear_model.Lasso(lmb,fit_intercept=False)
RegLasso.fit(X_train,y_train)
# and then make the prediction
ypredictRidge = RegRidge.predict(X_test)
ypredictLasso = RegLasso.predict(X_test)
# Compute the MSE and print it
MSERidgePredict[i] = MSE(y_test,ypredictRidge)
MSELassoPredict[i] = MSE(y_test,ypredictLasso)
print(lmb,RegRidge.coef_)
print(lmb,RegLasso.coef_)
# Now plot the results
plt.figure()
plt.plot(np.log10(lambdas), MSERidgePredict, 'b', label = 'MSE Ridge Test')
plt.plot(np.log10(lambdas), MSELassoPredict, 'r', label = 'MSE Lasso Test')
plt.xlabel('log10(lambda)')
plt.ylabel('MSE')
plt.legend()
plt.show()
How can we understand this?
Let us write out the values of the coefficients \( \beta_i \) as functions of the polynomial degree and noise. We will focus only on the Ridge results and some few selected values of the hyperparameter \( \lambda \).
If we don't include any noise and run this code for different values of the polynomial degree, we notice that the results for \( \beta_i \) do not show great changes from one order to the next. This is an indication that for higher polynomial orders, our parameters become less important.
If we however add noise, what happens is that the polynomial fit is trying to adjust the fit to traverse in the best possible way all data points. This can lead to large fluctuations in the parameters \( \beta_i \) as functions of polynomial order. It will also be reflected in a larger value of the variance of each parameter \( \beta_i \). What Ridge regression (and Lasso as well) are doing then is to try to quench the fluctuations in the parameters of \( \beta_i \) which have a large variance (normally for higher orders in the polynomial).
import numpy as np
import pandas as pd
from IPython.display import display
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import linear_model
# Make data set.
n = 1000
x = np.random.rand(n)
y = np.exp(-x**2) + 1.5 * np.exp(-(x-2)**2)+ np.random.randn(n)
Maxpolydegree = 5
X = np.zeros((len(x),Maxpolydegree))
X[:,0] = 1.0
for polydegree in range(1, Maxpolydegree+1):
for degree in range(polydegree):
X[:,degree] = x**(degree)
# We split the data in test and training data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# Decide which values of lambda to use
nlambdas = 5
lambdas = np.logspace(-3, 2, nlambdas)
for i in range(nlambdas):
lmb = lambdas[i]
# Make the fit using Ridge only
RegRidge = linear_model.Ridge(lmb,fit_intercept=False)
RegRidge.fit(X_train,y_train)
# and then make the prediction
ypredictRidge = RegRidge.predict(X_test)
Coeffs = np.array(RegRidge.coef_)
BetaValues = pd.DataFrame(Coeffs)
BetaValues.columns = ['beta']
display(BetaValues)
Using Bayes' theorem we can gain a better intuition about Ridge and Lasso regression.
For ordinary least squares we postulated that the maximum likelihood for the doamin of events \( \boldsymbol{D} \) (one-dimensional case)
$$ \boldsymbol{D}=[(x_0,y_0), (x_1,y_1),\dots, (x_{n-1},y_{n-1})], $$is given by
$$ p(\boldsymbol{D}\vert\boldsymbol{\beta})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}. $$In Bayes' theorem this function plays the role of the so-called likelihood. We could now ask the question what is the posterior probability of a parameter set \( \boldsymbol{\beta} \) given a domain of events \( \boldsymbol{D} \)? That is, how can we define the posterior probability
$$ p(\boldsymbol{\beta}\vert\boldsymbol{D}). $$Bayes' theorem comes to our rescue here since (omitting the normalization constant)
$$ p(\boldsymbol{\beta}\vert\boldsymbol{D})\propto p(\boldsymbol{D}\vert\boldsymbol{\beta})p(\boldsymbol{\beta}). $$We have a model for \( p(\boldsymbol{D}\vert\boldsymbol{\beta}) \) but need one for the prior \( p(\boldsymbol{\beta} \)!
With the posterior probability defined by a likelihood which we have already modeled and an unknown prior, we are now ready to make additional models for the prior.
We can, based on our discussions of the variance of \( \boldsymbol{\beta} \) and the mean value, assume that the prior for the values \( \boldsymbol{\beta} \) is given by a Gaussian with mean value zero and variance \( \tau^2 \), that is
$$ p(\boldsymbol{\beta})=\prod_{j=0}^{p-1}\exp{\left(-\frac{\beta_j^2}{2\tau^2}\right)}. $$Our posterior probability becomes then (omitting the normalization factor which is just a constant)
$$ p(\boldsymbol{\beta\vert\boldsymbol{D})}=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}\prod_{j=0}^{p-1}\exp{\left(-\frac{\beta_j^2}{2\tau^2}\right)}. $$We can now optimize this quantity with respect to \( \boldsymbol{\beta} \). As we did for OLS, this is most conveniently done by taking the negative logarithm of the posterior probability. Doing so and leaving out the constants terms that do not depend on \( \beta \), we have
$$ C(\boldsymbol{\beta})=\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}+\frac{1}{2\tau^2}\vert\vert\boldsymbol{\beta}\vert\vert_2^2, $$and replacing \( 1/2\tau^2 \) with \( \lambda \) we have
$$ C(\boldsymbol{\beta})=\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}+\lambda\vert\vert\boldsymbol{\beta}\vert\vert_2^2, $$which is our Ridge cost function! Nice, isn't it?
To derive the Lasso cost function, we simply replace the Gaussian prior with an exponential distribution (Laplace in this case) with zero mean value, that is
$$ p(\boldsymbol{\beta})=\prod_{j=0}^{p-1}\exp{\left(-\frac{\vert\beta_j\vert}{\tau}\right)}. $$Our posterior probability becomes then (omitting the normalization factor which is just a constant)
$$ p(\boldsymbol{\beta}\vert\boldsymbol{D})=\prod_{i=0}^{n-1}\frac{1}{\sqrt{2\pi\sigma^2}}\exp{\left[-\frac{(y_i-\boldsymbol{X}_{i,*}\boldsymbol{\beta})^2}{2\sigma^2}\right]}\prod_{j=0}^{p-1}\exp{\left(-\frac{\vert\beta_j\vert}{\tau}\right)}. $$Taking the negative logarithm of the posterior probability and leaving out the constants terms that do not depend on \( \beta \), we have
$$ C(\boldsymbol{\beta}=\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}+\frac{1}{\tau}\vert\vert\boldsymbol{\beta}\vert\vert_1, $$and replacing \( 1/\tau \) with \( \lambda \) we have
$$ C(\boldsymbol{\beta}=\frac{\vert\vert (\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta})\vert\vert_2^2}{2\sigma^2}+\lambda\vert\vert\boldsymbol{\beta}\vert\vert_1, $$which is our Lasso cost function!
Before we proceed, we need to rethink what we have been doing. In our eager to fit the data, we have omitted several important elements in our regression analysis. In what follows we will
and discuss how to select a given model (one of the difficult parts in machine learning).
Resampling methods are an indispensable tool in modern statistics. They involve repeatedly drawing samples from a training set and refitting a model of interest on each sample in order to obtain additional information about the fitted model. For example, in order to estimate the variability of a linear regression fit, we can repeatedly draw different samples from the training data, fit a linear regression to each new sample, and then examine the extent to which the resulting fits differ. Such an approach may allow us to obtain information that would not be available from fitting the model only once using the original training sample.
Two resampling methods are often used in Machine Learning analyses,
In addition there are several other methods such as the Jackknife and the Blocking methods. We will discuss in particular cross-validation and the bootstrap method.
Resampling approaches can be computationally expensive, because they involve fitting the same statistical method multiple times using different subsets of the training data. However, due to recent advances in computing power, the computational requirements of resampling methods generally are not prohibitive. In this chapter, we discuss two of the most commonly used resampling methods, cross-validation and the bootstrap. Both methods are important tools in the practical application of many statistical learning procedures. For example, cross-validation can be used to estimate the test error associated with a given statistical learning method in order to evaluate its performance, or to select the appropriate level of flexibility. The process of evaluating a model’s performance is known as model assessment, whereas the process of selecting the proper level of flexibility for a model is known as model selection. The bootstrap is widely used.
With all these analytical equations for both the OLS and Ridge regression, we will now outline how to assess a given model. This will lead to a discussion of the so-called bias-variance tradeoff (see below) and so-called resampling methods.
One of the quantities we have discussed as a way to measure errors is the mean-squared error (MSE), mainly used for fitting of continuous functions. Another choice is the absolute error.
In the discussions below we will focus on the MSE and in particular since we will split the data into test and training data, we discuss the
As our model becomes more and more complex, more of the training data tends to used. The training may thence adapt to more complicated structures in the data. This may lead to a decrease in the bias (see below for code example) and a slight increase of the variance for the test error. For a certain level of complexity the test error will reach minimum, before starting to increase again. The training error reaches a saturation.
Two famous resampling methods are the independent bootstrap and the jackknife.
The jackknife is a special case of the independent bootstrap. Still, the jackknife was made popular prior to the independent bootstrap. And as the popularity of the independent bootstrap soared, new variants, such as the dependent bootstrap have also been developed..
The Jackknife and independent bootstrap work for independent, identically distributed random variables. If these conditions are not satisfied, the methods will fail. Yet, it should be said that if the data are independent, identically distributed, and we only want to estimate the variance of \( \overline{X} \) (which often is the case), then there is no need for bootstrapping.
The Jackknife works by making many replicas of the estimator \( \widehat{\beta} \). The jackknife is a resampling method where we systematically leave out one observation from the vector of observed values \( \boldsymbol{x} = (x_1,x_2,\cdots,X_n) \). Let \( \boldsymbol{x}_i \) denote the vector
$$ \boldsymbol{x}_i = (x_1,x_2,\cdots,x_{i-1},x_{i+1},\cdots,x_n), $$which equals the vector \( \boldsymbol{x} \) with the exception that observation number \( i \) is left out. Using this notation, define \( \widehat{\beta}_i \) to be the estimator \( \widehat{\beta} \) computed using \( \vec{X}_i \).
from numpy import *
from numpy.random import randint, randn
from time import time
def jackknife(data, stat):
n = len(data);t = zeros(n); inds = arange(n); t0 = time()
## 'jackknifing' by leaving out an observation for each i
for i in range(n):
t[i] = stat(delete(data,i) )
# analysis
print("Runtime: %g sec" % (time()-t0)); print("Jackknife Statistics :")
print("original bias std. error")
print("%8g %14g %15g" % (stat(data),(n-1)*mean(t)/n, (n*var(t))**.5))
return t
# Returns mean of data samples
def stat(data):
return mean(data)
mu, sigma = 100, 15
datapoints = 10000
x = mu + sigma*random.randn(datapoints)
# jackknife returns the data sample
t = jackknife(x, stat)
Bootstrapping is a non-parametric approach to statistical inference that substitutes computation for more traditional distributional assumptions and asymptotic results. Bootstrapping offers a number of advantages:
The textbook by Davison on the Bootstrap Methods and their Applications provides many more insights and proofs. In this course we will take a more practical approach and use the results and theorems provided in the literature. For those interested in reading more about the bootstrap methods, we recommend the above text and the one by Efron and Tibshirani.
Before we proceed however, we need to remind ourselves about a central theorem in statistics, namely the so-called central limit theorem.
Suppose we have a PDF \( p(x) \) from which we generate a series \( N \) of averages \( \mathbb{E}[x_i] \). Each mean value \( \mathbb{E}[x_i] \) is viewed as the average of a specific measurement, e.g., throwing dice 100 times and then taking the average value, or producing a certain amount of random numbers. For notational ease, we set \( \mathbb{E}[x_i]=x_i \) in the discussion which follows. We do the same for \( \mathbb{E}[z]=z \).
If we compute the mean \( z \) of \( m \) such mean values \( x_i \)
$$ z=\frac{x_1+x_2+\dots+x_m}{m}, $$the question we pose is which is the PDF of the new variable \( z \).
The probability of obtaining an average value \( z \) is the product of the probabilities of obtaining arbitrary individual mean values \( x_i \), but with the constraint that the average is \( z \). We can express this through the following expression
$$ \tilde{p}(z)=\int dx_1p(x_1)\int dx_2p(x_2)\dots\int dx_mp(x_m) \delta(z-\frac{x_1+x_2+\dots+x_m}{m}), $$where the \( \delta \)-function enbodies the constraint that the mean is \( z \). All measurements that lead to each individual \( x_i \) are expected to be independent, which in turn means that we can express \( \tilde{p} \) as the product of individual \( p(x_i) \). The independence assumption is important in the derivation of the central limit theorem.
If we use the integral expression for the \( \delta \)-function
$$ \delta(z-\frac{x_1+x_2+\dots+x_m}{m})=\frac{1}{2\pi}\int_{-\infty}^{\infty} dq\exp{\left(iq(z-\frac{x_1+x_2+\dots+x_m}{m})\right)}, $$and inserting \( e^{i\mu q-i\mu q} \) where \( \mu \) is the mean value we arrive at
$$ \tilde{p}(z)=\frac{1}{2\pi}\int_{-\infty}^{\infty} dq\exp{\left(iq(z-\mu)\right)}\left[\int_{-\infty}^{\infty} dxp(x)\exp{\left(iq(\mu-x)/m\right)}\right]^m, $$with the integral over \( x \) resulting in
$$ \int_{-\infty}^{\infty}dxp(x)\exp{\left(iq(\mu-x)/m\right)}= \int_{-\infty}^{\infty}dxp(x) \left[1+\frac{iq(\mu-x)}{m}-\frac{q^2(\mu-x)^2}{2m^2}+\dots\right]. $$The second term on the rhs disappears since this is just the mean and employing the definition of \( \sigma^2 \) we have
$$ \int_{-\infty}^{\infty}dxp(x)e^{\left(iq(\mu-x)/m\right)}= 1-\frac{q^2\sigma^2}{2m^2}+\dots, $$resulting in
$$ \left[\int_{-\infty}^{\infty}dxp(x)\exp{\left(iq(\mu-x)/m\right)}\right]^m\approx \left[1-\frac{q^2\sigma^2}{2m^2}+\dots \right]^m, $$and in the limit \( m\rightarrow \infty \) we obtain
$$ \tilde{p}(z)=\frac{1}{\sqrt{2\pi}(\sigma/\sqrt{m})} \exp{\left(-\frac{(z-\mu)^2}{2(\sigma/\sqrt{m})^2}\right)}, $$which is the normal distribution with variance \( \sigma^2_m=\sigma^2/m \), where \( \sigma \) is the variance of the PDF \( p(x) \) and \( \mu \) is also the mean of the PDF \( p(x) \).
Thus, the central limit theorem states that the PDF \( \tilde{p}(z) \) of the average of \( m \) random values corresponding to a PDF \( p(x) \) is a normal distribution whose mean is the mean value of the PDF \( p(x) \) and whose variance is the variance of the PDF \( p(x) \) divided by \( m \), the number of values used to compute \( z \).
The central limit theorem leads to the well-known expression for the standard deviation, given by
$$ \sigma_m= \frac{\sigma}{\sqrt{m}}. $$The latter is true only if the average value is known exactly. This is obtained in the limit \( m\rightarrow \infty \) only. Because the mean and the variance are measured quantities we obtain the familiar expression in statistics (the so-called Bessel correction)
$$ \sigma_m\approx \frac{\sigma}{\sqrt{m-1}}. $$In many cases however the above estimate for the standard deviation, in particular if correlations are strong, may be too simplistic. Keep in mind that we have assumed that the variables \( x \) are independent and identically distributed. This is obviously not always the case. For example, the random numbers (or better pseudorandom numbers) we generate in various calculations do always exhibit some correlations.
The theorem is satisfied by a large class of PDFs. Note however that for a finite \( m \), it is not always possible to find a closed form /analytic expression for \( \tilde{p}(x) \).
Confidence intervals are used in statistics and represent a type of estimate computed from the observed data. This gives a range of values for an unknown parameter such as the parameters \( \boldsymbol{\beta} \) from linear regression.
With the OLS expressions for the parameters \( \boldsymbol{\beta} \) we found \( \mathbb{E}(\boldsymbol{\beta}) = \boldsymbol{\beta} \), which means that the estimator of the regression parameters is unbiased.
We found also that the variance of the estimate of the \( j \)-th regression coefficient is \( \boldsymbol{\sigma}^2 (\boldsymbol{\beta}_j ) = \boldsymbol{\sigma}^2 [(\mathbf{X}^{T} \mathbf{X})^{-1}]_{jj} \).
This quantity will be used to construct a confidence interval for the estimates.
We will assume that the parameters \( \beta \) follow a normal distribution. We can then define the confidence interval. Here we will be using as shorthands \( \mu_{\beta} \) for the above mean value and \( \sigma_{\beta} \) for the standard deviation. We have then a confidence interval
$$ \left(\mu_{\beta}\pm \frac{z\sigma_{\beta}}{\sqrt{n}}\right), $$where \( z \) defines the level of certainty (or confidence). For a normal distribution typical parameters are \( z=2.576 \) which corresponds to a confidence of \( 99\% \) while \( z=1.96 \) corresponds to a confidence of \( 95\% \). A confidence level of \( 95\% \) is commonly used and it is normally referred to as a two-sigmas confidence level, that is we approximate \( z\approx 2 \).
For more discussions of confidence intervals (and in particular linked with a discussion of the bootstrap method), see chapter 5 of the textbook by Davison on the Bootstrap Methods and their Applications
In this text you will also find an in-depth discussion of the Bootstrap method, why it works and various theorems related to it.
Since \( \widehat{\beta} = \widehat{\beta}(\boldsymbol{X}) \) is a function of random variables, \( \widehat{\beta} \) itself must be a random variable. Thus it has a pdf, call this function \( p(\boldsymbol{t}) \). The aim of the bootstrap is to estimate \( p(\boldsymbol{t}) \) by the relative frequency of \( \widehat{\beta} \). You can think of this as using a histogram in the place of \( p(\boldsymbol{t}) \). If the relative frequency closely resembles \( p(\vec{t}) \), then using numerics, it is straight forward to estimate all the interesting parameters of \( p(\boldsymbol{t}) \) using point estimators.
In the case that \( \widehat{\beta} \) has more than one component, and the components are independent, we use the same estimator on each component separately. If the probability density function of \( X_i \), \( p(x) \), had been known, then it would have been straightforward to do this by:
By repeated use of the above two points, many estimates of \( \widehat{\beta} \) can be obtained. The idea is to use the relative frequency of \( \widehat{\beta}^* \) (think of a histogram) as an estimate of \( p(\boldsymbol{t}) \).
But unless there is enough information available about the process that generated \( X_1,X_2,\cdots,X_n \), \( p(x) \) is in general unknown. Therefore, Efron in 1979 asked the question: What if we replace \( p(x) \) by the relative frequency of the observation \( X_i \)?
If we draw observations in accordance with the relative frequency of the observations, will we obtain the same result in some asymptotic sense? The answer is yes.
The independent bootstrap works like this:
When you are done, you can draw a histogram of the relative frequency of \( \widehat \beta^* \). This is your estimate of the probability distribution \( p(t) \). Using this probability distribution you can estimate any statistics thereof. In principle you never draw the histogram of the relative frequency of \( \widehat{\beta}^* \). Instead you use the estimators corresponding to the statistic of interest. For example, if you are interested in estimating the variance of \( \widehat \beta \), apply the etsimator \( \widehat \sigma^2 \) to the values \( \widehat \beta^* \).
The following code starts with a Gaussian distribution with mean value \( \mu =100 \) and variance \( \sigma=15 \). We use this to generate the data used in the bootstrap analysis. The bootstrap analysis returns a data set after a given number of bootstrap operations (as many as we have data points). This data set consists of estimated mean values for each bootstrap operation. The histogram generated by the bootstrap method shows that the distribution for these mean values is also a Gaussian, centered around the mean value \( \mu=100 \) but with standard deviation \( \sigma/\sqrt{n} \), where \( n \) is the number of bootstrap samples (in this case the same as the number of original data points). The value of the standard deviation is what we expect from the central limit theorem.
import numpy as np
from time import time
from scipy.stats import norm
import matplotlib.pyplot as plt
# Returns mean of bootstrap samples
# Bootstrap algorithm
def bootstrap(data, datapoints):
t = np.zeros(datapoints)
n = len(data)
# non-parametric bootstrap
for i in range(datapoints):
t[i] = np.mean(data[np.random.randint(0,n,n)])
# analysis
print("Bootstrap Statistics :")
print("original bias std. error")
print("%8g %8g %14g %15g" % (np.mean(data), np.std(data),np.mean(t),np.std(t)))
return t
# We set the mean value to 100 and the standard deviation to 15
mu, sigma = 100, 15
datapoints = 10000
# We generate random numbers according to the normal distribution
x = mu + sigma*np.random.randn(datapoints)
# bootstrap returns the data sample
t = bootstrap(x, datapoints)
We see that our new variance and from that the standard deviation, agrees with the central limit theorem.
# the histogram of the bootstrapped data (normalized data if density = True)
n, binsboot, patches = plt.hist(t, 50, density=True, facecolor='red', alpha=0.75)
# add a 'best fit' line
y = norm.pdf(binsboot, np.mean(t), np.std(t))
lt = plt.plot(binsboot, y, 'b', linewidth=1)
plt.xlabel('x')
plt.ylabel('Probability')
plt.grid(True)
plt.show()
We will discuss the bias-variance tradeoff in the context of continuous predictions such as regression. However, many of the intuitions and ideas discussed here also carry over to classification tasks. Consider a dataset \( \mathcal{D} \) consisting of the data \( \mathbf{X}_\mathcal{D}=\{(y_j, \boldsymbol{x}_j), j=0\ldots n-1\} \).
Let us assume that the true data is generated from a noisy model
$$ \boldsymbol{y}=f(\boldsymbol{x}) + \boldsymbol{\epsilon} $$where \( \epsilon \) is normally distributed with mean zero and standard deviation \( \sigma^2 \).
In our derivation of the ordinary least squares method we defined then an approximation to the function \( f \) in terms of the parameters \( \boldsymbol{\beta} \) and the design matrix \( \boldsymbol{X} \) which embody our model, that is \( \boldsymbol{\tilde{y}}=\boldsymbol{X}\boldsymbol{\beta} \).
Thereafter we found the parameters \( \boldsymbol{\beta} \) by optimizing the means squared error via the so-called cost function
$$ C(\boldsymbol{X},\boldsymbol{\beta}) =\frac{1}{n}\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2=\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]. $$We can rewrite this as
$$ \mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\frac{1}{n}\sum_i(f_i-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2+\frac{1}{n}\sum_i(\tilde{y}_i-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2+\sigma^2. $$The three terms represent the square of the bias of the learning method, which can be thought of as the error caused by the simplifying assumptions built into the method. The second term represents the variance of the chosen model and finally the last terms is variance of the error \( \boldsymbol{\epsilon} \).
To derive this equation, we need to recall that the variance of \( \boldsymbol{y} \) and \( \boldsymbol{\epsilon} \) are both equal to \( \sigma^2 \). The mean value of \( \boldsymbol{\epsilon} \) is by definition equal to zero. Furthermore, the function \( f \) is not a stochastics variable, idem for \( \boldsymbol{\tilde{y}} \). We use a more compact notation in terms of the expectation value
$$ \mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{f}+\boldsymbol{\epsilon}-\boldsymbol{\tilde{y}})^2\right], $$and adding and subtracting \( \mathbb{E}\left[\boldsymbol{\tilde{y}}\right] \) we get
$$ \mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{f}+\boldsymbol{\epsilon}-\boldsymbol{\tilde{y}}+\mathbb{E}\left[\boldsymbol{\tilde{y}}\right]-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2\right], $$which, using the abovementioned expectation values can be rewritten as
$$ \mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{y}-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2\right]+\mathrm{Var}\left[\boldsymbol{\tilde{y}}\right]+\sigma^2, $$that is the rewriting in terms of the so-called bias, the variance of the model \( \boldsymbol{\tilde{y}} \) and the variance of \( \boldsymbol{\epsilon} \).
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.preprocessing import PolynomialFeatures
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.utils import resample
np.random.seed(2018)
n = 500
n_boostraps = 100
degree = 18 # A quite high value, just to show.
noise = 0.1
# Make data set.
x = np.linspace(-1, 3, n).reshape(-1, 1)
y = np.exp(-x**2) + 1.5 * np.exp(-(x-2)**2) + np.random.normal(0, 0.1, x.shape)
# Hold out some test data that is never used in training.
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2)
# Combine x transformation and model into one operation.
# Not neccesary, but convenient.
model = make_pipeline(PolynomialFeatures(degree=degree), LinearRegression(fit_intercept=False))
# The following (m x n_bootstraps) matrix holds the column vectors y_pred
# for each bootstrap iteration.
y_pred = np.empty((y_test.shape[0], n_boostraps))
for i in range(n_boostraps):
x_, y_ = resample(x_train, y_train)
# Evaluate the new model on the same test data each time.
y_pred[:, i] = model.fit(x_, y_).predict(x_test).ravel()
# Note: Expectations and variances taken w.r.t. different training
# data sets, hence the axis=1. Subsequent means are taken across the test data
# set in order to obtain a total value, but before this we have error/bias/variance
# calculated per data point in the test set.
# Note 2: The use of keepdims=True is important in the calculation of bias as this
# maintains the column vector form. Dropping this yields very unexpected results.
error = np.mean( np.mean((y_test - y_pred)**2, axis=1, keepdims=True) )
bias = np.mean( (y_test - np.mean(y_pred, axis=1, keepdims=True))**2 )
variance = np.mean( np.var(y_pred, axis=1, keepdims=True) )
print('Error:', error)
print('Bias^2:', bias)
print('Var:', variance)
print('{} >= {} + {} = {}'.format(error, bias, variance, bias+variance))
plt.plot(x[::5, :], y[::5, :], label='f(x)')
plt.scatter(x_test, y_test, label='Data points')
plt.scatter(x_test, np.mean(y_pred, axis=1), label='Pred')
plt.legend()
plt.show()
import matplotlib.pyplot as plt
import numpy as np
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.preprocessing import PolynomialFeatures
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.utils import resample
np.random.seed(2018)
n = 40
n_boostraps = 100
maxdegree = 14
# Make data set.
x = np.linspace(-3, 3, n).reshape(-1, 1)
y = np.exp(-x**2) + 1.5 * np.exp(-(x-2)**2)+ np.random.normal(0, 0.1, x.shape)
error = np.zeros(maxdegree)
bias = np.zeros(maxdegree)
variance = np.zeros(maxdegree)
polydegree = np.zeros(maxdegree)
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2)
for degree in range(maxdegree):
model = make_pipeline(PolynomialFeatures(degree=degree), LinearRegression(fit_intercept=False))
y_pred = np.empty((y_test.shape[0], n_boostraps))
for i in range(n_boostraps):
x_, y_ = resample(x_train, y_train)
y_pred[:, i] = model.fit(x_, y_).predict(x_test).ravel()
polydegree[degree] = degree
error[degree] = np.mean( np.mean((y_test - y_pred)**2, axis=1, keepdims=True) )
bias[degree] = np.mean( (y_test - np.mean(y_pred, axis=1, keepdims=True))**2 )
variance[degree] = np.mean( np.var(y_pred, axis=1, keepdims=True) )
print('Polynomial degree:', degree)
print('Error:', error[degree])
print('Bias^2:', bias[degree])
print('Var:', variance[degree])
print('{} >= {} + {} = {}'.format(error[degree], bias[degree], variance[degree], bias[degree]+variance[degree]))
plt.plot(polydegree, error, label='Error')
plt.plot(polydegree, bias, label='bias')
plt.plot(polydegree, variance, label='Variance')
plt.legend()
plt.show()
The bias-variance tradeoff summarizes the fundamental tension in machine learning, particularly supervised learning, between the complexity of a model and the amount of training data needed to train it. Since data is often limited, in practice it is often useful to use a less-complex model with higher bias, that is a model whose asymptotic performance is worse than another model because it is easier to train and less sensitive to sampling noise arising from having a finite-sized training dataset (smaller variance).
The above equations tell us that in order to minimize the expected test error, we need to select a statistical learning method that simultaneously achieves low variance and low bias. Note that variance is inherently a nonnegative quantity, and squared bias is also nonnegative. Hence, we see that the expected test MSE can never lie below \( Var(\epsilon) \), the irreducible error.
What do we mean by the variance and bias of a statistical learning method? The variance refers to the amount by which our model would change if we estimated it using a different training data set. Since the training data are used to fit the statistical learning method, different training data sets will result in a different estimate. But ideally the estimate for our model should not vary too much between training sets. However, if a method has high variance then small changes in the training data can result in large changes in the model. In general, more flexible statistical methods have higher variance.
You may also find this recent article of interest.
"""
============================
Underfitting vs. Overfitting
============================
This example demonstrates the problems of underfitting and overfitting and
how we can use linear regression with polynomial features to approximate
nonlinear functions. The plot shows the function that we want to approximate,
which is a part of the cosine function. In addition, the samples from the
real function and the approximations of different models are displayed. The
models have polynomial features of different degrees. We can see that a
linear function (polynomial with degree 1) is not sufficient to fit the
training samples. This is called **underfitting**. A polynomial of degree 4
approximates the true function almost perfectly. However, for higher degrees
the model will **overfit** the training data, i.e. it learns the noise of the
training data.
We evaluate quantitatively **overfitting** / **underfitting** by using
cross-validation. We calculate the mean squared error (MSE) on the validation
set, the higher, the less likely the model generalizes correctly from the
training data.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_score
def true_fun(X):
return np.cos(1.5 * np.pi * X)
np.random.seed(0)
n_samples = 30
degrees = [1, 4, 15]
X = np.sort(np.random.rand(n_samples))
y = true_fun(X) + np.random.randn(n_samples) * 0.1
plt.figure(figsize=(14, 5))
for i in range(len(degrees)):
ax = plt.subplot(1, len(degrees), i + 1)
plt.setp(ax, xticks=(), yticks=())
polynomial_features = PolynomialFeatures(degree=degrees[i],
include_bias=False)
linear_regression = LinearRegression()
pipeline = Pipeline([("polynomial_features", polynomial_features),
("linear_regression", linear_regression)])
pipeline.fit(X[:, np.newaxis], y)
# Evaluate the models using crossvalidation
scores = cross_val_score(pipeline, X[:, np.newaxis], y,
scoring="neg_mean_squared_error", cv=10)
X_test = np.linspace(0, 1, 100)
plt.plot(X_test, pipeline.predict(X_test[:, np.newaxis]), label="Model")
plt.plot(X_test, true_fun(X_test), label="True function")
plt.scatter(X, y, edgecolor='b', s=20, label="Samples")
plt.xlabel("x")
plt.ylabel("y")
plt.xlim((0, 1))
plt.ylim((-2, 2))
plt.legend(loc="best")
plt.title("Degree {}\nMSE = {:.2e}(+/- {:.2e})".format(
degrees[i], -scores.mean(), scores.std()))
plt.show()
When the repetitive splitting of the data set is done randomly, samples may accidently end up in a fast majority of the splits in either training or test set. Such samples may have an unbalanced influence on either model building or prediction evaluation. To avoid this \( k \)-fold cross-validation structures the data splitting. The samples are divided into \( k \) more or less equally sized exhaustive and mutually exclusive subsets. In turn (at each split) one of these subsets plays the role of the test set while the union of the remaining subsets constitutes the training set. Such a splitting warrants a balanced representation of each sample in both training and test set over the splits. Still the division into the \( k \) subsets involves a degree of randomness. This may be fully excluded when choosing \( k=n \). This particular case is referred to as leave-one-out cross-validation (LOOCV).
For the various values of \( k \)
The code here uses Ridge regression with cross-validation (CV) resampling and \( k \)-fold CV in order to fit a specific polynomial.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
from sklearn.linear_model import Ridge
from sklearn.model_selection import cross_val_score
from sklearn.preprocessing import PolynomialFeatures
# A seed just to ensure that the random numbers are the same for every run.
# Useful for eventual debugging.
np.random.seed(3155)
# Generate the data.
nsamples = 100
x = np.random.randn(nsamples)
y = 3*x**2 + np.random.randn(nsamples)
## Cross-validation on Ridge regression using KFold only
# Decide degree on polynomial to fit
poly = PolynomialFeatures(degree = 6)
# Decide which values of lambda to use
nlambdas = 500
lambdas = np.logspace(-3, 5, nlambdas)
# Initialize a KFold instance
k = 5
kfold = KFold(n_splits = k)
# Perform the cross-validation to estimate MSE
scores_KFold = np.zeros((nlambdas, k))
i = 0
for lmb in lambdas:
ridge = Ridge(alpha = lmb)
j = 0
for train_inds, test_inds in kfold.split(x):
xtrain = x[train_inds]
ytrain = y[train_inds]
xtest = x[test_inds]
ytest = y[test_inds]
Xtrain = poly.fit_transform(xtrain[:, np.newaxis])
ridge.fit(Xtrain, ytrain[:, np.newaxis])
Xtest = poly.fit_transform(xtest[:, np.newaxis])
ypred = ridge.predict(Xtest)
scores_KFold[i,j] = np.sum((ypred - ytest[:, np.newaxis])**2)/np.size(ypred)
j += 1
i += 1
estimated_mse_KFold = np.mean(scores_KFold, axis = 1)
## Cross-validation using cross_val_score from sklearn along with KFold
# kfold is an instance initialized above as:
# kfold = KFold(n_splits = k)
estimated_mse_sklearn = np.zeros(nlambdas)
i = 0
for lmb in lambdas:
ridge = Ridge(alpha = lmb)
X = poly.fit_transform(x[:, np.newaxis])
estimated_mse_folds = cross_val_score(ridge, X, y[:, np.newaxis], scoring='neg_mean_squared_error', cv=kfold)
# cross_val_score return an array containing the estimated negative mse for every fold.
# we have to the the mean of every array in order to get an estimate of the mse of the model
estimated_mse_sklearn[i] = np.mean(-estimated_mse_folds)
i += 1
## Plot and compare the slightly different ways to perform cross-validation
plt.figure()
plt.plot(np.log10(lambdas), estimated_mse_sklearn, label = 'cross_val_score')
plt.plot(np.log10(lambdas), estimated_mse_KFold, 'r--', label = 'KFold')
plt.xlabel('log10(lambda)')
plt.ylabel('mse')
plt.legend()
plt.show()
# Common imports
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.model_selection import train_test_split
from sklearn.utils import resample
from sklearn.metrics import mean_squared_error
# Where to save the figures and data files
PROJECT_ROOT_DIR = "Results"
FIGURE_ID = "Results/FigureFiles"
DATA_ID = "DataFiles/"
if not os.path.exists(PROJECT_ROOT_DIR):
os.mkdir(PROJECT_ROOT_DIR)
if not os.path.exists(FIGURE_ID):
os.makedirs(FIGURE_ID)
if not os.path.exists(DATA_ID):
os.makedirs(DATA_ID)
def image_path(fig_id):
return os.path.join(FIGURE_ID, fig_id)
def data_path(dat_id):
return os.path.join(DATA_ID, dat_id)
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
infile = open(data_path("EoS.csv"),'r')
# Read the EoS data as csv file and organize the data into two arrays with density and energies
EoS = pd.read_csv(infile, names=('Density', 'Energy'))
EoS['Energy'] = pd.to_numeric(EoS['Energy'], errors='coerce')
EoS = EoS.dropna()
Energies = EoS['Energy']
Density = EoS['Density']
# The design matrix now as function of various polytrops
Maxpolydegree = 30
X = np.zeros((len(Density),Maxpolydegree))
X[:,0] = 1.0
testerror = np.zeros(Maxpolydegree)
trainingerror = np.zeros(Maxpolydegree)
polynomial = np.zeros(Maxpolydegree)
trials = 100
for polydegree in range(1, Maxpolydegree):
polynomial[polydegree] = polydegree
for degree in range(polydegree):
X[:,degree] = Density**(degree/3.0)
# loop over trials in order to estimate the expectation value of the MSE
testerror[polydegree] = 0.0
trainingerror[polydegree] = 0.0
for samples in range(trials):
x_train, x_test, y_train, y_test = train_test_split(X, Energies, test_size=0.2)
model = LinearRegression(fit_intercept=False).fit(x_train, y_train)
ypred = model.predict(x_train)
ytilde = model.predict(x_test)
testerror[polydegree] += mean_squared_error(y_test, ytilde)
trainingerror[polydegree] += mean_squared_error(y_train, ypred)
testerror[polydegree] /= trials
trainingerror[polydegree] /= trials
print("Degree of polynomial: %3d"% polynomial[polydegree])
print("Mean squared error on training data: %.8f" % trainingerror[polydegree])
print("Mean squared error on test data: %.8f" % testerror[polydegree])
plt.plot(polynomial, np.log10(trainingerror), label='Training Error')
plt.plot(polynomial, np.log10(testerror), label='Test Error')
plt.xlabel('Polynomial degree')
plt.ylabel('log10[MSE]')
plt.legend()
plt.show()
Note that we kept the intercept column in the fitting here. This means that we need to set the intercept in the call to the Scikit-Learn function as False. Alternatively, we could have set up the design matrix \( X \) without the first column of ones.
In this example we keep the intercept column again but add cross-validation in order to estimate the best possible value of the means squared error.
# Common imports
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import KFold
from sklearn.model_selection import cross_val_score
# Where to save the figures and data files
PROJECT_ROOT_DIR = "Results"
FIGURE_ID = "Results/FigureFiles"
DATA_ID = "DataFiles/"
if not os.path.exists(PROJECT_ROOT_DIR):
os.mkdir(PROJECT_ROOT_DIR)
if not os.path.exists(FIGURE_ID):
os.makedirs(FIGURE_ID)
if not os.path.exists(DATA_ID):
os.makedirs(DATA_ID)
def image_path(fig_id):
return os.path.join(FIGURE_ID, fig_id)
def data_path(dat_id):
return os.path.join(DATA_ID, dat_id)
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
infile = open(data_path("EoS.csv"),'r')
# Read the EoS data as csv file and organize the data into two arrays with density and energies
EoS = pd.read_csv(infile, names=('Density', 'Energy'))
EoS['Energy'] = pd.to_numeric(EoS['Energy'], errors='coerce')
EoS = EoS.dropna()
Energies = EoS['Energy']
Density = EoS['Density']
# The design matrix now as function of various polytrops
Maxpolydegree = 30
X = np.zeros((len(Density),Maxpolydegree))
X[:,0] = 1.0
estimated_mse_sklearn = np.zeros(Maxpolydegree)
polynomial = np.zeros(Maxpolydegree)
k =5
kfold = KFold(n_splits = k)
for polydegree in range(1, Maxpolydegree):
polynomial[polydegree] = polydegree
for degree in range(polydegree):
X[:,degree] = Density**(degree/3.0)
OLS = LinearRegression(fit_intercept=False)
# loop over trials in order to estimate the expectation value of the MSE
estimated_mse_folds = cross_val_score(OLS, X, Energies, scoring='neg_mean_squared_error', cv=kfold)
#[:, np.newaxis]
estimated_mse_sklearn[polydegree] = np.mean(-estimated_mse_folds)
plt.plot(polynomial, np.log10(estimated_mse_sklearn), label='Test Error')
plt.xlabel('Polynomial degree')
plt.ylabel('log10[MSE]')
plt.legend()
plt.show()


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.threed.jpct.TextureManager
The TextureManager is a singleton for storing and retrieving textures. Each texture managed by this class can be identified by a unique name. A texture managed by this class is an instance of Texture.
Texture
| Field Summary | |
static int |
TEXTURE_NOTFOUND
The id of a none-existent texture |
| Method Summary | |
void |
addTexture(java.lang.String name)
Adds a texture with the given name to the manager. |
void |
addTexture(java.lang.String name,
Texture tex)
Adds a texture with the given name to the manager. |
boolean |
containsTexture(java.lang.String name)
Checks if a texture has already been added to the texture-manager (or better: if a texture with this name exists within the manager instance). |
void |
flush()
Flushes the textures in the manager. |
Texture |
getDummyTexture()
Returns the current dummy texture. |
static TextureManager |
getInstance()
Returns an instance of the TextureManager. |
long |
getMemoryUsage(boolean localOnly)
Returns the memory usage of all texture in the texture manager and in the GPU's memory. |
java.lang.String |
getNameByID(int id)
Gets the name with which the texture with the given ID has been added to the manager. |
java.lang.String |
getNameByTexture(Texture texture)
Returns the name with which the texture has been added to the manager. |
java.util.Enumeration |
getNames()
Gets all the names of the textures that have been added to the manager. |
java.util.Vector |
getState()
Dumps the current state of the TextureManager to a Vector. |
Texture |
getTexture(java.lang.String name)
Returns the texture being named 'name'. |
Texture |
getTextureByID(int id)
Returns the texture with the ID or null if no such texture can be found. |
int |
getTextureCount()
Returns the number of textures the TextureManager holds. |
int |
getTextureID(java.lang.String name)
Returns the numerical ID of the texture. |
void |
preWarm(FrameBuffer buffer)
Does some work that may otherwise happen during runtime and can cause hick-ups. |
void |
removeAndUnload(java.lang.String name,
FrameBuffer from)
Combines removal and unload of a texture. |
void |
removeTexture(java.lang.String name)
Removes a texture from the manager. |
void |
replaceTexture(int id,
Texture tex)
Replaces a texture with the given id with another one. |
void |
replaceTexture(java.lang.String name,
Texture tex)
Replaces a texture with the given name with another one. |
void |
setDummyTexture(Texture texture)
Sets a texture as dummy texture. |
void |
setState(java.util.Vector dump)
Sets the state of the TextureManager. |
void |
unloadTexture(FrameBuffer from,
Texture texture)
Unloads a texture from the contexts of the renderers of the given frame buffer. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int TEXTURE_NOTFOUND
getTextureID(java.lang.String)
,
Constant Field Values| Method Detail |
public static TextureManager getInstance()
public java.util.Vector getState()
public void setState(java.util.Vector dump)
dump
- the state dumppublic long getMemoryUsage(boolean localOnly)
localOnly
- if true, the GPU's memory usage won't be taken into account.
public void addTexture(java.lang.String name)
name
- the (unique) name for this texturereplaceTexture(java.lang.String, com.threed.jpct.Texture)
public void addTexture(java.lang.String name, Texture tex)
name
- the (unique) name for this texturetex
- the texturepublic void unloadTexture(FrameBuffer from, Texture texture)
from
- the FrameBuffertexture
- the texture to unloadremoveAndUnload(java.lang.String, com.threed.jpct.FrameBuffer)
public void removeTexture(java.lang.String name)
name
- the name of the texture to be removedunloadTexture(com.threed.jpct.FrameBuffer, com.threed.jpct.Texture)
,
removeAndUnload(java.lang.String, com.threed.jpct.FrameBuffer)
,
replaceTexture(int, com.threed.jpct.Texture)
public void removeAndUnload(java.lang.String name, FrameBuffer from)
name
- the texture's namefrom
- the FrameBufferunloadTexture(com.threed.jpct.FrameBuffer, com.threed.jpct.Texture)
,
removeTexture(java.lang.String)
public void replaceTexture(java.lang.String name, Texture tex)
name
- the (unique) name of the texture to replacetex
- the new texturepublic void replaceTexture(int id, Texture tex)
id
- the id of the texture to replacetex
- the new texturepublic void flush()
public void preWarm(FrameBuffer buffer)
buffer
- the current frame buffer. The desired renderer should be enabled.public void setDummyTexture(Texture texture)
texture
- the new dummy texturepublic Texture getDummyTexture()
public boolean containsTexture(java.lang.String name)
name
- the name of the texture
public int getTextureCount()
public int getTextureID(java.lang.String name)
name
- the name of the texture
public Texture getTextureByID(int id)
id
- int the ID
public Texture getTexture(java.lang.String name)
name
- the name of the texture that should be retrieved
public java.util.Enumeration getNames()
public java.lang.String getNameByID(int id)
id
- the texture's ID
public java.lang.String getNameByTexture(Texture texture)
texture
-
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


--- layout: bare ext: html --- {% assign rss_feed = site.tag_feed_dir | append: page.tag | append: '.xml' %} Posts Tagged "{{ page.tag }}" Here's a list of posts tagged {{ page.tag }}. You can subscribe to these posts by visiting this RSS/ATOM feed. {{ tag_posts }} {% include post_listing.html posts=paginator.posts %}
Here's a list of posts tagged {{ page.tag }}. You can subscribe to these posts by visiting this RSS/ATOM feed.


Privacy Statement
RedBlup PRIVACY POLICY RedBlup (the “Company”) is committed to maintaining robust privacy protections for its users. Our Privacy Policy (“Privacy Policy”) is designed to help you understand how we collect, use and safeguard the information you provide
to us and to assist you in making informed decisions when using our Service.
Please click the following link to view the full document


Package org.drip.product.creator
Streams and Products Construction Utilities
- Author:
- Lakshmi Krishnamurthy
-
Class Summary Class Description BondBasketBuilder BondBasketBuilder contains the suite of helper functions for creating the bond Basket Product from different kinds of inputs and byte streams.BondBuilder BondBuilder contains the suite of helper functions for creating simple fixed/floater bonds, user defined bonds, optionally with custom cash flows and embedded option schedules (European or American).BondProductBuilder BondProductBuilder holds the static parameters of the bond product needed for the full bond valuation.BondRefDataBuilder BondRefDataBuilder holds the entire set of static parameters for the bond product.CDSBasketBuilder CDSBasketBuilder contains the suite of helper functions for creating the CDS Basket Product from different kinds of inputs and byte streams.CDSBuilder CDSBuilder contains the suite of helper functions for creating the CreditDefaultSwap product from the parameters/byte array streams.CDXRefDataHolder CDXRefDataHolder holds the CDX Reference Data Static Settings.ConstantPaymentBondBuilder ConstantPaymentBondBuilder contains the Suite of Helper Functions for creating Constant Payments Based Bonds.DualStreamComponentBuilder DualStreamComponentBuilder contains the suite of helper functions for creating the Stream-based Dual Streams from different kinds of inputs.SingleStreamComponentBuilder SingleStreamComponentBuilder contains the suite of helper functions for creating the Futures product and product pack from the parameters/codes/byte array streams.SingleStreamOptionBuilder SingleStreamOptionBuilder contains the suite of helper functions for creating the Options Product Instance off of a single stream underlying.StreamBuilder StreamBuilder contains Utility Functions to construct Fixed, Floating, and Mixed Streams.


Welcome to your Weather Channel
Search for your city:
🔎
Tempurature:
Humidity:
Windspeed:
UV Index:
5-day Forecast


Delete this team
Private - This team is private. It's not indexed or visible to those outside the team.


Contents
Note: The root genedive directory will be reffered to with GeneDiveRoot. So the docs folder in the root directory would be GeneDiveRoot/docs/
Required Programs
- MAMP: https://www.mamp.info/ Download the free version. When installed, go into preferences and set these options
- Start/Stop
- Web Server
- WebServer: Apache
- Document Root: GeneDiveRoot
Directory setup
- Create GeneDiveRoot/sessions/ directory, if it hasn't already been made.
- Acquire data.sqlite and users.sqlite and put them in GeneDiveRoot/data/
Execution
Simply open up MAMP, start the server, and when the Apache and Mysql server have been started it should open your browser to the main page. If it doesn't, click Open start page.
Document Generation
Required Programs
- Doxygen: https://www.stack.nl/~dimitri/doxygen/ Generates all the documentation from the source code.
- GraphViz: https://www.graphviz.org/ Creates graphs for function calls.
- NodeJS: https://nodejs.org/en/ Automated scripts we made were written in NodeJS to keep everything in Javascript
- Puppeteer: https://github.com/GoogleChrome/puppeteer Chrome browser virtualizer allowing for automated testing and screenshots Note: Make sure to install it globally, and not in the current project, using the global flag like so:
npm -g install puppeteer
Execution
Navigate to GeneDiveRoot/docs/gen and execute the command node generate.js
. Both processes should exit with 0, and the log files generated.


Module layout
layout.lua
A simple but powerful device and display-size independent layout manager for the Corona SDK.
Functions
| Layout:new () | Constructor - build and return a new Layout object. |
| Layout:addRegion (dimens) | addRegion - add a new region to the layout manager. |
| Layout:removeRegion (id) | removeRegion - remove a region from the layout. |
| Layout:adjustRegion (dimens) | adjustRegion - change a region's size and/or position. |
| Layout:regionRect (id) | regionRect - return a display rect matching a specified region. |
Functions
- Layout:new ()
-
Constructor - build and return a new Layout object.
The new Layout object will contain the following entries:
pixel
: (number) content units for one screen pixel (assumes device to have square pixels; if not, this value will represent the content units for one pixel in the largest screen dimension)screen
: (region) content region for the full screenstage
: (region) content region for the stage (generally the same as the screen minus the status bar)pixels
: (region) special region for positioning and sizing by pixels
Returns:
-
new Layout object
Usage:
local Layout = LayoutManager:new()
- Layout:addRegion (dimens)
-
addRegion - add a new region to the layout manager.
Parameters:
- dimens
a table specifying the options for the new region:
id
: (string) required unique identifier for the new regionsizeTo
: (string) id of region to size against (default: "stage")width
: (number) new region width as a percentage of thesizeTo
region (default: 100)height
: (number) new region height as a percentage of the 'sizeTo' region (default: 100)positionTo
: (string) id of region to position relative to (defaults tosizeTo
region)horizontal
: (string) one of: "before", "left", "center", "right", "after" (default: "center")vertical
: (string) one of: "above", "top", "center", "bottom", "below" (default: "center")padTo
: (string) id of region to pad relative to (defaults tosizeTo
region)padding
: (table) array of:{top=#, right=#, bottom=#, left=#}
(all #'s default to 0)
- dimens
- Layout:removeRegion (id)
-
removeRegion - remove a region from the layout.
Parameters:
- id string id of the region to be removed
Usage:
Layout:removeRegion( "toolbar" )
- Layout:adjustRegion (dimens)
-
adjustRegion - change a region's size and/or position.
Parameters:
- dimens
a table specifying the adjustments for the region:
id
: (string) required unique identifier for the new regionwidth
: (number) new region width in content units (default: no change)height
: (number) new region height in content units (default: no change)xCenter
: (number) new region horizontal center in content coordinates (default: no change)yCenter
: (number) new region vertical center in content coordinates (default: no change)
- dimens
- Layout:regionRect (id)
-
regionRect - return a display rect matching a specified region.
Parameters:
- id string id of the region for which to return a display rect
Returns:
-
ShapeObject (as returned by display.newRect())
Usage:
local toolbarRect = Layout:regionRect( "toolbar" )


Usage
Pass a URL as a query to the 'api/new' path to receive a new shortened
URL:
https://shortn.glitch.me/api/new?url=https://google.com
will return:
{ original_url: https://google.com, short_url: shortn.glitch.me/2
}
Visit the short URL generated to be redirected to the original URL.
(You can also enter a URL using the form on the main page)


Supporting Multi-Objective Decision Making.
To start the experiment, click below. Note that we leave it up to you to end the experiment, once you are satisfied with an answer.
Experiment:
{{query_type}}


A MyUSA and BusinessUSA project.
Modus Operandi
is a collaboration between
MyUSA
and
BusinessUSA
.
modus-operandi


JUNK MAIL (director: Pal Sletaune; cast: Robert Skjaerstad (Roy), Andrine Saether (Line), Per Ergil Aske (Georg), Eli Anne Linnestad (Betsy), 1997-Norway)
This Buster Keaton wannabe movie is supposedly a comedy/romance about an inept, morose Oslo mailman, Roy (Skjaerstad), who is not respected by his fellow workers and shows he is not satisfied with his job, somehow taking this frustration out by not delivering heaps of mail, which he dumps out regularly at some railroad underpass and by steaming open other letters and reading them. He is a sleaze, a frequenter of porn book shops and lowlife night spots. His life is a dreary, loveless mess.
As if all that is not bad enough, certainly grounds for dismissal from the post office, someone who would upset me, if he was my mailman; but, to top that off, he is also a voyeur, finding the keys to a deaf (she wears a hearing aid) woman's apartment that she left in the mailbox, and using the key to enter her apartment when she is at work at her dry cleaning job, to go through her things and steal a photograph of her. It seems he finds her attractive, but doesn't know how to get to tell her this. She is played in a low-key manner by Andrine Saether (Line).
This film is noted for showing the slum side to beautiful Oslo, where we see crime, ugly buildings, the subway, and problems outsiders do not associate with this peaceful and scenic country. The crime we see is Roy being robbed of his mailbag, but his strap gets caught and he can't even get robbed properly, later on saying he would have gladly given up the bag and avoided the beating the three muggers gave him, that hospitalized him and made him out to be a postal hero for not wanting to give up the bag. The film spends most of the first half of the movie showing him to be a screw off, everything he touches he fouls up, a complete loser-- there is a long tradition of Hollywood comedians who have exploited that avenue of comedy. His comic effect, is a deadpan expression, that absorbs all criticism that comes his way. His fellow postal workers rag him about what he is good for, and a lady postal worker who wants to stick up for him, can only say that he is a good walker, which causes a round of snickers from the postal workers ragging him.
But the picture has darker ulterior motives than that, it will chuck out all the work it did setting up the film as a fluff piece of comedy and go for the criminal aspects to the story, a decision that has to change how we approach seeing this film, we can no longer be content to relax, laughing at this inept mailman, we have to now see how he handles himself under fire, while the director, also, tries to bring romance into the story.
The romance that comes to this film, comes in a surprising way, as Roy is trapped in Line's apartment when she comes home unexpectedly, and he watches her nude as she goes to take a bath, but what she is really doing is committing suicide. Roy saves her by reviving her and calling for an ambulance, leaving the house before she knows that it was him that saved her. There is a dark side to her that is now disclosed, she is involved with a strong-arm thug, Georg (Per), who beat a security guard senseless in a robbery and gave Line the money to hold for them.
As far as I am concerned, the film loses track of what it is capable of doing at this point of the story, and it becomes a different film, where one contrived situation after another occurs to keep the story suspenseful, with the buffoon-like Georg menacing Roy. Roy is now the subject of a film that doesn't know if it wants to be viewed as a suspense or romance yarn, or just as a plain comedy.  The laugh situations seem forced, the romance absurd, and the suspense unreal.
At best, I found this film to be a modest effort at comedy, that results in a modest film, barely being less than annoying, but redeemed by showing me the darker side of Oslo, a side that I have not seen before on screen. So I think that this first time director, who is guilty of trying to come up with too many different twists to the story, and by relying on a hero to carry the film who is not very likable, and a story line that is very thin, has defeated the comic efforts that he was successful with during the first part of the film, but by the end of the film, wears down to a barely passable effort at comedy.
REVIEWED ON 3/13/99 GRADE: C-
http:www.sover.net/~ozus
Dennis Schwartz: "Movie Reviews"<EMAIL_ADDRESS>=A9 ALL RIGHTS RESERVED DENNIS SCHWARTZ
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Rel/NF-kappa B transcription factors and the control of apoptosis.
Abstract
The process of apoptosis is used to eliminate unwanted cells from a wide variety of organisms. Various extracellular signals, often converging in common intracellular pathways, can induce apoptosis in a cell-type-specific fashion. Recent work from several laboratories has demonstrated that Rel/NF-kappa B transcription factors regulate apoptosis in many cell types. In most cells, Rel/NF-kappa B transcription factors appear to mediate survival signals that protect cells from apoptosis; however, under some circumstances, activation of these factors may also promote apoptosis.


About
I’m a software engineer at Snow Developments in Iowa City, Iowa with a BS in Computer Science from Portland State University.
I'm most interested in:
- Full-Stack software engineering
- User Experience engineering
- Improving accessibility on the web, and
My Work
Projects
I'm currently working on these games and apps:
- 🛒 Untitled Grocery Game - Be a grocery store owner and design, build, and manage your store.
- Tunage - A progressive web app for your parties
Sponsor Me
Contact Me
Find me all over the internet:
Website Info
Some fun facts about this website include:
- Coded with Visual Studio Code
- Developed on GitHub and hosted for free on GitHub Pages
Found a problem with the site? Feel free to open an issue on GitHub or ask me on Twitter.