November 4th 2016 by Tom Zhou #Log
Agenda for Nov. 4th, 2016:
Compilers and interpreters
Dynamic languages and static languages
JDK, JRE, and JVM
Java EE, Java SE, and Java ME
Compiler and interpreter
Because high-level programming languages cannot be understood by computers, they need to be 'translated' to machine code prior to execution. There are two different approaches which aim to do the same thing.
For compiler, the entire source code will be translated to machine code at once, generating a file that is directly executable. User can decide whether to run the program immediately or leave it there. For interpreter, however, the source code is translated to machine code line by line only when executing, which means interpretation and execution occurs simultaneously.
Dynamic languages and static languages
This is clearly explained in 'Jave for Python programmers'. See this link:
http://fpl.cs.depaul.edu/jriely/java4python/java4python.start.html#why-java-dynamic-versus-static-languages
JDK, JRE, and JVM
JVM means Jave virtual machine, which is an environment specifically designed for Java programs to execute. As the saying goes: 'program once, run everywhere'. Majority of platforms nowadays support Java programs, and one of the reason is that the environment inside the virtual machine is independent of the platforms themselves.
In order to run a Java program, JVM is not enough. JRE, Java runtime environment, contains JVM and some essential built-in (core) classes and plug-ins that help to construct a environment suitable for Java programs.
As long as the correct version of JRE is installed in the corresponding platform, Java programs can be executed with no barriers.
JDK, an abbreviation which stands for Java development kit, is a package which contains tools that are necessary for Java developers. Generally, it composed of JRE, Java compiler, debugger and many other useful tools. For those who are writing Java programs, JDK is vital. It can be installed as IDE-specified version, or as an independent package.
Java EE, Java SE, and Java ME
They are three different categories of JDK. EE stands for enterprise version, and it contains the most tools and resources, which are helpful for systematic development. SE is the standard edition, which is the version that we normally use, on a common desktop platform. ME means micro edition. It's designed for mobile development, such as on Android devices.


UK weather forecast: Snow to slam Britain after -9C night - will it hit near you?
The Met Office says 5-10cm of snow is expected in places amid the first cold snap of the season - bringing widespread frost and ice - as heavy rain threatens towns ravaged by flooding
by Chris Kitching, https://www.mirror.co.uk/authors/chris-kitching/Britain is set to be slammed by up to 10cm of snow after temperatures plunge as low as -9C on the coldest night of autumn so far.
This week has brought the first cold snap of the season, with temperatures several degrees below normal, and nasty weather conditions are expected from Tuesday.
The Met Office has issued heavy rain warnings for parts of England and Northern Ireland as downpours threaten flood-ravaged towns in Yorkshire and the Midlands.
Elsewhere, heavy snow is possible over high ground in Scotland, England and Wales from Wednesday night, and there could be a few flakes or sleet in Northern Ireland as well.
Scroll down for the forecast in your area.
Met Office meteorologist Alex Burkill told Mirror Online: "The higher ground of Scotland, northern England and Wales will see some sleet and snow through (Tuesday) morning and thereafter it’s an improving picture.
"Over high ground of the Peak District the heavier rain may bring a little sleet or snow.
"Things will turn drier apart from the odd sleet or snow shower for Scotland.
"The bigger problem is the rainfall amounts, particularly across the areas still affected by flooding from the heavy rain last week.
In Scotland, heavy snow is expected as a front moves in from the west from Wednesday evening into Thursday morning, with 5-10cm possible over the Cairngorms and a few centimetres in the Highlands.
Up to 4cm is possible in the North East of England and about 1cm could fall in the Peak District in central England. Some snow is possible over high ground in Wales.
The exact path of the front remains uncertain, however.
As temperatures drop overnight, ice patches, widespread frost and freezing fog are expected to develop.
Mr Burkill said: "It’s a cold week. Temperatures are a little bit below average. With the wet and windy weather it is feeling cold.
"There will be a little bit of sleet and snow, but that’s not that unusual for this time of year.
"Tuesday night is probably going to be the coldest night - we could get lows of maybe -8C or -9C in the sheltered glens in Scotland, in the valleys.
"That would make it coldest night of the autumn so far.
"Even southern parts of the UK could get some patchy frost with lows of -1C or -2C."
Average temperatures for this time of year are daytime maximums of 10-11C in the south and 8C in the north, and overnight lows of 5C in the south and 2-3C in the north.
Here is what the Met Office forecast looks like in your area.
Scotland
Central, Tayside and Fife
Some showers will continue over Angus and North Perthshire on Tuesday afternoon as the south and west of the region brighten up and hit 8C.
There will be strong northerly winds along the east coast.
The temperature will drop to -5C overnight with widespread frost on Wednesday morning followed by a cold day at 5C and sunny spells.
Showers could fall again on Thursday and nights will stay cold.
Grampian
Tuesday will bring frequent showers with some hill snow at times.
The high will be 8C as winds remain strong.
Snow will fall over high ground overnight and there will be some icy patches and widespread frost, with the low at -4C
Showers will fall as snow over high ground on Wednesday while dry and sunny places have a daytime high of 6C.
Highlands and Eilean Siar
Northerly gales will batter the Hebrides on a rainy start to Tuesday before the west mostly brightens up and the region hits 8C.
There will be prolonged showers in Strathspey with hill snow later.
The temperature will plunge to -6C overnight with widespread frost and a few showers lingering.
Wednesday will be mainly dry and sunny at 6C, but showers around the coasts will fall as snow over high ground and they will stick around on Thursday.
Orkney and Shetland
A few showers and more sunshine on Tuesday afternoon as winds ease and the temperature rises to 7C.
Light showers will turn wintry, especially across Shetland, overnight as the temperature hovers around 1C.
Showers will become wintry at times on Wednesday and there will be a northerly breeze. The high will be 6C.
Thursday will be bright and cold with some showers. Nights will bring a risk of frost and ice.
Dumfries, Galloway, Lothian and Borders
Most areas will be dry on Tuesday afternoon, but showers will linger on the Berwickshire and Galloway coasts where it will be windy.
After a maximum temperature of 8C, it will drop to -5C overnight with a sharp frost and some freezing fog.
Showers could continue to fall over the far west on Wednesday as the temperature hits 5C.
Most places will stay fine and dry through the rest of the week.
Strathclyde
Most areas will be dry in the afternoon with a high of 8C and a few showers on Argyll Coast and Isles, and strong winds in the far west gradually easing.
Widespread frost and some freezing fog patches are likely as the temperature dips to -4C.
Wednesday's high will be 6C with showers over the far west, and it will be followed by sunny spells on Thursday and showers spreading to Lanarkshire.
Northern Ireland
Heavy showers will fall in Antrim and North Down with gales severe near coasts on Tuesday, when the maximum temperature will be 9C.
A dry evening in most places will lead to frost and patchy frog overnight, along with a low of -3C.
Rain could stall over Fermanagh, Armagh and Down on Wednesday, The high will be 8C.
Some showers on Thursday could be wintry, followed by dry conditions on Friday.
Wales
Heavy rain and strong winds will batter many parts of the country on Tuesday, as the temperature climbs to 10C.
Showers will become less frequent overnight and there could be some rural frost and some hill fog with the temperature at zero.
Another band of heavy rain will move in on Wednesday on another 10C day.
Forecasters are predicting more rain on Thursday and Friday.
England
North West
Tuesday afternoon should be much drier after heavy showers and strong winds in the morning, but it will remain blustery and cold at 8C.
Overnight, showers could fall across coastal parts of Cheshire and southern Lancashire, and widespread frost is expected as the temperature falls to -3C.
Wednesday will feel slightly less cold with lighter winds at 8C, but there is a chance of a few showers.
Rain and cloud could ruin sunny spells on Thursday. Friday will be drier but cloudy and cold.
North East
Showers will be heavy at times and wintry on high ground as strong winds develop. Tuesday's high will be 8C.
Frost will be widespread overnight with a low -2C.
Wednesday will stay cold at 6C with the odd shower and Thursday will be breezy with a mix of sun and rain.
Yorkshire and Humber
Heavy showers could turn wintry on high ground on Tuesday. It will be 9C but breezy.
Coastal showers and widespread frost are forecast overnight, along with a minimum temperature of -1C.
Wednesday will become cloudier with the odd shower in the afternoon as the temperature rises to 7C.
Wet and windy weather is expected on Thursday and Friday.
West Midlands
Rain will be heavy at times along with strong winds and a high of 8C.
It will be dry in most places overnight, but it will be frosty and possibly icy as the temperature hovers around the freezing mark.
There could be some showers in the north of the region on Wednesday, but the winds will ease and make it feel less cold at 8C.
Heavy rain will move in on Thursday and scattered showers will persist on Friday.
East Midlands
Tuesday will bring outbreaks of heavy rain, strong winds and a maximum temperature of 8C.
Overnight, it will be dry with widespread ground frost and a low of 1C.
The Met Office said cloud will increase through Wednesday, possibly bringing a few light showers, along with a high of 7C.
Heavy showers are possible on Thursday and Friday is expected to be breezy with more rain.
East
It will become drier and less windy on Tuesday afternoon. The high will be 7C.
Coastal showers and strong winds are expected in the evening, followed by mist or fog patches and frost overnight (1C).
Wednesday will be mainly dry but chilly at 8C with some showers possible later in the evening.
Heavy rain is a threat on Thursday and Friday.
London and South East
Clouds and strong winds will spread in as the day goes on, but it will be mostly dry on Tuesday with a high of 9C.
Mist or fog patches and frost will develop by dawn on Wednesday, followed by some showers in the afternoon (9C) and heavy rain at night.
Longer spells of rain could hit on Thursday and Friday.
South West
Blustery showers will linger in the west of this region on Tuesday, but the east should see sunny spells most of the day and a maximum temperature of 9C.
Overnight, the temperature will drop to zero and there will be a touch of frost.
Heavy rain will sweep in on Wednesday afternoon, when the high will be 11C, and showers will settle in on Thursday.
Friday will bring a mix of sun and rain.
National five-day weather forecast
Tuesday
Bright spells for most but also some rain or showers.
The far south and the northwest of England the driest.
Cold and windy, particularly the west with coastal gales.
Very strong winds this morning for north Wales and Liverpool Bay.
Tuesday night
Showers dying out for many areas away from the far north and Irish Sea coastal areas.
Cold with widespread frost in the north and a few fog patches.
Winds easing.
Wednesday
A bright start but clouding over during the day.
Coastal showers, these more widespread for Wales and the southwest.
Strengthening winds and further rain here in the afternoon.
Remaining cold.
Thursday to Saturday
Showers in the north will be wintry of the hills throughout.
For central and southern areas in addition to showers, some heavier rainfall is likely during Thursday.
Staying cold.


This is a reference to help answer this question: “what will my Rust program print if something goes wrong?”
The examples were compiled with Rust 1.46.0. All output in these examples goes to stderr, nothing goes to stdout.
Panic
fn main() { panic!("oh no"); }
thread 'main' panicked at 'oh no', src/bin/panic.rs:2:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


