text:
# Identity Matrix and Inverse Matrix

Sharing is caring

We introduce the inverse matrix and the identity matrix. In addition, we learn how to solve systems of linear equations using the inverse matrix.

The identity matrix is a matrix in which the diagonal entries are 1, and all other entries are zero. It is a more restrictive form of the diagonal matrix.

I =   \begin{bmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1 \\

\end{bmatrix}

It is the matrix equivalent to 1 for real numbers. This means multiplying a matrix A by the identity matrix produces A.

A I = A

As long as the dimensions match, you could also write this as

IA = A

For example:

  \begin{bmatrix}
1 & 0 \\
0 & 1  \\

\end{bmatrix}

\begin{bmatrix}
1 & 3  \\
2 & 4  \\

\end{bmatrix}

=
\begin{bmatrix}
1 & 3  \\
2 & 4  \\

\end{bmatrix}

\begin{bmatrix}
1 & 0 \\
0 & 1  \\

\end{bmatrix}
=
\begin{bmatrix}
1 & 3  \\
2 & 4  \\

\end{bmatrix}

## Inverse Matrix

The inverse matrix is closely related to the identity matrix. Multiplying a matrix by its inverse always yields the identity matrix.

AA^{-1} = I

For example:

  \begin{bmatrix}
3 & 2  \\
4 & 3  \\

\end{bmatrix}

\begin{bmatrix}
3 & -2  \\
-4 & 3  \\

\end{bmatrix}

=
\begin{bmatrix}
1 & 0  \\
0 & 1  \\

\end{bmatrix}

Note that not every matrix has an identity matrix.

### Solving Linear Systems with the Inverse Matrix

We’ve established that a linear system of equations can be represented as a matrix of coefficients A multiplied by a vector b of your unknown variables, to give you the vector of results c.

Ab = c

Using Gaussian elimination we can determine the values of b. But this only gives you a solution for a specific value of c. If c changes, you’d have to do the whole process of Gaussian elimination all over again.

Imagine you have a car production plant for trucks and cars and your production target is 10 trucks and 8 cars.
You need 1 unit of materialA and 3 units of materialB to produce a certain amount of trucks and 1 unit of materialA and 2 units of materialB to produce cars.

Assume also that the production lines are interdependent. For example changes in the production of cars could affect units of materials required for truck production because trucks make us of preprocessed materials from the car production line, etc.

You could model this with our Ab = c  format and figure out the solution using Gaussian elimination:

  \begin{bmatrix}
1 & 3 \\
1 & 2 \\
\end{bmatrix}

\begin{bmatrix}
materialsA \\
materialsB \\
\end{bmatrix}
=

\begin{bmatrix}
10 \\
8 \\
\end{bmatrix}

With Gaussian elimination the solution is materialsA = 4 and materialsB = 2.

Your production targets are likely to change. For this small example it is not a big deal. But in the real world you rarely deal with such small examples. In data science and machine learning you often have millions of dimensions in your vectors and matrices.

Applying Gauss Jordan elimination across all these dimensions for every change is highly inefficient.

Luckily, this can be avoided with the help of the identity matrix and the inverse matrix.

Starting from your original form

If our production targets c change, now all we have to do is multiply the new c with the inverse of A to get to our new b values.

We can now apply Gauss Jordan elimination to find the identity of a matrix.

AA^{-1} = I

Unfortunately we cannot divide by matrices, so we cannot say

\color{red}
A^{-1} = \frac{I}{A} \, = wrong!

But what we can do instead is turn A into I by Gaussian elimination. Then we have IA^{-1} on the left side, which is equivalent to A^{-1}, and our solution remains on the right.

Let’s plug this into our car production plant example (we used the same coefficient matrix A).

We concluded that for

  \begin{bmatrix}
1 & 3 \\
1 & 2 \\
\end{bmatrix}

\begin{bmatrix}
materiala \\
materialb \\
\end{bmatrix}
=

\begin{bmatrix}
10 \\
8 \\
\end{bmatrix}

Let’s multiply our result vector c with the inverse matrix of A to get b. It should give us the same result

  \begin{bmatrix}
10 \\
8 \\
\end{bmatrix}

\begin{bmatrix}
-2 & 3 \\
1 & -1 \\
\end{bmatrix}

=
\begin{bmatrix}
materialsA \\
materialsB \\
\end{bmatrix}
=
\begin{bmatrix}
4 \\
2 \\
\end{bmatrix}

Indeed, it does give us the expected result.

This post is part of a series on linear algebra for machine learning. To read other posts in this series, go to the index.

Sharing is caring

format: plain


text:
# [SOLVED]Can you control LEDs using Visual Basic.

Status
Not open for further replies.

#### ankitvirdi4

##### Member level 4
Hey guys,
I am working on a project using Visual Basic( Ver. 2010 Express) which basically displays and controls the status of a few devices. There are 5 devices in all, I want to represent a device with a LED.

So, basically I just want to control 5 LEDs using VB. I know it possible using the serial port. I guess there are two ways in which we can do this.

1. Using UART of a microcontroller (I am bad at UART programming)

2. Making a serial to parallel converter and controlling the LEDs directly.

I have a few questions about the 2nd method.
Is that possible?
Which IC do I use in it?
What about the baud rate, will it affect the LEDs?
Has anyone done this before?

##### Member level 2
Yes,it's possible.
buy usb parallel converter and if your pc has a parallel port it will be much easier
baud rate will not be a problem if you have in your design a hold bit control
.just tell me if you have a parallel port or not
if not check at any computer store if they have a usb multi connection(parallel serial vga) if not all of these then build a usb to parallel or serial to parallel ,plz send feed back to help you more

#### ankitvirdi4

##### Member level 4
I am working on my laptop which has just serial ports (USBs). Can you provide the circuit diagram for a USB to parallel conversion?

And by hold bit control what do you mean? should that be in my VB code or in the circuit?

##### Member level 2
software in C included you can customize it for any microchip controller
www.mikro.com

Code C - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Project name:
Uart1_Test (Usage of mikroC for dsPIC30/33 and PIC24 UART libraries)
* Target Platform:
dsPIC;
(c) mikroElektronika, 2006.
* Revision History:
20060510:
- Initial release;
* Description:
This simple example demonstrates usage of mikroC's UARTx libraries, through
a 'loopback' interface. The data being sent to dsPIC through UART
and sent back.
* Test configuration:
MCU:             dsPIC30F4013
Dev.Board:       EASYdsPIC4
Oscillator:      XT-PLL4, 10.000MHz
Ext. Modules:    None.
SW:              mikroC for dsPIC30/33 and PIC24 v4.0.0.0
* NOTES:
- You can use the same example for UART2 module, just change the '1's in
library function names to '2', e.g. Uart1_Init() -> Uart2_Init();
*/

unsigned rx1;

void main() {
//--- turn off A/D inputs
LATB = 0;
TRISB = 0;
LATC = 0;
TRISC = 0;
LATD = 0;
TRISD = 0;
LATF = 0xFFFF;
TRISF = 0;

Uart1_Init(9600);                 // initialize USART module

//--- un-comment the following lines to have Rx and Tx pins on their alternate
//    locations. This is used to free the pins for other module, namely the SPI.
U1MODEbits.ALTIO = 1;
Delay_ms(10);                     // pause for usart lines stabilization

Uart1_Write_Char('s');            // signal start

while(1) {
if (Uart1_Data_Ready())  {     // check if there is data in the buffer
Uart1_Write_Char(rx1);           // send data back
if (rx1='R') {
LATB = 1;
Delay_ms(1000);
}
if (rx1='r') {
LATB = 0;
Delay_ms(1000);
}
if (rx1='R') {
}
}
}
}//~!

Last edited by a moderator:

Status
Not open for further replies.


text:
# Does LaTeX have a built-in scripting language?

Say I want to draw a simple graph in LaTeX.

I'm interested to know if you can write a for loop or something to create things like lines or squares programmatically in LaTeX.

-

TikZ is a powerful graphic package. It's a front end for the pgf package and can be used for programming drawings such as graphs. for loops a easy with TikZ.

Have a look at

If you would like to program more in general, you may consider to use LuaTeX, which allows using Lua as scripting language.

-

You can can also use the bundle pstricks:

\documentclass{article}
\begin{document}
\begin{pspicture}(5,5)
\psaxes{->}(0,0)(0,-5)(5,5)
\multido{\iA=-3+1}{7}{%
\psplot[algebraic,linecolor=red,yMaxValue=4]{0}{4}{\iA*x}
}
\end{pspicture}
\end{document}

-

LaTeX running on top of TeX or pdfTeX or XeTeX is a Turing complete programming language, but you are probably more interested in LuaLaTeX, as that offers Lua, a "modern" scripting language.

-

In fact TeX is itself a kind of scripting language (and it is a Turing complete programming language cf. Wikipedia article). There are packages that wraps in a neat way bare-bones TeX to supply basic imperative constructs like loops and conditionals: forloop, ifthen (concerning the later see also this discussion). I used to use these packages, one example of mine could be found in this directory, basically it includes bodies of CardBodyN.tex many times in for-loop, the loop itself is located in the document.tex, you're welcome to ask further questions…).

-


text:
# python 查看某个对象的用法

help(该对象)
eg:

import numpy as np
print(help(np.random.normal))

Help on built-in function normal:

normal(...) method of numpy.random.mtrand.RandomState instance
normal(loc=0.0, scale=1.0, size=None)

Draw random samples from a normal (Gaussian) distribution.

The probability density function of the normal distribution, first
derived by De Moivre and 200 years later by both Gauss and Laplace
independently [2]_, is often called the bell curve because of
its characteristic shape (see the example below).

The normal distributions occurs often in nature.  For example, it
describes the commonly occurring distribution of samples influenced
by a large number of tiny, random disturbances, each with its own
unique distribution [2]_.

.. note::
New code should use the normal method of a default_rng()
instance instead; see random-quick-start.

Parameters
----------
loc : float or array_like of floats
Mean ("centre") of the distribution.
scale : float or array_like of floats
Standard deviation (spread or "width") of the distribution. Must be
non-negative.
size : int or tuple of ints, optional
Output shape.  If the given shape is, e.g., (m, n, k), then
m * n * k samples are drawn.  If size is None (default),
a single value is returned if loc and scale are both scalars.
Otherwise, np.broadcast(loc, scale).size samples are drawn.

Returns
-------
out : ndarray or scalar
Drawn samples from the parameterized normal distribution.

--------
scipy.stats.norm : probability density function, distribution or
cumulative density function, etc.
Generator.normal: which should be used for new code.

Notes
-----
The probability density for the Gaussian distribution is

.. math:: p(x) = \frac{1}{\sqrt{ 2 \pi \sigma^2 }}
e^{ - \frac{ (x - \mu)^2 } {2 \sigma^2} },

where :math:\mu is the mean and :math:\sigma the standard
deviation. The square of the standard deviation, :math:\sigma^2,
is called the variance.

The function has its peak at the mean, and its "spread" increases with
the standard deviation (the function reaches 0.607 times its maximum at
:math:x + \sigma and :math:x - \sigma [2]_).  This implies that
normal is more likely to return samples lying close to the mean, rather
than those far away.

References
----------
.. [1] Wikipedia, "Normal distribution",
https://en.wikipedia.org/wiki/Normal_distribution
.. [2] P. R. Peebles Jr., "Central Limit Theorem" in "Probability,
Random Variables and Random Signal Principles", 4th ed., 2001,
pp. 51, 51, 125.

Examples
--------
Draw samples from the distribution:

>>> mu, sigma = 0, 0.1 # mean and standard deviation
>>> s = np.random.normal(mu, sigma, 1000)

Verify the mean and the variance:

>>> abs(mu - np.mean(s))
0.0  # may vary

>>> abs(sigma - np.std(s, ddof=1))
0.1  # may vary

Display the histogram of the samples, along with
the probability density function:

>>> import matplotlib.pyplot as plt
>>> count, bins, ignored = plt.hist(s, 30, density=True)
>>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
...                np.exp( - (bins - mu)**2 / (2 * sigma**2) ),
...          linewidth=2, color='r')
>>> plt.show()