A | |
| AtomicOrdering [Llvm] |
The ordering of an atomic
load , store , cmpxchg , atomicrmw or
fence instruction.
|
| AtomicRMWBinOp [Llvm] |
The opcode of an
atomicrmw instruction.
|
| Attribute [Llvm] |
The attribute kind of a function parameter, result or the function itself.
|
C | |
| CallConv [Llvm] |
The following calling convention values may be accessed with
Llvm.function_call_conv and Llvm.set_function_call_conv .
|
| CodeGenFileType [Llvm_target] | |
| CodeGenOptLevel [Llvm_target] | |
| CodeModel [Llvm_target] | |
D | |
| DataLayout [Llvm_target] | |
E | |
| Endian [Llvm_target] | |
| ExecutionEngine [Llvm_executionengine] | |
F | |
| Fcmp [Llvm] |
The predicate for a floating-point comparison (
fcmp ) instruction.
|
G | |
| GenericValue [Llvm_executionengine] | |
I | |
| Icmp [Llvm] |
The predicate for an integer comparison (
icmp ) instruction.
|
L | |
| LandingPadClauseTy [Llvm] |
The type of a clause of a
landingpad instruction.
|
| Linkage [Llvm] |
The linkage of a global value, accessed with
Llvm.linkage and
Llvm.set_linkage .
|
| Llvm |
Core API.
|
| Llvm_AArch64 |
AArch64 Initialization.
|
| Llvm_ARM |
ARM Initialization.
|
| Llvm_CppBackend |
CppBackend Initialization.
|
| Llvm_Hexagon |
Hexagon Initialization.
|
| Llvm_MSP430 |
MSP430 Initialization.
|
| Llvm_Mips |
Mips Initialization.
|
| Llvm_NVPTX |
NVPTX Initialization.
|
| Llvm_PowerPC |
PowerPC Initialization.
|
| Llvm_R600 |
R600 Initialization.
|
| Llvm_Sparc |
Sparc Initialization.
|
| Llvm_SystemZ |
SystemZ Initialization.
|
| Llvm_X86 |
X86 Initialization.
|
| Llvm_XCore |
XCore Initialization.
|
| Llvm_all_backends |
Initialize all the backends targets
|
| Llvm_analysis |
Intermediate representation analysis.
|
| Llvm_bitreader |
Bitcode reader.
|
| Llvm_bitwriter |
Bitcode writer.
|
| Llvm_executionengine |
JIT Interpreter.
|
| Llvm_ipo |
IPO Transforms.
|
| Llvm_irreader |
IR reader.
|
| Llvm_linker |
Linker.
|
| Llvm_passmgr_builder |
Pass Manager Builder.
|
| Llvm_scalar_opts |
Scalar Transforms.
|
| Llvm_target |
Target Information.
|
| Llvm_vectorize |
Vectorize Transforms.
|
M | |
| MemoryBuffer [Llvm] | |
| Mode [Llvm_linker] |
Linking mode.
|
O | |
| Opcode [Llvm] |
The opcodes for LLVM instructions and constant expressions.
|
P | |
| PassManager [Llvm] | |
R | |
| RelocMode [Llvm_target] | |
T | |
| Target [Llvm_target] | |
| TargetMachine [Llvm_target] | |
| ThreadLocalMode [Llvm] |
The thread local mode of a global value, accessed with
Llvm.thread_local_mode
and Llvm.set_thread_local_mode .
|
| TypeKind [Llvm] |
The kind of an
lltype , the result of classify_type ty .
|
V | |
| ValueKind [Llvm] |
The kind of an
llvalue , the result of classify_value v .
|
| Visibility [Llvm] |
The linker visibility of a global value, accessed with
Llvm.visibility and
Llvm.set_visibility .
|


{% if current_tenant.is_public_instance %}
Optional: Highlight past projects to market yourselves to the clients who might not know you very well.
{% else %}
Optional: Highlight past {{ current_tenant.name }} projects to market yourselves to the clients at {{ current_tenant.name }} who might not know you very well.
{% endif %}