Two-by-four array of samples from N(3, 6.25):

>>> np.random.normal(3, 2.5, size=(2, 4))
array([[-4.49401501,  4.00950034, -1.81814867,  7.29718677],   # random
[ 0.39924804,  4.68456316,  4.99394529,  4.84057254]])  # random

None

Process finished with exit code 0

04-12 2967

09-13 4831
01-09 2650
02-03 3155
04-08 9097
07-19 1万+
05-24 1万+
06-19 211
10-20 74
11-19 1万+
08-04 5467
06-23 150
06-01 1万+
05-23 6471


text:
# Change of Equilibrium price and quantity with Supply and Demand

In this article, Using demand and supply curves, we will diagrammatically demonstrate what happens to the equilibrium price and quantity when:
1. An increase in demand that is greater than the increase in supply?
2. Demand falls and supply is constant

What is Supply in Economics?

Supply in economics is defined as the total amount of a given product or service a supplier offers to consumers at a given period and a given price level. It is usually determined by market movement. For instance, a higher demand may push a supplier to increase supply.

$ads={1} What is Demand? Demand is the quantity of consumers who are willing and able to buy products at various prices during a given period of time. Demand for any commodity implies the consumers' desire to acquire the good, the willingness and ability to pay for it. What is Equilibrium Price? The equilibrium price is the price at which the quantity demanded equals the quantity supplied. It is determined by the intersection of the demand and supply curves. A surplus exists if the quantity of a good or service supplied exceeds the quantity demanded at the current price; it causes downward pressure on price. A shortage exists if the quantity of a good or service demanded exceeds the quantity supplied at the current price; it causes upward pressure on price. What is equilibrium quantity? Equilibrium quantity is when there is no shortage or surplus of a product in the market. Supply and demand intersect, meaning the amount of an item that consumers want to buy is equal to the amount being supplied by its producers. To determine what happens to equilibrium price and equilibrium quantity when both the supply and demand curves shift, you must know in which direction each of the curves shifts and the extent to which each curve shifts.$ads={2}

When increase in demand is greater than increase in supply-

In the above diagram, D and S are the initial demand and supply curves respectively. E is the initial equilibrium point, P is the initial equilibrium price and Q is the initial equilibrium quantity. An increase in demand will shift the Demand curve to right from D to D2. An increase in supply will shift the supply curve to right from S to S2. As increase in demand is greater than increase in supply, Demand curve D2 will shift by greater distance than Supply curve S2 . From the given figure we can see that when increase in demand is greater than increase in supply, equilibrium price will rise and Equilibrium quantity will also increase. An increase in demand causes the a upward pressure on the price and an increase in Supply causes a downward pressure on the price. As increase in demand is more than increase in Supply, upward pressure on the price is more than downward pressure and hence, equilibrium price rises. As both Supply and demand has increased, equilibrium quantity will increase. In the above diagram, M is the new equilibrium point where new demand and supply curves intersect. We can see that as a result of increase in demand and supply, equilibrium price will increase to P2 and Equilibrium quantity will increase to Q2. Hence, when increase in demand is greater than increase in Supply, equilibrium price increases and Equilibrium quantity will also increase.

When Demand falls and Supply is constant-

In the above diagram, D and S are the initial demand and supply curves respectively. E is the initial equilibrium point, P is the initial equilibrium price and Q is the initial equilibrium quantity. As Demand will fall , demand curve will shift to the left from D to D1 . Supply curve S will remain the same. At the same Equilibrium price, a decrease in demand with Supply remaining the same, a surplus will occur in the market. Buyers seeing the unsold stock of goods will ask for lower price and suppliers, on the other hand, may start offering lower price to sell the unsold stock. In both the cases, a downward pressure is created on the price and hence, equilibrium price will fall. A fall in price will reduce the quantity supplied by suppliers. As demand has reduced has quantity Supplied has also reduced, equilibrium quantity will decrease. In the above diagram, A is the new equilibrium point. Equilibrium price has reduced to P1 and equilibrium quantity has also reduced to Q1. Hence, when Demand falls and Supply remains the same, both equilibrium price and Equilibrium quantity will decrease.


text:
# Process text file of fulltext articles from news publications