Our emphasis throughout this series of lectures is on understanding the mathematical aspects of different algorithms used in the fields of data analysis and machine learning.
However, where possible we will emphasize the importance of using available software. We start thus with a hands-on and top-down approach to machine learning. The aim is thus to start with relevant data or data we have produced and use these to introduce statistical data analysis concepts and machine learning algorithms before we delve into the algorithms themselves. The examples we will use in the beginning, start with simple polynomials with random noise added. We will use the Python software package Scikit-learn and introduce various machine learning algorithms to make fits of the data and predictions. We move thereafter to more interesting cases such as the simulation of financial transactions or disease models. These are examples where we can easily set up the data and then use machine learning algorithms included in for example scikit-learn.
These examples will serve us the purpose of getting started. Furthermore, they allow us to catch more than two birds with a stone. They will allow us to bring in some programming specific topics and tools as well as showing the power of various Python (and R) packages for machine learning and statistical data analysis. In the lectures on linear algebra we cover in more detail various programming features of languages like Python and C++ (and other), we will also look into more specific linear functions which are relevant for the various algorithms we will discuss. Here, we will mainly focus on two specific Python packages for Machine Learning, scikit-learn and tensorflow (see below for links etc). Moreover, the examples we introduce will serve as inputs to many of our discussions later, as well as allowing you to set up models and produce your own data and get started with programming.
We will make extensive use of Python as programming language and its myriad of available libraries. You will find IPython/Jupyter notebooks invaluable in your work. You can run R codes in the Jupyter/IPython notebooks, with the immediate benefit of visualizing your data. You can also use compiled languages like C++, Rust, Fortran etc if you prefer. The focus in these lectures will be on Python, but we will provide many code examples for those of you who prefer R or compiled languages. You can integrate C++ codes and R in for example a Jupyter notebook.
If you have Python installed (we recommend Python3) and you feel pretty familiar with installing different packages, we recommend that you install the following Python packages via pip as
For OSX users we recommend, after having installed Xcode, to install brew. Brew allows for a seamless installation of additional software via for example
If you don't want to perform these operations separately and venture into the hassle of exploring how to set up dependencies and paths, we recommend two widely used distrubutions which set up all relevant dependencies for Python, namely
which is an open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. Package versions are managed by the package management system conda. is a Python distribution for scientific and analytic computing distribution and analysis environment, available for free and under a commercial license.You will also find it convenient to utilize R. Although we will mainly use Python during lectures and in various projects and exercises, we provide a full R set of codes for the same examples. Those of you already familiar with R should feel free to continue using R, keeping however an eye on the parallel Python set ups. Similarly, if you are a Python afecionado, feel free to explore R as well. Jupyter/Ipython notebook allows you to run R codes interactively in your browser. The software library R is tuned to statistically analysis and allows for an easy usage of the tools we will discuss in these texts.
To install R with Jupyter notebook follow the link here
For the C++ aficionados, Jupyter/IPython notebook allows you also to install C++ and run codes written in this language interactively in the browser. Since we will emphasize writing many of the algorithms yourself, you can thus opt for either Python or C++ (or Fortran or other compiled languages) as programming languages.
To add more entropy, cython can also be used when running your notebooks. It means that Python with the Jupyter/IPython notebook setup allows you to integrate widely popular softwares and tools for scientific computing. Similarly, the Numba Python package delivers increased performance capabilities with minimal rewrites of your codes. With its versatility, including symbolic operations, Python offers a unique computational environment. Your Jupyter/IPython notebook can easily be converted into a nicely rendered PDF file or a Latex file for further processing. For example, convert to latex as
pycod jupyter nbconvert filename.ipynb --to latex
And to add more versatility, the Python package SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) and is entirely written in Python.
Finally, if you wish to use the light mark-up language doconce you can convert a standard ascii text file into various HTML formats, ipython notebooks, latex files, pdf files etc with minimal edits.
We start with perhaps our simplest possible example, using scikit-learn to perform linear regression analysis on a data set produced by us. What follows is a simple Python code where we have defined function \( y \) in terms of the variable \( x \). Both are defined as vectors of dimension \( 1\times 100 \). The entries to the vector \( \hat{x} \) are given by random numbers generated with a uniform distribution with entries \( x_i \in [0,1] \) (more about probability distribution functions later). These values are then used to define a function \( y(x) \) (tabulated again as a vector) with a linear dependence on \( x \) plus a random noise added via the normal distribution.
The Numpy functions are imported used the import numpy as np statement and the random number generator for the uniform distribution is called using the function np.random.rand(), where we specificy that we want \( 100 \) random variables. Using Numpy we define automatically an array with the specified number of elements, \( 100 \) in our case. With the Numpy function randn() we can compute random numbers with the normal distribution (mean value \( \mu \) equal to zero and variance \( \sigma^2 \) set to one) and produce the values of \( y \) assuming a linear dependence as function of \( x \) $$ y = 2x+N(0,1), $$
where \( N(0,1) \) represents random numbers generated by the normal distribution. From scikit-learn we import then the LinearRegression functionality and make a prediction \( \tilde{y} = \alpha + \beta x \) using the function fit(x,y). We call the set of data \( (\hat{x},\hat{y}) \) for our training data. The Python package scikit-learn has also a functionality which extracts the above fitting parameters \( \alpha \) and \( \beta \) (see below). Later we will distinguish between training data and test data.
For plotting we use the Python package matplotlib which produces publication quality figures. Feel free to explore the extensive gallery of examples. In this example we plot our original values of \( x \) and \( y \) as well as the prediction ypredict (\( \tilde{y} \)), which attempts at fitting our data with a straight line.
The Python code follows here.
# Importing various packages
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
x = np.random.rand(100,1)
y = 2*x+np.random.randn(100,1)
linreg = LinearRegression()
linreg.fit(x,y)
xnew = np.array([[0],[1]])
ypredict = linreg.predict(xnew)
plt.plot(xnew, ypredict, "r-")
plt.plot(x, y ,'ro')
plt.axis([0,1.0,0, 5.0])
plt.xlabel(r'$x$')
plt.ylabel(r'$y$')
plt.title(r'Simple Linear Regression')
plt.show()
This example serves several aims. It allows us to demonstrate several aspects of data analysis and later machine learning algorithms. The immediate visualization shows that our linear fit is not impressive. It goes through the data points, but there are many outliers which are not reproduced by our linear regression. We could now play around with this small program and change for example the factor in front of \( x \) and the normal distribution. Try to change the function \( y \) to $$ y = 10x+0.01 \times N(0,1), $$
where \( x \) is defined as before. Does the fit look better? Indeed, by reducing the role of the normal distribution we see immediately that our linear prediction seemingly reproduces better the training set. However, this testing 'by the eye' is obviouly not satisfactory in the long run. Here we have only defined the training data and our model, and have not discussed a more rigorous approach to the cost function.
We need more rigorous criteria in defining whether we have succeeded or not in modeling our training data. You will be surprised to see that many scientists seldomly venture beyond this 'by the eye' approach. A standard approach for the cost function is the so-called \( \chi^2 \) function $$ \chi^2 = \frac{1}{n} \sum_{i=0}^{n-1}\frac{(y_i-\tilde{y}_i)^2}{\sigma_i^2}, $$
where \( \sigma_i^2 \) is the variance (to be defined later) of the entry \( y_i \). We may not know the explicit value of \( \sigma_i^2 \), it serves however the aim of scaling the equations and make the cost function dimensionless.
Minimizing the cost function is a central aspect of our discussions to come. Finding its minima as function of the model parameters (\( \alpha \) and \( \beta \) in our case) will be a recurring theme in these series of lectures. Essentially all machine learning algorithms we will discuss center around the minimization of the chosen cost function. This depends in turn on our specific model for describing the data, a typical situation in supervised learning. Automatizing the search for the minima of the cost function is a central ingredient in all algorithms. Typical methods which are employed are various variants of gradient methods. These will be discussed in more detail later. Again, you'll be surprised to hear that many practitioners minimize the above function ''by the eye', popularly dubbed as 'chi by the eye'. That is, change a parameter and see (visually and numerically) that the \( \chi^2 \) function becomes smaller.
There are many ways to define the cost function. A simpler approach is to look at the relative difference between the training data and the predicted data, that is we define the relative error as $$ \epsilon_{\mathrm{relative}}= \frac{\vert \hat{y} -\hat{\tilde{y}}\vert}{\vert \hat{y}\vert}. $$ We can modify easily the above Python code and plot the relative instead
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
x = np.random.rand(100,1)
y = 5*x+0.01*np.random.randn(100,1)
linreg = LinearRegression()
linreg.fit(x,y)
ypredict = linreg.predict(x)
plt.plot(x, np.abs(ypredict-y)/abs(y), "ro")
plt.axis([0,1.0,0.0, 0.5])
plt.xlabel(r'$x$')
plt.ylabel(r'$\epsilon_{\mathrm{relative}}$')
plt.title(r'Relative error')
plt.show()
Depending on the parameter in front of the normal distribution, we may have a small or larger relative error. Try to play around with different training data sets and study (graphically) the value of the relative error.
As mentioned above, scikit-learn has an impressive functionality. We can for example extract the values of \( \alpha \) and \( \beta \) and their error estimates, or the variance and standard deviation and many other properties from the statistical data analysis.
Here we show an example of the functionality of scikit-learn.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, r2_score, mean_squared_log_error, mean_absolute_error
x = np.random.rand(100,1)
y = 2.0+ 5*x+0.5*np.random.randn(100,1)
linreg = LinearRegression()
linreg.fit(x,y)
ypredict = linreg.predict(x)
print('The intercept alpha: \n', linreg.intercept_)
print('Coefficient beta : \n', linreg.coef_)
# The mean squared error
print("Mean squared error: %.2f" % mean_squared_error(y, ypredict))
# Explained variance score: 1 is perfect prediction
print('Variance score: %.2f' % r2_score(y, ypredict))
# Mean squared log error
print('Mean squared log error: %.2f' % mean_squared_log_error(y, ypredict) )
# Mean absolute error
print('Mean absolute error: %.2f' % mean_absolute_error(y, ypredict))
plt.plot(x, ypredict, "r-")
plt.plot(x, y ,'ro')
plt.axis([0.0,1.0,1.5, 7.0])
plt.xlabel(r'$x$')
plt.ylabel(r'$y$')
plt.title(r'Linear Regression fit ')
plt.show()
The function coef gives us the parameter \( \beta \) of our fit while intercept yields \( \alpha \). Depending on the constant in front of the normal distribution, we get values near or far from \( alpha =2 \) and \( \beta =5 \).  The function meansquarederror gives us the mean square error, a risk metric corresponding to the expected value of the squared (quadratic) error or loss defined as $$ MSE(\hat{y},\hat{\tilde{y}}) = \frac{1}{n} \sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2, $$
The smaller the value, the better the fit. Ideally we would like to have an MSE equal zero. The attentive reader has probably recognized this function as being similar to the \( \chi^2 \) function defined above.
The r2score function computes \( R^2 \), the coefficient of determination. It provides a measure of how well future samples are likely to be predicted by the model. Best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of \( \hat{y} \), disregarding the input features, would get a \( R^2 \) score of \( 0.0 \).
If \( \tilde{\hat{y}}_i \) is the predicted value of the \( i-th \) sample and \( y_i \) is the corresponding true value, then the score \( R^2 \) is defined as $$ R^2(\hat{y}, \tilde{\hat{y}}) = 1 - \frac{\sum_{i=0}^{n - 1} (y_i - \tilde{y}_i)^2}{\sum_{i=0}^{n - 1} (y_i - \bar{y})^2}, $$ where we have defined the mean value of \( \hat{y} \) as $$ \bar{y} = \frac{1}{n} \sum_{i=0}^{n - 1} y_i. $$ Another quantity will meet again in our discussions of regression analysis is mean absolute error (MAE), a risk metric corresponding to the expected value of the absolute error loss or what we call the \( l1 \)-norm loss. In our discussion above we presented the relative error. The MAE is defined as follows $$ \text{MAE}(\hat{y}, \hat{\tilde{y}}) = \frac{1}{n} \sum_{i=0}^{n-1} \left| y_i - \tilde{y}_i \right|. $$ Finally we present the squared logarithmic (quadratic) error $$ \text{MSLE}(\hat{y}, \hat{\tilde{y}}) = \frac{1}{n} \sum_{i=0}^{n - 1} (\log_e (1 + y_i) - \log_e (1 + \tilde{y}_i) )^2, $$
where \( \log_e (x) \) stands for the natural logarithm of \( x \). This error estimate is best to use when targets having exponential growth, such as population counts, average sales of a commodity over a span of years etc.
We will discuss in more detail these and other functions in the various lectures. We conclude this part with another example. Instead of a linear \( x \)-dependence we study now a cubic polynomial and use the polynomial regression analysis tools of scikit-learn.
import matplotlib.pyplot as plt
import numpy as np
import random
from sklearn.linear_model import Ridge
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import LinearRegression
x=np.linspace(0.02,0.98,200)
noise = np.asarray(random.sample((range(200)),200))
y=x**3*noise
yn=x**3*100
poly3 = PolynomialFeatures(degree=3)
X = poly3.fit_transform(x[:,np.newaxis])
clf3 = LinearRegression()
clf3.fit(X,y)
Xplot=poly3.fit_transform(x[:,np.newaxis])
poly3_plot=plt.plot(x, clf3.predict(Xplot), label='Cubic Fit')
plt.plot(x,yn, color='red', label="True Cubic")
plt.scatter(x, y, label='Data', color='orange', s=15)
plt.legend()
plt.show()
def error(a):
for i in y:
err=(y-yn)/yn
return abs(np.sum(err))/len(err)
print (error(y))
Similarly, using R, we can perform similar studies. The following R code illustrates this. (more details on R will be inserted later).
set.seed(1485)
len = 24
x = runif(len)
y = x^3+rnorm(len, 0,0.06)
ds = data.frame(x = x, y = y)
str(ds)
plot( y ~ x, main ="Known cubic with noise")
s = seq(0,1,length =100)
lines(s, s^3, lty =2, col ="green")
m = nls(y ~ I(x^power), data = ds, start = list(power=1), trace = T)
class(m)
summary(m)
power = round(summary(m)$coefficients[1], 3)
power.se = round(summary(m)$coefficients[2], 3)
plot(y ~ x, main = "Fitted power model", sub = "Blue: fit; green: known")
s = seq(0, 1, length = 100)
lines(s, s^3, lty = 2, col = "green")
lines(s, predict(m, list(x = s)), lty = 1, col = "blue")
text(0, 0.5, paste("y =x^ (", power, " +/- ", power.se, ")", sep = ""), pos = 4)
In our lectures on regression analysis (and other ones as well), we will discuss in more details various R functionalities.
Another useful Python package is pandas, which is an open source library providing high-performance, easy-to-use data structures and data analysis tools for Python. The following simple example shows how we can, in an easy way make tables of our data. Here we define a data set which includes names, city of residence and age, and displays the data in an easy to read way. We will see repeated use of pandas, in particular in connection with classification of data.
import pandas as pd
from IPython.display import display
data = {'Name': ["John", "Anna", "Peter", "Linda"], 'Location': ["Nairobi", "Napoli", "London", "Buenos Aires"], 'Age':[51, 21, 34, 45]}
data_pandas = pd.DataFrame(data)
display(data_pandas)
We present here several examples, with pertinent Python codes that we will use to illustrate various machine learning methods and ways to analyze, from simple to complex, various data sets. Many of these examples allow us to generate the data we want to analyze, following much of the same philosophy we discussed above when fitting various polynomials.
We start with a simple exponential growth model that is meant to mimick an ecoli lab experiment. We can easily model this system and then produce the data used to train various machine learning algorithms. Another model from the life sciences is the so-called predator-prey model from ecology. Thereafter we present a simple model for financial transactions before moving to a random walk model and ending with the simulation of velocities of a non-interacting atom or molecule confined to move in a one-dimensional region.
A typical pattern seen in population models is that the population grows faster and faster. Why? Is there an underlying (general) mechanism? Here we will construct a model for cell growth based on a simple difference equation for the growth. We make the following assumptions
N[n+1] = N[n] + r*dt*N[n]
The difference equation can be programmed in a simple way, and in order to get started we set \( r=1.5 \), \( N^0=1 \), \( \Delta t=0.5 \). The program reads
import numpy as np
t = np.linspace(0, 10, 21) # 20 intervals in [0, 10]
dt = t[1] - t[0]
N = np.zeros(t.size)
N[0] = 1
r = 0.5
for n in range(0, N.size-1, 1):
N[n+1] = N[n] + r*dt*N[n]
print('N[%d]=%.1f' % (n+1, N[n+1]))
and it generates the following output
N[1]=1.2
N[2]=1.6
N[3]=2.0
N[4]=2.4
N[5]=3.1
N[6]=3.8
N[7]=4.8
N[8]=6.0
N[9]=7.5
N[10]=9.3
N[11]=11.6
N[12]=14.6
N[13]=18.2
N[14]=22.7
N[15]=28.4
N[16]=35.5
N[17]=44.4
N[18]=55.5
N[19]=69.4
N[20]=86.7
This forms our data which later will define our training set. In this case we defined the value of the parameter \( r \). We could alternatively assume that we just received the above data file and where asked to find \( r \). How can we estimate \( r \) from data? This will be one of our tasks later.
We can use the difference equation with the experimental data $$ N^{n+1} = N^n + r\Delta t N^n$$ Suppose now that \( N^{n+1} \) and \( N^n \) are known from data. Then we could solve with respect to \( r \) as follows $$ r = \frac{N^{n+1}-N^n}{N^n\Delta t} $$ Suppose we set \( t_1=600 \), \( t_2=1200 \), \( N^1=140 \) and \( N^2=250 \). The following code plots the data
import numpy as np
import matplotlib.pyplot as plt
# Estimate r
data = np.loadtxt('ecoli.csv', delimiter=',')
t_e = data[:,0]
N_e = data[:,1]
i = 2 # Data point (i,i+1) used to estimate r
r = (N_e[i+1] - N_e[i])/(N_e[i]*(t_e[i+1] - t_e[i]))
print('Estimated r=%.5f' % r)
# Can experiment with r values and see if the model can
# match the data better
T = 1200 # cell can divide after T sec
t_max = 5*T # 5 generations in experiment
t = np.linspace(0, t_max, 1000)
dt = t[1] - t[0]
N = np.zeros(t.size)
N[0] = 100
for n in range(0, len(t)-1, 1):
N[n+1] = N[n] + r*dt*N[n]
plt.plot(t, N, 'r-', t_e, N_e, 'bo')
plt.xlabel('time [s]'); plt.ylabel('N')
plt.legend(['model', 'experiment'], loc='upper left')
plt.show()
We can then change the parameter \( r \) in the program and play around to make a better fit. By now we know that this 'search bythe eye' approach is not the most optimal one.
The population dynamics of a simple predator-prey system is a classical example shown in many biology textbooks when ecological systems are discussed. The system contains all elements of the scientific method:
One reason that this particular system has been so extensively studied is that the Hudson Bay company kept careful records of all furs from the early 1800s into the 1900s. The records for the furs collected by the Hudson Bay company showed distinct oscillations (approximately 12 year periods), suggesting that these species caused almost periodic fluctuations of each other's populations. The table here shows data from 1900 to 1920.
| Year | Hares (x1000) | Lynx (x1000) |
|---|---|---|
| 1900 | 30.0 | 4.0 |
| 1901 | 47.2 | 6.1 |
| 1902 | 70.2 | 9.8 |
| 1903 | 77.4 | 35.2 |
| 1904 | 36.3 | 59.4 |
| 1905 | 20.6 | 41.7 |
| 1906 | 18.1 | 19.0 |
| 1907 | 21.4 | 13.0 |
| 1908 | 22.0 | 8.3 |
| 1909 | 25.4 | 9.1 |
| 1910 | 27.1 | 7.4 |
| 1911 | 40.3 | 8.0 |
| 1912 | 57 | 12.3 |
| 1913 | 76.6 | 19.5 |
| 1914 | 52.3 | 45.7 |
| 1915 | 19.5 | 51.1 |
| 1916 | 11.2 | 29.7 |
| 1917 | 7.6 | 15.8 |
| 1918 | 14.6 | 9.7 |
| 1919 | 16.2 | 10.1 |
| 1920 | 24.7 | 8.6 |
import numpy as np
from matplotlib import pyplot as plt
# Load in data file
data = np.loadtxt('src/Hudson_Bay.csv', delimiter=',', skiprows=1)
# Make arrays containing x-axis and hares and lynx populations
year = data[:,0]
hares = data[:,1]
lynx = data[:,2]
plt.plot(year, hares ,'b-+', year, lynx, 'r-o')
plt.axis([1900,1920,0, 100.0])
plt.xlabel(r'Year')
plt.ylabel(r'Numbers of hares and lynx ')
plt.legend(('Hares','Lynx'), loc='upper right')
plt.title(r'Population of hares and lynx from 1900-1920 (x1000)}')
plt.savefig('Hudson_Bay_data.pdf')
plt.savefig('Hudson_Bay_data.png')
plt.show()
We see from the plot that there are indeed fluctuations. We would like to create a mathematical model that explains these population fluctuations. Ecologists have predicted that in a simple predator-prey system that a rise in prey population is followed (with a lag) by a rise in the predator population. When the predator population is sufficiently high, then the prey population begins dropping. After the prey population falls, then the predator population falls, which allows the prey population to recover and complete one cycle of this interaction. Thus, we see that qualitatively oscillations occur. Can a mathematical model predict this? What causes cycles to slow or speed up? What affects the amplitude of the oscillation or do you expect to see the oscillations damp to a stable equilibrium? The models tend to ignore factors like climate and other complicating factors. How significant are these?
Here,
We assume that the primary growth for the lynx population depends on sufficient food for raising lynx kittens, which implies an adequate source of nutrients from predation on hares. Thus, the growth of the lynx population does not only depend of how many lynx there are, but on how many hares they can eat. In a time interval \( \Delta t HL \) hares and lynx can meet, and in a fraction \( b\Delta t HL \) the lynx eats the hare. All of this does not contribute to the growth of lynx, again just a fraction of \( b\Delta t HL \) that we write as \( d\Delta t HL \). In addition, lynx die just as in the population dynamics with one isolated animal population, leading to a loss \( -c\Delta t L \). The accounting of lynx then looks like $$ \Delta L = d\Delta t H^nL^n - c\Delta t L^n$$
By writing up the definition of \( \Delta H \) and \( \Delta L \), and putting all assumed known terms \( H^n \) and \( L^n \) on the right-hand side, we have $$ H^{n+1} = H^n + a\Delta t H^n - b\Delta t H^n L^n $$ $$ L^{n+1} = L^n + d\Delta t H^nL^n - c\Delta t L^n $$
Note:
import numpy as np
import matplotlib.pyplot as plt
def solver(m, H0, L0, dt, a, b, c, d, t0):
"""Solve the difference equations for H and L over m years
with time step dt (measured in years."""
num_intervals = int(m/float(dt))
t = np.linspace(t0, t0 + m, num_intervals+1)
H = np.zeros(t.size)
L = np.zeros(t.size)
print('Init:', H0, L0, dt)
H[0] = H0
L[0] = L0
for n in range(0, len(t)-1):
H[n+1] = H[n] + a*dt*H[n] - b*dt*H[n]*L[n]
L[n+1] = L[n] + d*dt*H[n]*L[n] - c*dt*L[n]
return H, L, t
# Load in data file
data = np.loadtxt('src/Hudson_Bay.csv', delimiter=',', skiprows=1)
# Make arrays containing x-axis and hares and lynx populations
t_e = data[:,0]
H_e = data[:,1]
L_e = data[:,2]
# Simulate using the model
H, L, t = solver(m=20, H0=34.91, L0=3.857, dt=0.1,
a=0.4807, b=0.02482, c=0.9272, d=0.02756,
t0=1900)
# Visualize simulations and data
plt.plot(t_e, H_e, 'b-+', t_e, L_e, 'r-o', t, H, 'm--', t, L, 'k--')
plt.xlabel('Year')
plt.ylabel('Numbers of hares and lynx')
plt.axis([1900, 1920, 0, 140])
plt.title(r'Population of hares and lynx 1900-1920 (x1000)')
plt.legend(('H_e', 'L_e', 'H', 'L'), loc='upper left')
plt.savefig('Hudson_Bay_sim.pdf')
plt.savefig('Hudson_Bay_sim.png')
plt.show()
We will later perform a least-square fitting. Then we can find optimal values for the parameters \( a \), \( b \), \( d \), \( c \). In our calculations here we set \( a=0.4807 \), \( b=0.02482 \), \( d=0.9272 \) and \( c=0.02756 \). These parameters result in a slightly modified initial conditions, namely \( H(0) = 34.91 \) and \( L(0)=3.857 \).
The following Python code demonstrates how we can use linear regression to fit for example the population of lynx. Similarly, we have also used a decision tree algorithm to fit the lynx population data. As expected, the linear regression is not exactly impressive
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display
import sklearn
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
data = np.loadtxt('src/Hudson_Bay.csv', delimiter=',', skiprows=1)
x = data[:,0]
y = data[:,1]
line = np.linspace(1900,1920,1000,endpoint=False).reshape(-1,1)
reg = DecisionTreeRegressor(min_samples_split=3).fit(x.reshape(-1,1),y.reshape(-1,1))
plt.plot(line, reg.predict(line), label="decision tree")
regline = LinearRegression().fit(x.reshape(-1,1),y.reshape(-1,1))
plt.plot(line, regline.predict(line), label= "Linear Regression")
plt.plot(x, y, label= "Linear Regression")
plt.show()
The similar code for linear regression in R reads (more details to come)
HudsonBay = read.csv("src/Hudson_Bay.csv",header=T)
fix(HudsonBay)
dim(HudsonBay)
names(HudsonBay)
plot(HudsonBay$Year, HudsonBay$Hares..x1000.)
attach(HudsonBay)
plot(Year, Hares..x1000.)
plot(Year, Hares..x1000., col="red", varwidth=T, xlab="Years", ylab="Haresx 1000")
summary(HudsonBay)
summary(Hares..x1000.)
library(MASS)
library(ISLR)
scatter.smooth(x=Year, y = Hares..x1000.)
linearMod = lm(Hares..x1000. ~ Year)
print(linearMod)
summary(linearMod)
plot(linearMod)
confint(linearMod)
predict(linearMod,data.frame(Year=c(1910,1914,1920)),interval="confidence")
The aim here is to simulate financial transactions among financial agents using Monte Carlo methods. The final goal is to extract a distribution of income as function of the income \( m \). From Pareto's work (V. Pareto, 1897) it is known from empirical studies that the higher end of the distribution of money follows a distribution $$ w_m\propto m^{-1-\alpha}, $$ with \( \alpha\in [1,2] \). We will here follow the analysis made by Patriarca and collaborators.
Here we will study numerically the relation between the micro-dynamic relations among financial agents and the resulting macroscopic money distribution.
We assume we have \( N \) agents that exchange money in pairs \( (i,j) \). We assume also that all agents start with the same amount of money \( m_0 > 0 \). At a given 'time step', we choose randomly a pair of agents \( (i,j) \) and let a transaction take place. This means that agent \( i \)'s money \( m_i \) changes to \( m_i' \) and similarly we have \( m_j\rightarrow m_j' \). Money is conserved during a transaction, meaning that $$ \begin{equation} m_i+m_j=m_i'+m_j'. \label{eq:conserve} \end{equation} $$ The change is done via a random reassignement (a random number) \( \epsilon \), meaning that $$ \begin{equation*} m_i' = \epsilon(m_i+m_j), \end{equation*} $$ leading to $$ \begin{equation*} m_j'= (1-\epsilon)(m_i+m_j). \end{equation*} $$ The number \( \epsilon \) is extracted from a uniform distribution. In this simple model, no agents are left with a debt, that is \( m\ge 0 \). Due to the conservation law above, one can show that the system relaxes toward an equilibrium state given by a Gibbs distribution $$ \begin{equation*} w_m=\beta \exp{(-\beta m)}, \end{equation*} $$ with $$ \begin{equation*} \beta = \frac{1}{\langle m\rangle}, \end{equation*} $$ and \( \langle m\rangle=\sum_i m_i/N=m_0 \), the average money. It means that after equilibrium has been reached that the majority of agents is left with a small number of money, while the number of richest agents, those with \( m \) larger than a specific value \( m' \), exponentially decreases with \( m' \).
We assume that we have \( N=500 \) agents. In each simulation, we need a sufficiently large number of transactions, say \( 10^7 \). Our aim is find the final equilibrium distribution \( w_m \). In order to do that we would need several runs of the above simulations, at least \( 10^3-10^4 \) runs (experiments).
Our task is to first set up an algorithm which simulates the above transactions with an initial amount \( m_0 \). The challenge here is to figure out a Monte Carlo simulation based on the above equations. You will in particular need to make an algorithm which sets up a histogram as function of \( m \). This histogram contains the number of times a value \( m \) is registered and represents \( w_m\Delta m \). You will need to set up a value for the interval \( \Delta m \) (typically \( 0.01-0.05 \)). That means you need to account for the number of times you register an income in the interval \( m,m+\Delta m \). The number of times you register this income, represents the value that enters the histogram.
#!/usr/bin/env python
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import random
# initialize the rng with a seed
random.seed()
# Hard coding of input parameters
Agents = 500
MCcounts = 1000
Transactions = 100000
startMoney = 1.0
Lambda = 0.0
FinancialAgents = startMoney*np.ones(Agents)
for i in range (1, MCcounts, 1):
for j in range (1, Transactions, 1):
agent_i = int(Agents*random.random())
agent_j = int(Agents*random.random())
epsilon = random.random()
if agent_i != agent_j:
m1 = Lambda*FinancialAgents[agent_i] + (1-Lambda)*epsilon*(FinancialAgents[agent_i] + FinancialAgents[agent_j])
m2 = Lambda*FinancialAgents[agent_j] + (1-Lambda)*(1-epsilon)*(FinancialAgents[agent_i] + FinancialAgents[agent_j])
FinancialAgents[agent_i] = m1
FinancialAgents[agent_j] = m2
# the histogram of the data
n, bins, patches = plt.hist(FinancialAgents, 50, facecolor='green')
plt.xlabel('$x$')
plt.ylabel('Distribution of wealth')
plt.title(r'Money')
plt.axis([0, 10, 0, 500])
plt.grid(True)
plt.show()
We can then change our model to allow for a saving criterion, meaning that the agents save a fraction \( \lambda \) of the money they have before the transaction is made. The final distribution will then no longer be given by Gibbs distribution. It could also include a taxation on financial transactions.
The conservation law of Eq. \eqref{eq:conserve} holds, but the money to be shared in a transaction between agent \( i \) and agent \( j \) is now \( (1-\lambda)(m_i+m_j) \). This means that we have $$ \begin{equation*} m_i' = \lambda m_i+\epsilon(1-\lambda)(m_i+m_j), \end{equation*} $$ and $$ \begin{equation*} m_j' = \lambda m_j+(1-\epsilon)(1-\lambda)(m_i+m_j), \end{equation*} $$ which can be written as $$ \begin{equation*} m_i'=m_i+\delta m \end{equation*} $$ and $$ \begin{equation*} m_j'=m_j-\delta m, \end{equation*} $$ with $$ \begin{equation*} \delta m=(1-\lambda)(\epsilon m_j-(1-\epsilon)m_i), \end{equation*} $$ showing how money is conserved during a transaction. Select values of \( \lambda =0.25,0.5 \) and \( \lambda=0.9 \) and try to extract the corresponding equilibrium distributions and compare these with the Gibbs distribution. We will use this model to extract a parametrization of the above curves, see for example Patriarca and collaborators.
# Program to test the Metropolis algorithm with one particle at given temp in one dimension
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import random
from math import sqrt, exp, log
# initialize the rng with a seed
random.seed()
# Hard coding of input parameters
MCcycles = 100000
Temperature = 2.0
beta = 1./Temperature
InitialVelocity = -2.0
CurrentVelocity = InitialVelocity
Energy = 0.5*InitialVelocity*InitialVelocity
VelocityRange = 10*sqrt(Temperature)
VelocityStep = 2*VelocityRange/10.
AverageEnergy = Energy
AverageEnergy2 = Energy*Energy
VelocityValues = np.zeros(MCcycles)
# The Monte Carlo sampling with Metropolis starts here
for i in range (1, MCcycles, 1):
TrialVelocity = CurrentVelocity + (2.0*random.random() - 1.0)*VelocityStep
EnergyChange = 0.5*(TrialVelocity*TrialVelocity -CurrentVelocity*CurrentVelocity);
if random.random() <= exp(-beta*EnergyChange):
CurrentVelocity = TrialVelocity
Energy += EnergyChange
VelocityValues[i] = CurrentVelocity
AverageEnergy += Energy
AverageEnergy2 += Energy*Energy
#Final averages
AverageEnergy = AverageEnergy/MCcycles
AverageEnergy2 = AverageEnergy2/MCcycles
Variance = AverageEnergy2 - AverageEnergy*AverageEnergy
print(AverageEnergy, Variance)
n, bins, patches = plt.hist(VelocityValues, 400, facecolor='green')
plt.xlabel('$v$')
plt.ylabel('Velocity distribution P(v)')
plt.title(r'Velocity histogram at $k_BT=2$')
plt.axis([-5, 5, 0, 600])
plt.grid(True)
plt.show()
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
steps=250
distance=0
x=0
distance_list=[]
steps_list=[]
while x<steps:
distance+=np.random.randint(-1,2)
distance_list.append(distance)
x+=1
steps_list.append(x)
plt.plot(steps_list,distance_list, color='green', label="Random Walk Data")
steps_list=np.asarray(steps_list)
distance_list=np.asarray(distance_list)
X=steps_list[:,np.newaxis]
#Polynomial fits
#Degree 2
poly_features=PolynomialFeatures(degree=2, include_bias=False)
X_poly=poly_features.fit_transform(X)
lin_reg=LinearRegression()
poly_fit=lin_reg.fit(X_poly,distance_list)
b=lin_reg.coef_
c=lin_reg.intercept_
print ("2nd degree coefficients:")
print ("zero power: ",c)
print ("first power: ", b[0])
print ("second power: ",b[1])
z = np.arange(0, steps, .01)
z_mod=b[1]*z**2+b[0]*z+c
fit_mod=b[1]*X**2+b[0]*X+c
plt.plot(z, z_mod, color='r', label="2nd Degree Fit")
plt.title("Polynomial Regression")
plt.xlabel("Steps")
plt.ylabel("Distance")
#Degree 10
poly_features10=PolynomialFeatures(degree=10, include_bias=False)
X_poly10=poly_features10.fit_transform(X)
poly_fit10=lin_reg.fit(X_poly10,distance_list)
y_plot=poly_fit10.predict(X_poly10)
plt.plot(X, y_plot, color='black', label="10th Degree Fit")
plt.legend()
plt.show()
#Decision Tree Regression
from sklearn.tree import DecisionTreeRegressor
regr_1=DecisionTreeRegressor(max_depth=2)
regr_2=DecisionTreeRegressor(max_depth=5)
regr_3=DecisionTreeRegressor(max_depth=7)
regr_1.fit(X, distance_list)
regr_2.fit(X, distance_list)
regr_3.fit(X, distance_list)
X_test = np.arange(0.0, steps, 0.01)[:, np.newaxis]
y_1 = regr_1.predict(X_test)
y_2 = regr_2.predict(X_test)
y_3=regr_3.predict(X_test)
# Plot the results
plt.figure()
plt.scatter(X, distance_list, s=2.5, c="black", label="data")
plt.plot(X_test, y_1, color="red",
label="max_depth=2", linewidth=2)
plt.plot(X_test, y_2, color="green", label="max_depth=5", linewidth=2)
plt.plot(X_test, y_3, color="m", label="max_depth=7", linewidth=2)
plt.xlabel("Data")
plt.ylabel("Darget")
plt.title("Decision Tree Regression")
plt.legend()
plt.show()


American Animals
American Animals is a movie starring Spencer Reinhard, Warren Lipka, and Eric Borsuk. Four young men mistake their lives for a movie and attempt one of the most audacious heists in U.S. history.


Barbara Moore paid the invoice #ABC123456789
10 minutes ago
New User Registered
1 minute ago
Profile Settings


Hello guys, welcome to my basic web app to testing your knowledge about the JavaScript basics.
To earn a badge you must be 90% or more
¿Are you ready?

You can share your achievement on Twitter and / or overcome another challenge.


{{recipe.craftingJob}}
Armorer
Alchemist
Blacksmith
Carpenter
Weaver
Leatherworker
Goldsmith
Culinarian
{{recipe.craftingLevel}}
Required Craftsmanship:
{{recipe.requiredCraftsmanship}}
Required Control:
{{recipe.requiredControl}}
{{recipe.stars}} Stars
Master {{recipe.masterbook}}


- Legal aspects of cryptocurrency and Blockchain.
- How to make your status bigger with help of
cryptocurrency.
- What trends and future of Blockchain, Bitcoin, ICO.
- How and where to get earned with help of mining cryptocurrency.
- How to tune home mining
correctly.
- Blockchain development.
PlovDev is a one-day IT conference. The purpose of the event is to bring together students and business people to exchange experience and enthusiasm.


top-post
`Prev `__
T
`Next `__
--------------
**top-post**: n., v.
[common] To put the newly-added portion of an email or Usenet response
before the quoted part, as opposed to the more logical sequence of
quoted portion first with original following. The problem with this
practice is neatly summed up by the following FAQ entry:
+--------------------------------------------------------------------------+
| .. code:: screen |
| |
| A: No. |
| Q: Should I include quotations after my reply? |
+--------------------------------------------------------------------------+
This term is generally used pejoratively with the implication that the
offending person is a `*newbie* <../N/newbie.html>`__, a Microsoft
addict (Microsoft mail tools produce a similar format by default), or
simply a common-and-garden-variety idiot.
One major problem with top-posting is that people who do it all too
frequently quote the *entire* parent message rather than trimming it
down to those portions relevent to their reply — this makes threads
bulky and unnecessarily difficult to read and arouses the righteous ire
of experienced Internet residents (this style is called “TOFU” for “text
over, fullquote under”, or sometimes “jeopardy-style quoting”). Another
problem is that top-posters often word their replies on the assumption
that you just read the previous message, even though their perversity
has put it further down the page than you have yet read. Oppose
`*bottom-post* <../B/bottom-post.html>`__.
--------------
+-------------------------+----------------------------+--------------------------------+
| `Prev `__ | `Up <../T.html>`__ | `Next `__ |
+-------------------------+----------------------------+--------------------------------+
| toor | `Home <../index.html>`__ | topic drift |
+-------------------------+----------------------------+--------------------------------+


About
My name is Minolta Ndlovu, a sophomore at Bryn Mawr College studying Computer Science and Economics. I am a front-end development enthusiast constantly seeking out new learning opportunities. My passion lies in Computer Science education with a focus on getting more women coders. On campus I am the president of Girls Who Code which is an organization that teaches women how to code. I am also a Codepath tech fellow. Codepath is an organization that brings technology classes on campus. Currently, I facilitated Codepath's Android development course.
During my spare time, I love capturing moments through photography and playing basketball


|
||||||||||
| PREV NEXT | FRAMES NO FRAMES |
| Packages that use org.apache.commons.math.analysis | |
|---|---|
| org.apache.commons.math.analysis | Parent package for common numerical analysis procedures, including root finding, function interpolation and integration. |
| org.apache.commons.math.analysis.integration | Numerical integration (quadrature) algorithms for univariate real functions. |
| org.apache.commons.math.analysis.interpolation | Univariate real functions interpolation algorithms. |
| org.apache.commons.math.analysis.polynomials | Univariate real polynomials implementations, seen as differentiable univariate real functions. |
| org.apache.commons.math.analysis.solvers | Root finding algorithms, for univariate real functions. |
| org.apache.commons.math.linear | Linear algebra support. |
| org.apache.commons.math.optimization | This package provides common interfaces for the optimization algorithms provided in sub-packages. |
| org.apache.commons.math.optimization.direct | This package provides optimization algorithms that don't require derivatives. |
| org.apache.commons.math.optimization.fitting | This package provides classes to perform curve fitting. |
| org.apache.commons.math.optimization.general | This package provides optimization algorithms that require derivatives. |
| org.apache.commons.math.optimization.univariate | Univariate real functions minimum finding algorithms. |
| org.apache.commons.math.transform | Implementations of transform methods, including Fast Fourier transforms. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.analysis | |
|---|---|
| BinaryFunction
Deprecated. in 2.2 |
|
| BivariateRealFunction
An interface representing a bivariate real function. |
|
| ComposableFunction
Base class for UnivariateRealFunction that can be composed with other functions. |
|
| MultivariateMatrixFunction
An interface representing a multivariate matrix function. |
|
| MultivariateRealFunction
An interface representing a multivariate real function. |
|
| MultivariateVectorialFunction
An interface representing a multivariate vectorial function. |
|
| UnivariateMatrixFunction
An interface representing a univariate matrix function. |
|
| UnivariateRealFunction
An interface representing a univariate real function. |
|
| UnivariateVectorialFunction
An interface representing a univariate vectorial function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.analysis.integration | |
|---|---|
| UnivariateRealFunction
An interface representing a univariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.analysis.interpolation | |
|---|---|
| BivariateRealFunction
An interface representing a bivariate real function. |
|
| MultivariateRealFunction
An interface representing a multivariate real function. |
|
| TrivariateRealFunction
An interface representing a trivariate real function. |
|
| UnivariateRealFunction
An interface representing a univariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.analysis.polynomials | |
|---|---|
| DifferentiableUnivariateRealFunction
Extension of UnivariateRealFunction representing a differentiable univariate real function. |
|
| UnivariateRealFunction
An interface representing a univariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.analysis.solvers | |
|---|---|
| DifferentiableUnivariateRealFunction
Extension of UnivariateRealFunction representing a differentiable univariate real function. |
|
| UnivariateRealFunction
An interface representing a univariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.linear | |
|---|---|
| UnivariateRealFunction
An interface representing a univariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.optimization | |
|---|---|
| DifferentiableMultivariateRealFunction
Extension of MultivariateRealFunction representing a differentiable
multivariate real function. |
|
| DifferentiableMultivariateVectorialFunction
Extension of MultivariateVectorialFunction representing a differentiable
multivariate vectorial function. |
|
| MultivariateRealFunction
An interface representing a multivariate real function. |
|
| MultivariateVectorialFunction
An interface representing a multivariate vectorial function. |
|
| UnivariateRealFunction
An interface representing a univariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.optimization.direct | |
|---|---|
| MultivariateRealFunction
An interface representing a multivariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.optimization.fitting | |
|---|---|
| DifferentiableUnivariateRealFunction
Extension of UnivariateRealFunction representing a differentiable univariate real function. |
|
| UnivariateRealFunction
An interface representing a univariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.optimization.general | |
|---|---|
| DifferentiableMultivariateRealFunction
Extension of MultivariateRealFunction representing a differentiable
multivariate real function. |
|
| DifferentiableMultivariateVectorialFunction
Extension of MultivariateVectorialFunction representing a differentiable
multivariate vectorial function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.optimization.univariate | |
|---|---|
| UnivariateRealFunction
An interface representing a univariate real function. |
| Classes in org.apache.commons.math.analysis used by org.apache.commons.math.transform | |
|---|---|
| UnivariateRealFunction
An interface representing a univariate real function. |
|
||||||||||
| PREV NEXT | FRAMES NO FRAMES |


Main Menu
Logout
About
Credits
Section I - Confidential Patient Information
{{message}}
A4. Name
A7. Address
Other Details
Other confidential information about the house.
Logout
Next


Unlimited Games. How should Red play 42
pips Red=156 White=136
(CorrectAnswer= 0/0, ErrorScore= 0)
I occasionally post problems where there is no single correct answer. This is one of them.
13/9*, 8/6 and 24/22, 13/9* have identical equities and both game plans are fine.
13/11, 13/9* would be wrong, both leaving more indirect shots and doing nothing about the rear checkers.
13/9*, 8/6 and 24/22, 13/9* have identical equities and both game plans are fine.
13/11, 13/9* would be wrong, both leaving more indirect shots and doing nothing about the rear checkers.
1. Cubeful 2-ply 13/9* 8/6 Eq.: +0.010 0.503 0.168 0.008 - 0.497 0.160 0.010 2. Cubeful 2-ply 24/22 13/9* Eq.: -0.016 (-0.027) 0.517 0.160 0.009 - 0.483 0.201 0.015 3. Cubeful 2-ply 13/11 13/9* Eq.: -0.048 (-0.058) 0.502 0.158 0.007 - 0.498 0.186 0.018 4. Cubeful 2-ply 13/9*/7 Eq.: -0.090 (-0.100) 0.481 0.150 0.006 - 0.519 0.174 0.011 5. Cubeful 2-ply 13/9* 7/5 Eq.: -0.140 (-0.150) 0.474 0.150 0.007 - 0.526 0.189 0.017


{% extends 'login/base2.html' %} {% load staticfiles %} {% block content %}
'Forgotten your password? Enter your email address below, and we’ll email instructions for setting a new one.'


MARS ATTACKS! A film review by Andrew Hicks Copyright 1996 Andrew Hicks / Fatboy Productions
(1996) *** (out of four)
Tim Burton loves to indulge himself. His BATMAN films steered the venerable superhero out of his usual comfort zone and into Burton's own brooding vision of Gotham, his ED WOOD was one man's homage to the worst movie director ever, and this film, MARS ATTACKS, is Burton's own bizarre, campy take on the science-fiction genre. Five months after INDEPENDENCE DAY, this movie offers an even more caricaturistic take on aliens attacking Earth, one which has a deliciously mod art direction and a great sense of humor.
Another thing linking INDEPENDENCE DAY and MARS ATTACKS is the star-studded ensemble cast that doesn't take itself the least bit seriously, although this film's cast blows ID4's out of the water. Jack Nicholson stars as both the President and a seedy Vegas land schemer. Glenn Close -- the second-billed star who has maybe five lines tops -- plays the First Lady, with Natalie Portman as their teenage daughter (if Chelsea Clinton was this cute, we'd have to throw the two-term limit out the window), Martin Short as the lusty press secretary and Pierce Brosnan as the professor optimistic about alien life.
Outside of the White House are Michael J. Fox and Sarah Jessica Parker are married journalists with jobs at competing TV stations. Blaxploitation star Jim Brown is an ex-boxer who makes a living dressed up as a pharoah at the Vegas casino Tom Jones headlines. Yes, Tom is part of the MARS ATTACKS ensemble, and even gets a few lines in when he's not singing "It's Not Unusual." Danny DeVito and Lukas Haas are also in there somewhere. With a cast this big, most of the stars don't get a whole lot of screen time.
The Martians themselves are a main part of the cast. A mixture of computer and stop-motion animation, they walk funny, have huge heads and bleed green. Obviously, they don't come in peace -- how much fun would it be if they did? No, these guys start an all-out war on the human race which includes disentigrating Congress (whether this is good or bad for humanity is debatable) and re-sculpting Mount Rushmore into their likenesses.
Certain parts of MARS ATTACKS are Burton at his finest -- brightly colored sets and costumes, juvenile sight gags and corny lines delivered straight. But don't mistake this for a parody along the lines of SPY HARD or HOT SHOTS, this is more of a satire of an entire genre, a satire that relies more on over-acting and a mixture of incredible and purposefully-bad special effects. The alien saucers are little more than spinning pie plates but, as in ID4, various worldwide monuments are convincingly destroyed.
MARS ATTACKS, serious or not, makes for a good disaster epic. That it actually has a sense of humor is a bonus. The rating on this movie would be much higher if not for the slow first half of the film. The last forty-five minutes or so is all four-star material, but MARS ATTACKS takes its sweet time to get started. It takes a certain amount of time to introduce the characters and set-up the invasion and attack. Here is where we could have used a lot of laughs, but Burton plays most of the opening scenes surreal yet basically serious. A lot of talent and potential comic material goes to waste there, which is a disaster in itself.
--
Visit the Movie Critic at LARGE homepage at http://www.missouri.edu/~c667778/movies.html Serving America For Over 1/33rd of a Century!
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