I'm relatively new to programming and have started writing some code for work. This script is something I wrote that I'd like to have someone comment on. Am I doing anything silly, stupid or totally unnecessary? Am I making things more complicated than they need to be? This script takes a plain text file downloaded from a publication database (example file below) and processes it to create a csv of the metadata from all the articles and a separate text file for the full text of each article.

from sys import argv
import time
import csv

timestamp = time.strftime('%H%M-%Y%m%d')

class Article(object):
fulltxt = ""
Title = ""
Publication = ""
Date = ""
Year = ""
Author = ""
PQID = ""

fields = ['ID', 'Title', 'Author', 'Publication', 'Date', 'Year']
csvFile = open(csvName, 'wb')
csvwriter = csv.DictWriter(csvFile, delimiter=',', fieldnames=fields)
csvwriter.writerow(dict((fn, fn) for fn in fields))

def abbreviate(pub):
#a publication abbreviation is included in the filename of the textfile
pubs = {
'USA TODAY (pre-1997 Fulltext)' : 'USAT',
'USA TODAY' : 'USAT',
'New York Times' : 'NYT',
'Wall Street Journal' : 'WSJ'
}
return pubs.get(pub, "X")

#write the field values of the current doc to the csv file
if doc.fulltxt != "":
writefields = dict((field, getattr(doc, field)) for field in vars(doc) if not field.startswith('__') and field != 'fulltxt')
csvwriter.writerow(writefields)

def writeArticle(doc):
name = abbreviate(doc.Publication)+'_'+doc.Year+'_'+doc.PQID+'.txt'
txtFile = open(name, 'a')
txtFile.write(doc.Title)
txtFile.write(doc.fulltxt)
txtFile.close()

script, filename = argv
docs = open(filename)

for line in docs:
line = line.strip()
if line == '____________________________________________________________':
#write out the previous doc
try: doc
except NameError: doc = None
else:
writeArticle(doc)
#start new doc
doc = Article()
continue
if line.startswith("Full text:"):
doc.fulltxt = line[10:]
continue
if line.startswith("Illustration") or line == "" :
continue
else:
doc.fulltxt = doc.fulltxt + "\n" +line
elif line.startswith("Title:"):
doc.Title = line[6:]
elif line.startswith("Publication title:"):
doc.Publication = line[19:]
elif line.startswith("Author:"):
doc.Author = line[8:]
elif line.startswith("Publication date:"):
doc.Date = line[18:]
elif line.startswith("ProQuest document ID:"):
doc.PQID = line[22:]
elif line.startswith("Publication year:"):
doc.Year = line[18:]
elif not line or line.isspace() :
continue
else:
continue

csvFile.close()
docs.close()

example text file:

____________________________________________________________

Report Information from ProQuest
August 21 2015 10:55
____________________________________________________________

____________________________________________________________

1. Obama plan: 'Pitiful' or 'compelling'?

2. Feeling bullied at school? Call Charlie's angel

3. Clinton proposes setting national standards for schools

4. A NATION'S HUNGER FOR THE TRUTH Irish confront legacy of the potato famine

5. Minnesota's muscle drawing stronger praise Foes intimidated by No. 11 Gophers

____________________________________________________________

Document 1 of 5

Obama plan: 'Pitiful' or 'compelling'?

Author: Anonymous

http://search.proquest.com/docview/862079852?accountid=7379

Abstract: The New York Times, in an editorial: (Obama) used his budget speech to clearly distance himself from Republican plans to heap tax benefits on the rich while casting adrift the nation's poor, elderly and unemployed. Karl Rove, former adviser to President Bush, in The Wall Street Journal: The goal Obama laid out -- 'a balanced approach to achieve \$4 trillion in deficit reduction over 12 years' -- was missing but one thing: a concrete blueprint. ...

Full text: On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
Illustration PHOTO, B/W, Carolyn Kaster, AP; Caption:

Subject: Studies; Tax increases; Fiscal policy; Government spending; Federal budget; Editorials

Location: United States--US

People: Obama, Barack

Title: Obama plan: 'Pitiful' or 'compelling'?

Publication title: USA TODAY

Pages: A.9

Publication year: 2011

Publication date: Apr 15, 2011

Year: 2011

Section: NEWS

Publisher: USA Today, a division of Gannett Satellite Information Network, Inc.

Place of publication: McLean, Va.

Country of publication: United States

Publication subject: General Interest Periodicals--United States

ISSN: 07347456

Source type: Newspapers

Language of publication: English

Document type: Feature

ProQuest document ID: 862079852

Document URL: http://search.proquest.com/docview/862079852?accountid=7379

Last updated: 2011-05-04

Database: National Newspapers Expanded

____________________________________________________________

Document 2 of 5

Feeling bullied at school? Call Charlie's angel

Author: Parker, Kathleen

http://search.proquest.com/docview/306803544?accountid=7379

Abstract: Some days nothing goes right. I was feeling particularly homicidal recently following a full day of rude encounters with my fellow woman. In one instance, a teen driver dodged in front of me, snatching the last parking space at the grocery store. In another, an elaborately coifed woman leaned on her horn as I waited for oncoming traffic to permit a sane left turn. And in yet another, get this, a woman butted in line in the emergency room (!) where I'd taken by kid for stitches on his split chin. "Attorney General Condon's No Bully Line," said an angel's voice with a perfect blend of authority and compassion. I began to tell her about my urgent need to kill mean people when she asked me the name of my school. School? I'm a grown-up, a parent. I don't go to school; I go to grocery stores! Now about these bullies. She stopped me, sweetly. The bully hot line, she explained, was for playground bullies, not horn-blowers and line-butters. Attorney General Charles "Charlie" Condon, weary of crime statistics, apparently had decided to take the bullies by the horn. Well, why not? when the president of the United States cares (deeply) about women recovering from labor and delivery, why shouldn't an attorney general sift the sandbox?

Full text: Not available.

Title: Feeling bullied at school? Call Charlie's angel

Publication title: USA TODAY (pre-1997 Fulltext)

Pages: 11.A

Number of pages: 0

Publication year: 1997

Publication date: Feb 12, 1997

Year: 1997

Section: NEWS

Publisher: USA Today, a division of Gannett Satellite Information Network, Inc.

Place of publication: McLean, Va.

Country of publication: United States

Publication subject: General Interest Periodicals--United States

ISSN: 07347456

Source type: Newspapers

Language of publication: English

Document type: NEWSPAPER

ProQuest document ID: 306803544

Document URL: http://search.proquest.com/docview/306803544?accountid=7379

Last updated: 2010-08-27

Database: National Newspapers Expanded

____________________________________________________________

Document 3 of 5

Clinton proposes setting national standards for schools

Author: Kelly, Dennis

http://search.proquest.com/docview/306802529?accountid=7379

Abstract: The national tests that President Clinton proposed Tuesday night would give states and local school districts a new yardstick to see how their students stack up against the rest of the country and the world. Clinton is proposing that states adopt newly developed, voluntary national tests for fourth-graders in reading and for eighth-graders in math. The tests would be administered begining in 1999. The reading test would be based on the National Assessment of Educational Progress (NAEP), a federal project that has used a random sample of U.S. students to gauge skills in math, reading and other subjects for 27 years.

Full text: On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
Illustration

Title: Clinton proposes setting national standards for schools:   [FINAL Edition]

Publication title: USA TODAY (pre-1997 Fulltext)

Pages: 03.A

Number of pages: 0

Publication year: 1997

Publication date: Feb 5, 1997

Year: 1997

Section: NEWS

Publisher: USA Today, a division of Gannett Satellite Information Network, Inc.

Place of publication: McLean, Va.

Country of publication: United States

Publication subject: General Interest Periodicals--United States

ISSN: 07347456

Source type: Newspapers

Language of publication: English

Document type: NEWSPAPER

ProQuest document ID: 306802529

Document URL: http://search.proquest.com/docview/306802529?accountid=7379

Last updated: 2010-08-20

Database: National Newspapers Expanded

____________________________________________________________

Document 4 of 5

A NATION'S HUNGER FOR THE TRUTH Irish confront legacy of the potato famine

Author: Lynch, David J

http://search.proquest.com/docview/306802422?accountid=7379