Files massrp-latest/ massrp-old/ ShutdownAndRestart JS Connecting-Dots Anti_000WebHost Overlay [Back]


| Name: mrs. kasthuri | Reg No: 12-7smmhc18 |
|---|---|
| Age / Sex:69/f | Contact No:9945107380 |
| Marital Status:married | Date:23/7/18 |
| Occupation: retd. Bank officer. Home maker now | Dr. pjfp |
Address: Native of blore |
DIAGNOSIS- |
Involuntary oozing of stool 2 smtimes in a day frm 2 years. By evening near the rectum feels it is collected and it is causing the problem. Diagnosed then as follicular proctitis. Gets flatus and motion also. Belching at times. Sour eructations.
k/c/o:
of htn frm 4-5 yrs, during getting treated fr dm then diagnosed htn.
Dm frm 15 years. Cnt remember hw she got it.
Hot flushes at times. Sudden sweating and after 5-10 min gets ok.
Has 2 daughters.
Bp: 140/70mmhg.
1 yr back got worm infestation took allo rx. Had some eggs in the motion.
Husband died 2006- suffering frm parkinsonism.
Rx:
Cina 1m – 4-4-4-4.
Aloes 200 – 4-4-4-4.
Pentaphos 2-0-2 .
Take 350.
6/8/18: evening better by 10% but no other major change. feels spicy on the tongue. Before use to eat spicy more. But now unable to. Frm 2 months. Bp: 120/70mmhg.
Rx:
Aloes/sulphur1m – 4-4-4-4 for 1 dram
Ferr phos 12x 4-4-4-4.
Alumina 30 – 7 doses – alternate days.
17/8/18:
3 days back cold running nose. From today cough. Getting watery eyes and feeling nausea at times. When trying to control the cough she feels nauseated. Irritation in throat itching ears.
Evening hard motion. Little keeps coming out. must pressure to bring out the motion while morning happens involuntarily.
Bp: 110/70mmhg. rs clear. Tongue white coating mapped . not offensive. Eyes clear.
Rx:
For 3 days:
Ars 1m+gels1m+wyethia 200 – 4pills 3 hourly with water.
kali sulph 6x+nat mur 12x 4-4-4-4.
After 3 days.
Pulsatilla1m+sulphur1m +zincummet 200 – 4-4-4-4.
Rub 15 – 1 dose night b/food.
Pentaphos 2-2-2.
6/9/18: evening better. But rectum feeling better. Same in the morning. After first motion gets involuntary feeling. Sour eructations also are there. But overall better in the evenings after medicine. Bp: 110/70mmhg.
Rx:
Causticum 30 disc 3-0-3 15 days.
Pulsatilla1m/sulphur1m – 4-4-4-4 for 4 days repeat weekly.
Nat phos 12x 4-4-4-4.
Cough and cold: 4 pills sos.
ars 30/gels 30/bry 30. 2 dram pills
2/9/18:
alumina1m/causticum1m/sepia1m -4-4-4-4.
Kali phos 6x/mag phos 12x 4-4-4-4.
Rub 15 -1 night b/food.
Thuja 1m – 2 doses – weekly.
C.veg 30 – 4 pills – gastritis. In sos
16/10/18: evening better. Mng stil same.. bloating and eructations same.
Kali phos 6x/mag phos 12x 4-4-4-4.
Nat sulph 200/alumina 200/sepia 200 4-4-4-4.
china 200 – 4 pills – gastritis. In sos
30/10/18: no much change. continuous oozing of motion. At times itching. Hut gushes at times. Joint pain at times, thigh pain at times.
Rx:
baryta carb30 – 4-4-4-4 for 5 days. 1 dram 30 size pills.
Carcinosin1m – daily night b/food. 4 pills. 1 dram
Phos 30 – 4-4-4-4. 2 dram pills 4-4-4.
28/11/18: evening better. Mng no change. gastritis while taking medicines better. More eructations. Morning no control. 63.3kg
Rx:
baryta carb200 – 4-4-4-4 for 5 days. 1 dram 30 size pills.
Zincum met 30 – 4 pills night.
Phos 1m – 5 doses – once in 3 days.
Carbo veg 30/lyco 30 – 4-4-4-4
Leptandra 30 4-4-4-4.
22/12/18: morning no control. Gastritis there same like before. Bloating. Joitn pain, cough cold prevention.
Rx:
Acid nit 200 – 4-4-4-4.
Acon+hs30– 4pills sos.
Psor, merc sol , aloes..
Psor 10m – weekly
Merc sol 1m – night
Aloes1m mng
Podophyllum 1m – afternoon.
18/3/19: belching. Bloating. Rt. Knee pain since 10 days. Did vajrasanan and some discomfort frm then. <walking. Limping and pain. cant move fast. Level sitting is fine if it is in lower level can’t get up also. Bp: 130/70mmhg.
Rx:
Lycopodium 200 – 4-4-4-4 1 dram
Rhus tox /bryonia/symphytum 200 – 4-4-4-4 1 dram
Rheumagic oil.
Sil 6x/calc phos 6x – 4-4-4 a/food.
Fil cal – 1 tab mng a/food with water.
15/4/19: irritation and nose block uneasiness in the throat. Sneezing. Gastritis boating is there.
Rx:
1. Apis1m/bryonia1m/ruta1m– 4-4-4-4. 30 size pills 1 dram knee pain
2. lachesis 200 – 4-0-4 disc b/food. Knee pain
3. lycopodium1m – 4-0-4 b/food – general health.
4. gambogia 200 – 4-4-4 a/food. Pills. Gastritis.
5. kurchi Q – 15-15-15 drops a/food. Gastritis.
6. thyroseptol – gargling.


- This agreement replaces any earlier written or verbal agreements you have made.
- The court won’t do anything more about this claim once this agreement is signed by those named. This is known as ‘a stay’.
- If the court hasn’t heard from you or anyone else named in this agreement by 1 August 2017 the claim and any related defence will be cancelled (‘struck out’).
- Don’t tell people about this agreement once you’ve signed it. You must keep this information confidential.
Review agreement
Claim reference: CF91-BK65
Claimant: Jan Clark
Defendant: Mary Richards
You agreed the following:
- What
- Mary Richards will organise for the roof to be repaired on or before 1 May.
- Amount
- Jan Clark will pay Mary Richards £50 to cover the materials.
- Payment
- By cash or Bacs
Terms
If this agreement is broken
If the other party breaks this agreement you can ask the court to:
- enter judgment for you
- reopen the claim for a hearing for the full amount claimed
The other party can also apply to the court if you break this agreement.
Statement of truth
By signing this agreement you confirm that any information you have given is true, to the best of your knowledge.
You also confirm that you have read and accept this agreement and its terms.
Sign agreement Download draft as pdf


| pgpool-II 4.0.3 Documentation | |||
|---|---|---|---|
| Prev | Up | Chapter 5. Server Configuration | Next |
Pgpool-II supports two destinations for logging the Pgpool-II messages. The supported log destinations are stderr and syslog. You can also set this parameter to a list of desired log destinations separated by commas if you want the log messages on the multiple destinations.
#for example to log on both syslog and stderr log_destination = 'syslog,stderr'
The default is to log to stderr only.
Note: On some systems you will need to alter the configuration of your system's syslog daemon in order to make use of the syslog option for log_destination. Pgpool-II can log to syslog facilities LOCAL0 through LOCAL7 (see syslog_facility), but the default syslog configuration on most platforms will discard all such messages. You will need to add something like:
local0.* /var/log/pgpool.logto the syslog daemon's configuration file to make it work.
This parameter can be changed by reloading the Pgpool-II configurations.
See also the documentation of your system's syslog daemon. When logging to syslog is enabled, this parameter determines the syslog "facility" to be used. You can choose from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7; the default is LOCAL0. See also the documentation of your system's syslog daemon.
This parameter can be changed by reloading the Pgpool-II configurations.
When logging to syslog is enabled, this parameter determines the program name used to identify Pgpool-II messages in syslog logs. The default is pgpool.
This parameter can be changed by reloading the Pgpool-II configurations.
Controls which minimum message levels are sent to the client. Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, LOG, NOTICE, WARNING and ERROR. Each level includes all the levels that follow it. The default is NOTICE.
This parameter can be changed by reloading the Pgpool-II configurations. You can also use PGPOOL SET command to alter the value of this parameter for a current session.
The default is WARNING. Controls which minimum message levels are emitted to log. Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, INFO, NOTICE, WARNING, ERROR, LOG, FATAL, and PANIC. Each level includes all the levels that follow it. The default is WARNING.
This parameter can be changed by reloading the Pgpool-II configurations. You can also use PGPOOL SET command to alter the value of this parameter for a current session.
Setting to on, prints all SQL statements to the log.
This parameter can be changed by reloading the Pgpool-II configurations. You can also use PGPOOL SET command to alter the value of this parameter for a current session.
Similar to log_statement, except that it print the logs for each DB node separately. It can be useful to make sure that replication or load-balancing is working.
This parameter can be changed by reloading the Pgpool-II configurations. You can also use PGPOOL SET command to alter the value of this parameter for a current session.
Setting to on, prints client messages to the log.
This parameter can be changed by reloading the Pgpool-II configurations. You can also use PGPOOL SET command to alter the value of this parameter for a current session.
Setting to on, prints the hostname instead of IP address in the ps command result, and connection logs (when log_connections is on).
This parameter can be changed by reloading the Pgpool-II configurations.
Setting to on, prints all client connections from to the log.
This parameter can be changed by reloading the Pgpool-II configurations.
Controls the amount of detail emitted for each message that is logged. Valid values are TERSE, DEFAULT, and VERBOSE, each adding more fields to displayed messages. TERSE excludes the logging of DETAIL, HINT, and CONTEXT error information.
This parameter can be changed by reloading the Pgpool-II configurations. You can also use PGPOOL SET command to alter the value of this parameter for a current session.
This is a printf
-style string that is output at the beginning of
each log line.
% characters begin "escape sequences" that are replaced
with information outlined below.
All unrecognized escapes are ignored. Other characters are copied straight to
the log line. Default is '%t: pid %p: ', which prints timestamp and process id,
which keeps backward compatibily with prePgpool-II
V3.4.
Table 5-5. log_line_prefix escape options
| Escape | Effect |
|---|---|
| %a | Client application name |
| %p | Process ID (PID) |
| %P | Process name |
| %t | Time stamp |
| %d | Database name |
| %u | User name |
| %l | Log line number for each process |
| %% | '%' character |
This parameter can be changed by reloading the Pgpool-II configurations.