Abstract: LONGFORD, Ireland -- For years, the hilltop cemetery known as Bully's Acre was a debris-strewn ruin. Windswept weeds grew waist high. Dead dogs and empty beer kegs littered the ground. But that was before Sister Calasanctius Duffy came along and before Ireland decided to confront one of the most painful episodes in its long, anguished history: the 1845-1847 famine that killed or forced into exile one-quarter of its 8 million residents. This year, 60,000 people, up one-third from 1996, are expected to visit the Famine Museum in Strokestown, where the tragedy's grim statistics are detailed in words and pictures. Sites like Bully's Acre are being rehabilitated. New research is under way by scholars, with more than 50 books on the famine published since 1994.

Full text: On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
Illustration PHOTOS, Color,Eileen Blass,USA TODAY (3)

Title: A NATION'S HUNGER FOR THE TRUTH Irish confront legacy of the potato famine:   [FINAL Edition]

Publication title: USA TODAY (pre-1997 Fulltext)

Pages: 01.D

Number of pages: 0

Publication year: 1997

Publication date: Jan 15, 1997

Year: 1997

Section: LIFE

Publisher: USA Today, a division of Gannett Satellite Information Network, Inc.

Place of publication: McLean, Va.

Country of publication: United States

Publication subject: General Interest Periodicals--United States

ISSN: 07347456

Source type: Newspapers

Language of publication: English

Document type: COVER STORY

ProQuest document ID: 306802422

Document URL: http://search.proquest.com/docview/306802422?accountid=7379

Last updated: 2010-07-30

Database: National Newspapers Expanded

____________________________________________________________

Document 5 of 5

Minnesota's muscle drawing stronger praise Foes intimidated by No. 11 Gophers

Author: Blauvelt, Harry

http://search.proquest.com/docview/306790419?accountid=7379

Abstract: Make room for brawny Minnesota, the newest bully on the Big Ten basketball block. The No. 11 Golden Gophers (13-1) haven't broken from the starting gate this quickly since 1976-77, when Kevin McHale, Mychal Thompson and Flip Saunders triggered a 16-1 run. In a conference known for its muscle, Minnesota can mix it up with anyone. Center John Thomas, 6-9, 275, a tight end in high school who squats 600 pounds, and power forward Courtney James, 6-8, 275, punish opponents in the paint.

Full text: On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains
Illustration PHOTO, B/W, Dale Atkins, AP

Title: Minnesota's muscle drawing stronger praise Foes intimidated by No. 11 Gophers:   [FINAL Edition]

Publication title: USA TODAY (pre-1997 Fulltext)

Pages: 09.C

Number of pages: 0

Publication year: 1997

Publication date: Jan 8, 1997

Year: 1997

Section: SPORTS

Publisher: USA Today, a division of Gannett Satellite Information Network, Inc.

Place of publication: McLean, Va.

Country of publication: United States

Publication subject: General Interest Periodicals--United States

ISSN: 07347456

Source type: Newspapers

Language of publication: English

Document type: NEWSPAPER

ProQuest document ID: 306790419

Document URL: http://search.proquest.com/docview/306790419?accountid=7379

Last updated: 2010-08-21

Database: National Newspapers Expanded

____________________________________________________________

Terms and Conditions: http://search.proquest.com/info/termsAndConditions

Constants are CAPITALas a convention, so:

TIMESTAMP = time.strftime('%H%M-%Y%m%d')
CSV_NAME = 'Metadata_' + timestamp + '.csv' # <- added some spaces
FIELDS = ['ID', 'Title', 'Author', 'Publication', 'Date', 'Year']

elif line.startswith("Title:"):
doc.Title = line[6:]
elif line.startswith("Publication title:"):
doc.Publication = line[19:]
elif line.startswith("Author:"):
doc.Author = line[8:]
elif line.startswith("Publication date:"):
doc.Date = line[18:]
elif line.startswith("ProQuest document ID:"):
doc.PQID = line[22:]
elif line.startswith("Publication year:"):
doc.Year = line[18:]

^^ That was a real puzzler, I know understood that the slicing is there to avoid saving things like "ProQuest document ID:" or "Publication year:", I suggest just using split and [1], like this:

elif line.startswith("Publication year:"):
doc.Year = line.split("Publication year:")[1]

The same result of what you did but more intuitive

In fact you should use a loop:

for salient_part in ("Title", "Publication Title:" ...):
if line.startswith(salient_part):
doc[salient_part] = line.split(salient_part)[1]

^ The loop above may need other modifications to your code before working properly (not tested).

Possibly, you may stop using the

class Article(object):
fulltxt = ""
Title = ""
Publication = ""
Date = ""
Year = ""
Author = ""
ID = ""

And just go for a plain dict, that sure would make the loop simple to implement.

Use with

txtFile = open(name, 'a')
txtFile.write(Article.Title)
txtFile.write(Article.fulltxt)
txtFile.close()

Should become

with open(name, 'a') as f:
f.write(Article.Title)
f.write(Article.fulltxt)

As it automatically closes the file.

Boring == possibly wrong

if line == '____________________________________________________________':

^^ Counting that the above has the correct number of underscores is boring so I will not do it (which is the correct number anyway?) you should do

if line == '_' * NUMBER_OF_UNDERSCORES_NEEDED:

Why are you using fn as a name when writing your first row? I'm guessing it's fieldname, but I read it as short for function initially. You could just do name, because then it'd be

csvwriter.writerow(dict((name, name) for name in fields))

That reads well, name in fields implies that name refers to a fieldname. It's more helpful to think about what the user will read than about what name technically makes sense. You do this with other abbreviations too, like pub but you at least then comment with the full word so that it can be intuited.

You're writing comments for your functions which is good, but you should make them docstrings. That way they're programmatically accessible and parseable by users/programs. All you need to do is wrap the comment in triple quotes instead of using #. See here for more on docstrings.

def writeMetadata(doc):
"""Write the field values of the current doc to the csv file"""

I don't like this line either:

if line == '____________________________________________________________':

But I think there are better tests than even using '_' * num. You could just strip out underscores and see if there's any text left in line. That seems to satisfy the test based on your sample document.

if line.strip('_') == '':

Note that this is after doing .strip() anyway, so you wont get caught out by whitespace.

As a last note, you have some style quirks that are a bit off for Python. Variable and function names should be in snake_case, all operators should have consistent spacing around them, ideally one each (ie. var = 12 + (45 * 10)). You can read about this in more detail in the style guide, PEP0008. It's very helpful to make scripts cleaner and easier to read for yourself and others, well worth reading!


text:
# 2 Installation

## 2.1 Easy Installation

IQnca is an R package that can be installed with the R command install.packages() as follows:

install.packages("IQnca",
repos = c("https://iqnca.intiquan.com/rrepo", "https://cran.r-project.org/"),
dependencies = TRUE)


text:
# Revision history [back]

### heat-keystone-setup-domain returns authentication error

Setting up Kilo, following install guide as closely as possible. Now in Heat I get the below error setting up the domain.