Prev
Next
Chapter 3. Data Import
Table of Contents
3.1. Importing Data with Mismatched IDs
3.2. Converting Databases to 64-Bit MonetDB


Reference/SystemCommands
System Commands
System commands control the q environment. They have the form:
\cmd [p]
for some command cmd, and optional parameter list p.
Commands with optional parameters that set values, will show the current values if the parameters are elided.
Some system commands have equivalent command line parameters.
The entry must begin with \. To call a system command in a q expression, use system, for example:
q)\l sp.q ... q)\a / tables in namespace `p`s`sp q)count \a / \ must be the first character '\ q)system "a" / same command called with system `p`s`sp q)count system "a" / this returns a result 3
\a [namespace] - tables
Lists tables in the given namespace, default current namespace.
q)\l sp.q ... q)\a / tables in default namespace `p`s`sp q)\a .o / tables in .o ,`TI
\b - views/dependencies
Lists all dependencies (views). See also .z.b. For example:
q)a::x+y q)b::x+1 q)\b `s#`a`b
\B - pending views/dependencies
Lists all pending dependencies (views), i.e. dependencies not yet referenced, or not referenced after their referents have changed.
q)a::x+1 / a depends on x q)\B / the dependency is pending ,`a q)x:10 q)\B / still pending after x is defined ,`a q)a / use a 11 q)\B / no longer pending `symbol$()
\c [h,w] - console height,width
Sets console height and width. This is the same as the -c command line parameter, see Console Size
\C [h,w] - http height,width
Sets the http height and width. This is the same as the -C command line parameter, see Console Size
\cd [name] - change directory
Changes the current directory.Directory will be created if it doesn't exist.
~/q$ q KDB+ 2.6 2010.05.10 Copyright (C) 1993-2010 Kx Systems .. q)\cd "/home/guest/q" q)\cd /home/guest/dev q)\cd "/home/guest/dev"
\d [namespace] - directory
Sets the current namespace (also known as directory or context). The namespace can be empty, and a new namespace is created when an object is defined in it. The prompt indicates the current namespace. For example:
q)\d / default namespace `. q)\d .o / change to .o q.o)\f `Cols`Columns`FG`Fkey`Gkey`Key`Special.. q.o)\d . / return to default q)key` / lists namespaces other than .z `q`Q`o`h q)\d .s / change to non-existent namespace q.s)key` / not yet created `q`Q`o`h q.s)a:1 / create object, also creates namespace q.s)key` `q`Q`o`h`s
\e [0|1] - error trap clients
This enables error trapping for client requests. The default is 0 (off).
When a client request has an error, by default the server clears the stack. This is appropriate for production use as it enables the server to continue processing other client requests.
For development, you can set \e 1 to enable debugging on the server. In this case, the server suspends on an error, and does not process other requests until the stack is cleared.
\f [namespace] - functions
Lists functions in the given namespace, default current namespace.
q)f:g:h:{x+2*y} q)\f `f`g`h q)\f .q `aj`aj0`all`and`any`asc`asof`attr`avgs`ceiling`cols..
\g [mode] - garbage collection mode
Since 2.7 2011.02.04.  See also -g.
\l name - load file or directory
The parameter can be a script filename or a directory. A script is loaded, and a directory database is opened. If the directory is specified as '.', any scripts in that directory will be ignored; this is to allow (re)loading of data only.
q)\l sp.q / load sp.q script ... q)\a / tables defined in sp.q `p`s`sp q)\l db/tickdata / load the data found in db/tickdata q)\a / with tables quote and trade `p`quote`s`sp`trade
\o [n] - offset from GMT
Sets the local time offset, as hours from GMT, or as minutes if abs[n]>23. Initially, the value is 0N, meaning that the machine's offset is used.
q)\o 0N q).z.p / GMT 2010.05.31D23:45:52.086467000 q).z.P / local time is GMT + 8 2010.06.01D07:45:53.830469000 q)\o -5 / set local time as GMT - 5 q).z.P 2010.05.31D18:45:58.470468000 q)\o 390 / set local time as GMT + 6:30 q).z.P 2010.06.01D06:16:06.603981000
This corresponds to the -o command line parameter.
\p [i] - port
Sets the listening port number. The default is 0 (no listening port). The port must be available and the process must have permission for the port.
A negative parameter sets a multi-threaded port and if used it must be the initial and only mode of operation, i.e. do not dynamically switch between positive port and negative port.
A parameter of 0W means pick a random available port within the range 32768 - 60999
q)\p 5010 / set port 5010 q)\p 5010 q)\p 0W / pick a random available port within the range 32768 - 60999 q)\p 45512 q)\p 0 / turn off listening port
This corresponds to the -p command line parameter.
\P [n] - precision
Sets display precision for floating point numbers, i.e. the number of digits shown, see Display Precision.
\r - replication master
This should not be executed manually otherwise it can disrupt replication. It is executed automatically by the replicating process on the master process, and returns the log file name and log file count (see Command Line Reference).
\r src dst - rename
This renames file src to dst. It is equivalent to the unix mv command, or the windows move command (except that it will not rename to a different disk drive).
\s - number of slaves
This queries the number of slaves, set with the -s command line parameter (query only).
\S [n] - random seed
Sets the random number seed. The parameter is a non-zero integer. Note that \S is not updated as the random number generator is used.
q)\S / default -314159 q)5?10 8 1 9 5 4 q)5?10 6 6 1 8 5 q)\S -314159 / restore default seed q)5?10 / same random numbers generated 8 1 9 5 4 q)\S / seed is not updated -314159
n.b. since kdb+v3.1 2013.08.19 the behaviour is as follows
rng is thread local. \S 1234 sets the seed for the rng for the main thread only. the rng in a slave thread is assigned a seed based on the slave thread number. in multithreaded input mode, the seed is based on socket descriptor. instances started on ports 20000 thru 20099 (slave procs, used with e.g. q -s -4) have the main thread's default seed based on the port number.
\t [p] - timer
This command has two different uses depending on the parameter given.
An integer parameter is the number of milliseconds between timer ticks. If 0, the timer is turned off, otherwise the timer is turned on and the first tick given. On each tick, the function assigned to .z.ts is executed.
q)\t / default off 0 q).z.ts:{show`second$.z.N} q)\t 1000 / tick each second q)13:12:52 13:12:53 13:12:54 \t 0 / turn off
A parameter of a q expression other than a single integer is executed and the execution time shown in milliseconds.
q)\t log til 100000 / milliseconds for log of first 100000 numbers 7 q)\t do[100;log til 100000] / timing for 100 repetitions 638
The tick timer usage corresponds to the -t command line parameter.
\ts exp - time and space
Executes the expression and shows the execution time in milliseconds and the space used in bytes.
q)\ts log til 100000 7 2621568j
\T [n] - timeout
This sets the client execution timeout, as the integer number of seconds a client call will execute before timing out, default 0 (no timeout). Note that this is in seconds, not milliseconds like \t.
This corresponds to the -T command line parameter.
\u - reload user password file
When q is invoked with the -u parameter specifying a user password file, then \u will reload the password file. This allows updates to the password file while the server is running.
\v [namespace] - variables
Lists the variables in the given namespace, default current namespace.
q)a:1+b:2 q)\v `a`b q)\v .o `B0`C0`PS`T`T0`TI`t
\w [0] - workspace
If there is no parameter, lists current memory usage, as a list of 6 long integers:
- [0] number of bytes allocated
- [1] bytes available in heap
- [2] maximum heap size so far
- [3] maximum bytes available, given in -w command line parameter
- [4] mapped bytes
- [5] physical memory
If there is a parameter, returns a pair:
- [0] number of internalized symbols
- [1] corresponding memory usage
q)\w<PHONE_NUMBER>8864 67108864 0 0<PHONE_NUMBER>j q)\w 0 577 25436j
The function .Q.w formats all this information:
q).Q.w[] used| 168304 heap| 67108864 peak| 67108864 wmax| 0 mmap| 0 mphy|<PHONE_NUMBER> syms| 577 symw| 25436
\W [n] - week offset
Specifies the start of week offset, where 0 is Saturday. The default is 2 = Monday.
This corresponds to the -W command line parameter.
\x .z.p* - expunge
By default, callbacks like .z.po are not defined in the session. After they have been assigned, you can restore the default using \x to delete the definition that was made.
q).z.pi / default has no user defined function '.z.pi q).z.pi:{">",.Q.s value x} / assign function q)2+3 >5 q)\x .z.pi / restore default
N.B. This works only for .z.p* variables defined in k before q.k is loaded. e.g. as .z.ph is defined in q.k, there is no default for it to be reset to.
\z [0|1] - date parsing
Specifies the format for date parsing. 0 is "mm/dd/yyyy" and 1 is "dd/mm/yyyy".
q)\z 0 q)"D"$"06/01/2010" 2010.06.01 q)\z 1 q)"D"$"06/01/2010" 2010.01.06
\1 & \2 filename - redirect
\1 and \2 allow redirecting stdout and stderr to files from within the q session. The files and intermediate directories are created if necessary.
~/q$ rm -f t1.txt t2.txt ~/q$ l64/q KDB+ 2.6 2010.05.10 Copyright (C) 1993-2010 Kx Systems ... q)\1 t1.txt / stdout q)\2 t2.txt / stderr til 10 2 + "hello" \\ ~/q$ cat t1.txt / entry in stdout 0 1 2 3 4 5 6 7 8 9 ~/q$ cat t2.txt / entry in stderr q)q)'type
\_ [scriptname] - hide q code
This command has two different uses depending on whether a parameter is given.
If no parameter, then \_ checks if client write access is blocked, see -b.
If a parameter is given, it should be a scriptname and \_ f.q makes a runtime script f.q_. The q code cannot be viewed or serialized.
~/q$ echo "a:123;f:{x+2*y}" > t1.q ~/q$ l64/q KDB+ 2.6 2010.05.10 Copyright (C) 1993-2010 Kx Systems .. q)\_ t1.q / create locked script `t1.q_ q)\l t1.q_ / can be loaded as usual q)a / definitions are correct 123 q)f[10;1 2 3] 12 14 16 q)f / q code cannot be displayed locked q)-8!f / or serialized 'type q)read1`:t1.q_ / file contents are scrambled 0x27fc45d98727b2ed0a530c25881733a5
\ - terminate
If there is a suspension, this exits one level of the suspension. Otherwise, it toggles between q and k mode. (To switch languages from inside a suspension, type "\ ".)
q){1+x}"hello" {1+x} 'type + 1 "hello" q))\ / clear suspension (only one level) q)\ / toggle to k mode !5 0 1 2 3 4 \ / toggle to q mode q)
\\ - exit
Exit from q.
OS Commands
If an expression begins with \ but is not recognized as a system command, then it is executed as an OS command.
For example:
- - this means that typos can get passed to the OS.
q)\ls / usual ls command "help.q" "k4.lic" "l64" "odbc.k" "profile.q" "q.k" ..