I am a bit confused by the proved dist.conf file. It has got some confusing directives. I do not trust is completely. (eg. in the DEFAULT stanza it has got: sql_connection = mysql://heat:heat@localhost/heat).

Does anybody have a clue what is wrong here? Kris

[root@oscon01 heat]# heat-keystone-setup-domain --stack-user-domain-name heat_user_domain --stack-domain-admin heat_domain_admin --stack-domain-admin-password hello12 Traceback (most recent call last): File "/usr/bin/heat-keystone-setup-domain", line 156, in <module> main() File "/usr/bin/heat-keystone-setup-domain", line 107, in main c.authenticate() File "/usr/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner return func(*args, kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 503, in authenticate resp = self.get_raw_token_from_identity_service(kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/v3/client.py", line 287, in get_raw_token_from_identity_service _('Authorization failed: %s') % e) keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure You have new mail in /var/spool/mail/root [root@oscon01 heat]#

### heat-keystone-setup-domain returns authentication error

Setting up Kilo, following install guide as closely as possible. Now in Heat I get the below error setting up the domain.

I am a bit confused by the proved dist.conf file. It has got some confusing directives. I do not trust is it completely. (eg. in the DEFAULT stanza it has got: sql_connection = mysql://heat:heat@localhost/heat).

Does anybody have a clue what is wrong here? Kris

[root@oscon01 heat]# heat-keystone-setup-domain --stack-user-domain-name heat_user_domain --stack-domain-admin heat_domain_admin --stack-domain-admin-password hello12 Traceback (most recent call last): File "/usr/bin/heat-keystone-setup-domain", line 156, in <module> main() File "/usr/bin/heat-keystone-setup-domain", line 107, in main c.authenticate() File "/usr/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner return func(*args, kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 503, in authenticate resp = self.get_raw_token_from_identity_service(kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/v3/client.py", line 287, in get_raw_token_from_identity_service _('Authorization failed: %s') % e) keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure You have new mail in /var/spool/mail/root [root@oscon01 heat]#

### heat-keystone-setup-domain returns authentication error

Setting up Kilo, following install guide as closely as possible. Now in Heat I get the below error setting up the domain.

I am a bit confused by the proved provided dist.conf file. It has got some confusing directives. I do not trust it completely. (eg. in the DEFAULT stanza it has got: sql_connection = mysql://heat:heat@localhost/heat).

Does anybody have a clue what is wrong here? Kris

[root@oscon01 heat]# heat-keystone-setup-domain --stack-user-domain-name heat_user_domain --stack-domain-admin heat_domain_admin --stack-domain-admin-password hello12 Traceback (most recent call last): File "/usr/bin/heat-keystone-setup-domain", line 156, in <module> main() File "/usr/bin/heat-keystone-setup-domain", line 107, in main c.authenticate() File "/usr/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner return func(*args, kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 503, in authenticate resp = self.get_raw_token_from_identity_service(kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/v3/client.py", line 287, in get_raw_token_from_identity_service _('Authorization failed: %s') % e) keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure You have new mail in /var/spool/mail/root [root@oscon01 heat]#

### heat-keystone-setup-domain returns authentication error

Setting up Kilo, following install guide as closely as possible. Now in Heat I get the below error setting up the domain.

I am a bit confused by the provided dist.conf file. It has got some confusing directives. I do not trust it completely. (eg. in the DEFAULT stanza it has got: sql_connection = mysql://heat:heat@localhost/heat).

Does anybody have a clue what is wrong here? Kris

Traceback (most recent call last): last):

File "/usr/bin/heat-keystone-setup-domain", line 156, in <module> main() File "/usr/bin/heat-keystone-setup-domain", line 107, in main c.authenticate() File "/usr/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner return func(*args, kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 503, in authenticate resp = self.get_raw_token_from_identity_service(kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/v3/client.py", line 287, in get_raw_token_from_identity_service _('Authorization failed: %s') % e) keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure You have new mail in /var/spool/mail/root keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure

[root@oscon01 heat]#

### heat-keystone-setup-domain returns authentication error

Setting up Kilo, following install guide as closely as possible. Now in Heat I get the below error setting up the domain.

I am a bit confused by the provided dist.conf /usr/share/heat-dist.conf file. The CentOS instruction tells me to use this file.

It has got some confusing directives. I do not trust it completely. (eg. in the DEFAULT stanza it has got: sql_connection = mysql://heat:heat@localhost/heat).

Does anybody have a clue what is wrong here? Kris

Traceback (most recent call last):

File "/usr/bin/heat-keystone-setup-domain", line 156, in <module> main() File "/usr/bin/heat-keystone-setup-domain", line 107, in main c.authenticate() File "/usr/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner return func(*args, kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 503, in authenticate resp = self.get_raw_token_from_identity_service(kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/v3/client.py", line 287, in get_raw_token_from_identity_service _('Authorization failed: %s') % e) keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure

[root@oscon01 heat]#

### heat-keystone-setup-domain returns authentication errorerror (CentOS7)

Setting up Kilo, following install guide as closely as possible. Now in Heat I get the below error setting up the domain.

I am a bit confused by the provided /usr/share/heat-dist.conf file. The CentOS instruction tells me to use this file.file. And I copied it over the original /etc/heat/heat.conf.

It has got some confusing directives. I do not trust it completely. (eg. in the DEFAULT stanza it has got: sql_connection = mysql://heat:heat@localhost/heat). Different than the other modules.

Does anybody have a clue what is wrong here? Kris

Traceback (most recent call last):

File "/usr/bin/heat-keystone-setup-domain", line 156, in <module> main() File "/usr/bin/heat-keystone-setup-domain", line 107, in main c.authenticate() File "/usr/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner return func(*args, kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 503, in authenticate resp = self.get_raw_token_from_identity_service(kwargs) File "/usr/lib/python2.7/site-packages/keystoneclient/v3/client.py", line 287, in get_raw_token_from_identity_service _('Authorization failed: %s') % e) keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure

[root@oscon01 heat]#

 7 No.7 Revision uts9 673 ●6 ●16 ●27 http://uttamhoode.blog...

### heat-keystone-setup-domain returns authentication error (CentOS7)

Setting up Kilo, following install guide as closely as possible. Now in Heat I get the below error setting up the domain.

I am a bit confused by the provided /usr/share/heat-dist.conf file. The CentOS instruction tells me to use this file. And I copied it over the original /etc/heat/heat.conf.

It has got some confusing directives. I do not trust it completely. (eg. in the DEFAULT stanza it has got: sql_connection = mysql://heat:heat@localhost/heat). Different than the other modules.

Does anybody have a clue what is wrong here? Kris

[root@oscon01 heat]# heat-keystone-setup-domain --stack-user-domain-name heat_user_domain --stack-domain-admin heat_domain_admin --stack-domain-admin-password hello12                      hello12

Traceback (most recent call last):

 File "/usr/bin/heat-keystone-setup-domain", line 156, in <module>
main()
File "/usr/bin/heat-keystone-setup-domain", line 107, in main
c.authenticate()
File "/usr/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner
return func(*args, kwargs)
**kwargs)
File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 503, in authenticate
resp = self.get_raw_token_from_identity_service(kwargs)
self.get_raw_token_from_identity_service(**kwargs)
File "/usr/lib/python2.7/site-packages/keystoneclient/v3/client.py", line 287, in get_raw_token_from_identity_service
_('Authorization failed: %s') % e)
keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure

[root@oscon01 heat]#heat]#

### heat-keystone-setup-domain returns authentication error (CentOS7)

Setting up Kilo, following install guide as closely as possible. Now in Heat I get the below error setting up the domain.

I am a bit confused by the provided /usr/share/heat-dist.conf file. The CentOS instruction tells me to use this file. And I copied it over the original /etc/heat/heat.conf. (instructions for other distributions do not have the directive to copy over /etc/heat/heat.conf, doe anybody have the original /etc/heat/heat.conf for CentOS?)...

It has got some confusing directives. I do not trust it completely. (eg. in the DEFAULT stanza it has got: sql_connection = mysql://heat:heat@localhost/heat). Different than the other modules.

Does anybody have a clue what is wrong here? Kris

[root@oscon01 heat]# heat-keystone-setup-domain --stack-user-domain-name heat_user_domain --stack-domain-admin heat_domain_admin --stack-domain-admin-password hello12

Traceback (most recent call last):

  File "/usr/bin/heat-keystone-setup-domain", line 156, in <module>
main()
File "/usr/bin/heat-keystone-setup-domain", line 107, in main
c.authenticate()
File "/usr/lib/python2.7/site-packages/keystoneclient/utils.py", line 318, in inner
return func(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/keystoneclient/httpclient.py", line 503, in authenticate
resp = self.get_raw_token_from_identity_service(**kwargs)
File "/usr/lib/python2.7/site-packages/keystoneclient/v3/client.py", line 287, in get_raw_token_from_identity_service
_('Authorization failed: %s') % e)
keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure

[root@oscon01 heat]#


text:
# Direction of dipole moment and electric fields seem to create an issue

1. If the direction of electric field is from positive to negative, how is it considered that when two equal (in terms of magnitude) but opposite charges are placed at a distance of $r$, the the dipole moment will be $ql$? My doubt lies in the fact that the force in the field is from postive to negative and from that, it seems that there will be no rotation or torque. But still, we see that there is a rotation about the centre of the two charges. Apparently, some force acts to turn them in different directions.

2. Secondly, why is the dipole moment from negative to the positive charge? (Please don't just say- "it's conventional. Kindly explain the reason behind that. Like, in the field, we can say that the field is from positive to negative because we consider a positive test charge and so, the direction it follows will be from positive to negative which comes from the fact that line charges repel and unlike ones attract each other. Kindly mention the story behind the convention because of which dipole moment is considered from negative to positive)

I think I'm messing up with the direction of force somehow.

• "But still, we see that there is a rotation about the centre of the two charges." Where are you getting this from? – probably_someone Apr 27 '18 at 20:51
• @probably_someone there is a moment, right? So, aren't the dipoles rotating? – Mathejunior Apr 27 '18 at 20:53
• They are not. The dipole moment is completely different from angular momentum. – probably_someone Apr 27 '18 at 20:54
• Closely related to you question about the direction of the dipole moment. I don't understand your question about rotation in an isolated dipole. – rob Apr 27 '18 at 20:55
• @probably_someone Then what is the moment here? Isn't it the torque? What's it? – Mathejunior Apr 27 '18 at 20:55

Your confusion relates to an insufficiently general definition of "moment." In the most general sense, a moment is a number that describes the shape of a distribution (of probability, mass, charge, force, etc.). In general, the $n$th-order statistical moment of a distribution is defined as

$$\langle r^n\rangle=\int r^n\rho(\vec{r})d^3\vec{r}$$

If $\rho$ is a probability distribution, the zeroth moment is 1, the first moment is the mean, the second moment is the variance, and so on. If $\rho$ is a mass distribution, the zeroth moment is the total mass, the first moment is the location of the center of mass multiplied by the total mass, and the second moment is the moment of inertia. For a force density distribution, the first moment of the distribution is called the torque (or simply the "moment" in engineering circles, which is short for "moment of force," though that usage is precisely what's confusing you).

In three dimensions, in order for the set of all moments to carry all of the information about the shape of a distribution, we must introduce some angular dependence to our expression. When we expand our potential into terms dependent on increasing powers of $r$ and the spherical harmonics (which carry angular information), this gives us the multipole moments $Q_{lm}$; reading them off of the expansion of the potential gives

$$Q_{lm}=\int r^l \rho(\vec{r})\sqrt{\frac{4\pi}{2l+1}}Y_{lm}^*(\theta,\phi)d^3\vec{r}$$

where $Y_{lm}$ are the spherical harmonics. The moments of order $l$ give the $2^l$-pole moment, projected onto various axes, where $-l\leq m \leq l$. For $l=0$, you get the monopole moment, which only has $m=0$ and is therefore just a number. For $l=1$, you get the dipole moment. Since $m=-1,0,1$, there are three components to the dipole moment, which means it exists as a vector. The direction of this vector is fixed by the definition of the multipole moment, and if you go through the necessary calculations, you will find that this definition fixes the dipole moment vector to be from the negative charge to the positive charge.

You can keep going up in $l$, too. For $l=2$, the quadrupole moment has 5 projections, for $m=-2,-1,0,1,2$. As such, the quadrupole moment turns out to be a traceless symmetric rank-2 tensor (essentially a matrix). Higher moments have even more complicated structures.

The strength of the electric field around a dipole depends on the product of the charge $q$ and its separation $d$, called the dipole moment $p=qd$. Even though the charges and separations are different, two dipoles which have the same product $qd$ - ie the same dipole moment - have the same electric field around them.

(This is approximately true provided that the distance from the dipole at which the electric field is measured is large compared with the separation $d$.)

Dipole moment is not a torque, although a dipole does look similar to a couple, and the use of the term moment is the same as for moment of a force and moment of inertia. If placed in a uniform electric field, there would be a torque on the dipole.

The direction of the dipole moment is the direction of the electric field coming out from the +ve end. This follows the convention that the electric field is the direction of the force on a small +ve test charge. The test charge cannot be placed inside the dipole, because this is usually very small, and in this region the above approximation does not apply so the definition of the dipole moment would not apply.


text:
# Mysterious Flash Drive

First puzzle I ever do! Hopefully it won't be too easy or too challenging.

My co-worker just gave me a USB flash drive, which was supposed to contain a couple files of code for me to review. Unfortunately, I think he might have given me the wrong one, cause when I plugged it in, these were the contents.

$$\hskip 2.5 in$$

I opened the png file looking for answers, and this is what I saw.

$$\hskip 3.1 in$$

# What are the exact contents of those files?

(If you're at a loss as to where to start I can think of some hints, just say where you're stuck and I'll try to steer you in the right direction).

Edit: Added a new "knowledge" tag that maybe I should have added earlier (though no one is close to the part where some kind of knowledge may be required). Considering putting up a bounty too in a few days, I'm too anxious for someone to finally solve this!

Hint 1

Size matters.

Hint 2

Think in two dimensions.

Hint 3

X marks the spot.

Hint 4

There are only four possible positions for the X inside the box. If it was on the opposite corner, you would probably end up very, very far away from your destination.

Hint 5

As you already figured out, the colours of the box are clues too, but they might only make sense after the puzzle is solved, so don't focus on them too much.

Hint 6

Last clue for a while, because I feel bad for bumping this so much: the colours of the box represent time in different ways.

Hint 7

There are 12 destinations, and they're all within the same country. You might have to take a close look at them too.

Hint 8

Any major city would have worked, but this one in particular is by itself a clue.

Hint 9

Now it may be time to open your ears.

1. The six-digit numbers in the file names are portions of coordinates. Left side is latitude, right side is longitude.

2. The middle number is an index. Sorting by that index could be helpful (when you've figured out the coordinates).

3. The dimensions of the box are important, as well as the hex RGB representations of the colors.

4. j3App's coordinates are correct, but what could they mean?

5. Blue indicates a year, while green represents mm:ss.

• stares intently at geography tag – Zimonze Oct 26 at 21:11
• You use USB sticks to share code for dev review!!??!?!??!?!? – mypetlion Oct 26 at 21:12
• @mypetlion I definitely put all the effort into the puzzle and not the story ;) That's why I didn't think it was necessary to add a story tag. – NudgeNudge Oct 26 at 21:27
• Does it help anybody to know that rot13:vs lbh hfr gur oyhr obk nf n znfx bire gur fperrafubg bs gur qverpgbel yvfgvat, vg svgf ± cresrpgyl bire bar pbyhza naq svir ebjf yvxr guvf? – Chowzen Oct 27 at 23:17
• @Chowzen That's a clever observation but it's purely coincidental. – NudgeNudge Oct 27 at 23:41

The files that are not the .png file are

named with a scheme that looks somewhat like latitude-index-longitude

and there are

12 of them, and 12 different middle numbers, so try using that for the order and sorting by that middle field

and then

take the first six digits as DD.dddd where DD is the degrees and dddd is the decimal portion of a degree.

Likewise

for the last six digits.

If we plot this, we get:

which looks exactly like

nothing I've ever seen. Maybe a Halloween cat if you squint. :(

• I did this exact same thing. Didn't squint. Saw nothing. – Chowzen Oct 27 at 10:33
• @Chowzen that's a good question. Btw, many APIs use long,lat instead of lat,long, though I don't really think that matters here – j3App Oct 28 at 19:28
• @shoover: Does any of the 12 locations look special e.g. if you zoom in in satellite mode. And if you flip lat,long? – j3App Oct 28 at 20:00
• I checked the 12 location also by swapping latlong to longlat. Also I tested the locations using Dddddd instead of DDdddd. No effect – j3App Nov 3 at 20:16
• I think I've got it with the "x" on the image. Once I get back to my PC in 3 hours, I'll post an answer – j3App Nov 4 at 8:55

I've got a good part of it,

We are in a city starting with O.

The solution involves a police station an a fast food joint. Also a car dealer.

The x on the png

has 4 possible locations. Upper left means the coordinates are west of Greenwich and north of the equator

The dimensions of the png 35*97

are the rough coordinates, meaning we are at 35 degrees north and 97 degrees west

When adding the 12 latlng pairs

as decimals behind 35 and -97,

we end up in

Then when looking at the 12 positions as they are indexed, we have:

The incident:

the bombing was in 1995, so that doesn't fit the 1997 mentioned in my comment above

I took a look around each of the 12 locations using street view.

Found interesting stuff like e.g. a fighter airplane, a graveyard etc, but couldn't make any sense of it

Also tried playing with the RGB values as time representers,

including using them as arc minutes and seconds for lat and long. Also this took me nowhere. Neither did the hex sequence 1997 (year?) nor the hex sequence 5321 (can hardly be a date or hrs/min)

And

TWA800? And Audi?

And

The content could be Monika Lewinsky audio files, more tomorrow, it is bed time here

• You almost got it (left = W though, but you're where you need to be). Just need to find what the places are supposed to indicate. – NudgeNudge Nov 4 at 11:41
• yes, got east and west mixed up in the excitement, corrected now. When I saw O... city, I immediately thought of the b... incident, but there is probably more to be said about the city – j3App Nov 4 at 11:45
• You're close, so I don't want to give you any more hints for the rest of the day. See if you can make some progress with the info you have and maybe you'll get some input from the nice people in here. – NudgeNudge Nov 4 at 11:53
• It is possible that the locations indicate time or semaphore, using the directions of the lines. – Hugh Nov 7 at 17:03
• @Hugh Interesting idea with the semaphores – j3App Nov 7 at 19:24

Forgive me for my inexperience on posting...

Here a few observations:

1) The files screenshot has dimensions 170x284. The other picture has dimensions 35x97.

I plotted the coordinates like @shoover (not in satellite view)

2) Most (9 out of 12) of the coordinates are in Russia, with two in Kazakhstan and one in Turkey. oh wait 9 is a square

I see squares everywhere

3) @j3App stated that the picture's color is 25x151, which is a square times the 36th prime (36 is a square)

I don't think my observations helped, but they might be interesting. (All I really did was play around with numbers)


text:
# Reference request: extension of $*$-homomorphism to multiplier algebra

Let $A$ be a $C^*$-algebra and $f:A\rightarrow\mathbb{C}$ a $^*$-homomorphism. Does $f$ always extend to a $^*$-homomorphism $\tilde{f}:M(A)\rightarrow\mathbb{C}$, where $M(A)$ is the multiplier algebra of $A$?

I suspect the answer is no, but I'm not sure how to show this. In case the answer is yes, a proof or reference would be greatly appreciated.

Thanks!

The answer is yes. This depends on two facts:

• $A$ is an ideal in $M(A)$.

• if $J\subset B$ is an ideal, any non-degenerate representation $J\to B(H)$ can be extended to a representation $B\to B(H)$. This is for instance Lemma I.9.14 in Davidson's C$^*$-Algebras By Example. Here we have $J=A$, $B=M(A)$, $H=\mathbb C$.

The argument works for any $*$-homomorphism $A\to B(H)$.

• Can this somehow be used to show that any $*$-homomorphism of $C^*$-algebras $A\rightarrow B$ extends to a $*$-homomorphism $M(A)\rightarrow M(B)$? (I'm slightly worried about the non-degeneracy requirement in Davidson.) – ougoah Nov 2 '18 at 2:34
• As far as I can tell, you usually require the $*$-homomorphism to be onto for that. In that case, it looks like the above argument would indeed work. – Martin Argerami Nov 2 '18 at 3:51
• If the representation $\pi:A→B(H)$ is degenerate,can we also get the unique extension $\tilde{\pi}:M(A)→B(H)$ by defining $\tilde{\pi}(\tilde a)=lim\pi(a)e_n$,where $\{e_n\}$ is a.u for A. – math112358 Apr 27 at 22:23
• You will never get uniqueness of an extension of a degenerate representation; that's precisely the problem. As for the definition, I see no reason for your limit to converge. – Martin Argerami Apr 27 at 22:34
• math.stackexchange.com/questions/2940320/… answered the question before.In Blackdar's book,there also states the non-degeneracy of the representation. – math112358 Apr 27 at 22:47


text:
# Partitioning list into two parts of almost equal sum

I was given this problem in class, and I have no idea how to solve it. The problem is:

"Given a list of positive integers, divide the numbers into 2 groups such that the difference between the sum of each group is minimal, print that difference. The algorithm must be efficient."

I guess by efficient they mean do not just brute force every option, any ideas?

I tried summing all the numbers and dividing by 2, then the problem is equivalent to finding a group that is the closest to that number, also now you can go over all the options but once you get to a point where you can only add numbers but your above that number you can stop.

• This is a version of the NP-complete problem PARTITION. – Yuval Filmus Feb 12 at 10:33

As Yuval Filmus points out, this is an optimization version of the PARTITION problem. The problem is weakly NP-complete, so any polynomial time solution to your problem would immediately solve partition (simply check if the minimum difference between the sums of the two sets is $$0$$).

You can solve the problem in pseudo-polynomial time $$O(nS)$$, where $$S$$ the sum of the input integers, using dynamic programming, or in time $$O(n \cdot 2^{n/2})$$ using the split-and-list technique. Pick the best of the two algorithms depending on the value of $$S$$.

The dynamic programming algorithm is as follows. Let $$A = \{a_1, \dots, a_n\}$$ be the input (multi-)set of numbers, and let $$S=\sum_{a \in A} a$$. Consider a partition of $$A$$ into two sets $$B$$ and $$C$$, and assume w.l.o.g. that $$\sum_{b \in B} b \le \sum_{c \in C} c$$ (since otherwise you can swap $$B$$ and $$C$$). The cost (to minimize) of this partition is: $$\sum_{c \in C} c - \sum_{b \in B} b = \left(S- \sum_{b \in B} b\right) - \sum_{b \in B} b = S - 2 \sum_{b \in B} b.$$

Showing that the problem is equivalent to finding a subset $$B$$ of $$A$$ whose sum of elements is at most $$\lfloor S/2 \rfloor$$ and, subject to this constraint, it is maximized.

For $$i=0, \dots, n$$, and $$x=1,\dots,\lfloor S/2 \rfloor$$, let $$OPT[i,x]$$ be true if and only if there exists a subset $$B$$ of $$\{a_1, \dots, a_i\}$$ with $$\sum_{b \in B} b = x$$.

Then $$OPT[0,0]=\top$$ and, for $$x>0$$, $$OPT[0,x]=\bot$$.

If $$i>0$$: $$OPT[i,x] = \begin{cases} OPT[i-1,x] \vee OPT[i-1,x-a_i] & \mbox{if a_i \le x} \\ OPT[i-1,x] & \mbox{otherwise} \end{cases}.$$

There are $$O(nS)$$ values $$OPT[i,x]$$ and each of them can be computed in constant time (in increasing order of $$i$$). The maximum value of $$\sum_{b \in B} b$$ is $$\max \left\{ x \in \{0, \dots, \lfloor S/2 \rfloor \} \mid OPT[n, x] = \top \right\}$$.

• Could you elaborate on the dynamic programming approach? Should i check all possible partition's and compute the sum using dynamic progrmming? – sean python Feb 12 at 22:01
• If you check all possible partitions you're already using $\Omega(2^n)$ time. I'm editing my answer with the dynamic programming algorithm. Give me ~10 minutes. – Steven Feb 12 at 22:03
• What is the meaning of i in OPT[i,x]? – sean python Feb 13 at 13:19
• @seanpython, it means that we are only considering the first $i$ elements of $A$, i.e., the set $\{a_1, \dots, a_i\}$. – Steven Feb 13 at 14:54


text:
# Relative importance of a set of predictors in a random forests classification in R

I'd like to determine the relative importance of sets of variables toward a randomForest classification model in R. The importance function provides the MeanDecreaseGini metric for each individual predictor--is it as simple as summing this across each predictor in a set?

For example:

# Assumes df has variables a1, a2, b1, b2, and outcome
rf <- randomForest(outcome ~ ., data=df)
importance(rf)
# To determine whether the "a" predictors are more important than the "b"s,
# can I sum the MeanDecreaseGini for a1 and a2 and compare to that of b1+b2?

First I would like to clarify what the importance metric actually measures.

MeanDecreaseGini is a measure of variable importance based on the Gini impurity index used for the calculation of splits during training. A common misconception is that the variable importance metric refers to the Gini used for asserting model performance which is closely related to AUC, but this is wrong. Here is the explanation from the randomForest package written by Breiman and Cutler:

Gini importance
Every time a split of a node is made on variable m the gini impurity criterion for the two descendent nodes is less than the parent node. Adding up the gini decreases for each individual variable over all trees in the forest gives a fast variable importance that is often very consistent with the permutation importance measure.

The Gini impurity index is defined as $$G = \sum_{i=1}^{n_c} p_i(1-p_i)$$ Where $n_c$ is the number of classes in the target variable and $p_i$ is the ratio of this class.

For a two class problem, this results in the following curve which is maximized for the 50-50 sample and minimized for the homogeneous sets:

The importance is then calculated as $$I = G_{parent} - G_{split1} - G_{split2}$$ averaged over all splits in the forest involving the predictor in question. As this is an average it could easily be extended to be averaged over all splits on variables contained in a group.

Looking closer we know each variable importance is an average conditional on the variable used and the meanDecreaseGini of the group would just be the mean of these importances weighted on the share this variable is used in the forest compared to the other variables in the same group. This holds because the the tower property $$\mathbb{E}[\mathbb{E}[X|Y]] = \mathbb{E}[X]$$

Now, to answer your question directly it is not as simple as just summing up all importances in each group to get the combined MeanDecreaseGini but computing the weighted average will get you the answer you are looking for. We just need to find the variable frequencies within each group.

Here is a simple script to get these from a random forest object in R:

var.share <- function(rf.obj, members) {
count <- table(rf.obj$forest$bestvar)[-1]
names(count) <- names(rf.obj$forest$ncat)
share <- count[members] / sum(count[members])
return(share)
}

Just pass in the names of the variables in the group as the members parameter.

I hope this answers your question. I can write up a function to get the group importances directly if it is of interest.

EDIT:
Here is a function that gives the group importance given a randomForest object and a list of vectors with variable names. It uses var.share as previously defined. I have not done any input checking so you need to make sure you use the right variable names.

group.importance <- function(rf.obj, groups) {
var.imp <- as.matrix(sapply(groups, function(g) {
sum(importance(rf.obj, 2)[g, ]*var.share(rf.obj, g))
}))
colnames(var.imp) <- "MeanDecreaseGini"
return(var.imp)
}

Example of usage:

library(randomForest)
data(iris)

rf.obj <- randomForest(Species ~ ., data=iris)

groups <- list(Sepal=c("Sepal.Width", "Sepal.Length"),
Petal=c("Petal.Width", "Petal.Length"))

group.importance(rf.obj, groups)

>

      MeanDecreaseGini
Sepal         6.187198
Petal        43.913020

It also works for overlapping groups:

overlapping.groups <- list(Sepal=c("Sepal.Width", "Sepal.Length"),
Petal=c("Petal.Width", "Petal.Length"),
Width=c("Sepal.Width", "Petal.Width"),
Length=c("Sepal.Length", "Petal.Length"))

group.importance(rf.obj, overlapping.groups)

>

       MeanDecreaseGini
Sepal          6.187198
Petal         43.913020
Width          30.513776
Length        30.386706

• Thanks for the clear and rigorous answer! If you wouldn't mind adding a function for group importances, that would be great. – Max Ghenis Apr 7 '14 at 19:59
• Thanks for that answer! Two questions, if you have a minute : (1) The importance is then calculated as... : with respect to the Breiman's definition, I is the "gini decrease" there, and the importance would be the sum of the decreases, correct ? (2) averaged over all splits in the forest involving the predictor in question : Can I replace this by all nodes involving a split on that particular feature ? To be sure I fully understand ;) – Remi Mélisson Apr 16 '14 at 13:06
• You comment got me thinking a bit more on the definitions so I dug through the randomForest code used in R to answer it properly. I have been slightly off to be honest. The average is made over all trees and not all nodes. I will update the answer as soon as I get time for it. Here are the answers to your question for now: (1) yes. This is how it is defined on the tree level. The sum of decreases is then averaged over all trees. (2) Yes, that was what I meant to say, but it doesn't really hold. – while Apr 17 '14 at 9:54

The function defined above as G=sum over classes[pi(1−pi)] is actually the entropy, which is another way of evaluating a split. The difference between the entropy in children nodes and the parent node is the Information Gain. The GINI impurity function is G = 1- sum over classes[pi^2].


text:
Mind Matters Natural and Artificial Intelligence News and Analysis

# Pursuit of the AI Singularity Is Modern Alchemy

Just as lead cannot just become gold, software cannot just become creative

Students who study calculus are experiencing the fruits of the genius of Isaac Newton (1643–1727). The same is true for introductory courses in physics and differential equations. All are due to Newton, who built the beautiful palace of mathematical physics. The wings of quantum mechanics and relativity were added in the early twentieth century.

But Newton had other interests as well. He penned over a million words on the topic of alchemy, which included his quest to turn lead into gold. Although alchemy contributed to the founding of chemistry, it has long been discredited in itself. The only way to turn lead into gold is by negotiating a swap at your local pawn shop.

In the same way, some great computer scientists who write remarkable software today are deluding themselves by a belief in the AI Singularity. Someday, the theory goes, AI will write better AI that in turn writes still better AI and so on. Like Skynet in the Terminator movie franchise, AI will eventually try to take over humanity. This Singularity is espoused by such luminaries as Stephen Hawking, Elon Musk, and Google’s Ray Kurzweil.
A roadblock to the AI singularity is creativity. Computers cannot be creative. Computer creativity occurs when a computer program does something it was not programmed to do.

Software can write other software code but not creatively. For example, do any Google search, right click on the Results page, and select “View Page Source.” The code you see is not written by a human but by software that writes software. But the Google page code displays zero creativity beyond the software that wrote it.

The idea that AI can write better and better AI programs on its own assumes that computers can be creative. They cannot. Johns Hopkins’ Gregory Chirikjian agrees: “[AI will never] be able to exhibit any form of creativity or sentience.” Microsoft CEO Satya Nadella concurs: “One of the most coveted human skill is creativity, and this won’t change. Machines will enrich and augment our creativity, but the human drive to create will remain central.”1 Oxford mathematical physicist Sir Roger Penrose forcefully promotes this viewpoint in his iconic book The Emperor’s New Mind.2

The only way a computer program can write a better computer program is if the programmer tells it what to do. But then the source of the creativity is not the AI. The source of the creativity is the computer programmer.

But haven’t we already seen creative AI? What about the AI that writes music? AI trained with the music of Bach will write music that mimics Bach. If the Bach-trained AI generated music akin to that of Richard Wagner or Stravinsky, that would be creativity.

But then what about the AI-generated painting of the fat man that sold for over $400,000? The AI that did this was trained using classic paintings. I don’t know for sure but will give large odds that no paintings by cubist Pablo Picasso or paint-splattering Jackson Pollock were used in the training of the AI painter. The AI mimicked but was not creative. The AI did exactly what the computer programmer intended it to do. But didn’t AlphaGo make a surprisingly creative move in its highly publicized match with GO champion Lee Sodel? No. The program was trained to play the board game GO and that’s what it did. The GO program isn’t even clever enough to answer questions3 like: • Do you play canasta? • Can you climb stairs? • Can you explain the game of GO to me? Unexpected moves made by GO software can be surprising. But surprise is different than creativity. We are surprised when we learn from a Google search that a group of ferrets is called a business. But that’s not creativity. Computer programmers are likewise often surprised at the unexpected results their programs generate. Attempts thus far to create AI that writes better AI have failed. The approach of using evolutionary computer programs to do so is being abandoned by some computer scientists. The quest for the AI singularity will be viewed historically in the same light as Isaac Newton’s pursuit of alchemy. Lead can’t be turned into gold. Computer code cannot be creative. Notes: 1 Satya Nadella. Hit Refresh: The Quest to Rediscover Microsoft’s Soul and Imagine a Better Future for Everyone Harper Business, 2017 2 Penrose, Roger. The Emperor’s New Mind: Concerning computers, minds, and the laws of physics. (1990): 1214-1216. 3 This list is inspired by a TEDx talk by Oren Etzioni. You may also enjoy: Fan tries programming AI jazz, gets lots and lots of AI… Jazz is spontaneous, but spontaneous noise is not jazz (Brendan Dixon) and Does AI art spell the end of the artist’s way of life? An AI-produced painting sold at auction for$432,500. But is it a trend or just a novelty?