Extra parameters to pass to Kiuwan Local Analyzer, separated by spaces. Allowed format is as follows:
key1="value1" key2="value2" ... keyN="valueN"
Do not forget to include the double quotes in the beginning and ending of the parameter value, and to separate each parameter with spaces.


Losses
The Bobcats had six athletes graduate: Emily Walsh, Maggie Nedoma, Dahlias Bouyer, Ashton Webb, Ila Angermeier and Virginia Natale.
In 2021, Nedoma made first team All-Mid-American Conference and had the second most kills on the team. Nedoma played for the Bobcats for three years and made first team All-MAC twice.
In addition to the graduating seniors, Ohio will be without former Assistant Coach Rodnei Santos. Santos was with the Bobcats for five seasons.
Additions
Ohio will have a few newcomers for the upcoming season on the roster and the coaching staff. The Bobcats recruited setter Chariti Winzeler and middle hitter Leah Rogers for the upcoming season. The Bobcats also brought in a transfer, fifth-year senior Kristy Frank.
Frank played at a couple of colleges in her first four years, including Wiley College and most recently Utah State. At Utah State, Frank made the All-Mountain West team in 2021 and finished with the third-most kills on the team. Frank will immediately be able to make a difference for the Bobcats on the outside hitter position.
Coaching-wise, the Bobcats added two assistant coaches to the staff, Kenzie Crawford and Andrew Kroger.
Kroger has a plethora of coaching experience at the Division I level, including stops at La Salle from 2014-2021, when La Salle dropped its volleyball program. Kroger was the interim head coach at North Alabama for the 2021 season.
Crawford played at Creighton in college and coached as a graduate assistant at Nebraska-Kearney for two years. Then, Crawford got her first opportunity as an assistant at Army West Point. Crawford helped coach Army to the NCAA Tournament after winning the Patriot League.