Friday, June 26, 2009
Cure Your Phobia Instantly - How To Cure Phobias
Phobia is defined by a fear that is described as not rational and exaggerated and would cause a person to avoid that thing, person or situation which causes that reaction. It usually draws out distress and anxiety from the affected person and may manifest in a form of panic attacks and a person’s inability to function normally.
A suggestion on how to cure phobias is by classical conditioning, an approach that deals with having to undergo the same feeling with the same event in a repeated process until both may already be coupled together and become a habit. This is with the help of a conditioned stimulus that when gradually let go would actually aid in the behavior becoming a habit, something which comes naturally.
Sedatives are also another another suggestion on how to cure phobias. There are various sedatives that are acceptable in industrial settings or in the workplace and other public places. Examples are Remeron, Xanax, Benadryl, Riperdal, Lunesta, and Thorazine to name a few. Still, you have to consult a professional psychiatrist or clinician in order to prescribe these medicines and to make sure that the treatment you are taking is suitable for you.
Sadly, though, there are some people who have financial constraints that hinder them from having therapy, whether it is through psychotherapy or through medication. And more often than not, people who have problems with money are those people who suffer much from mental disorders such as phobias. However, not many people realize that one way to cure phobia instantly without any monetary issue is through self help techniques that can be paired with medicines at a reasonable rate.
So, I laid down some of your options on how to cure phobias, now it’s up to you on what to decide you’ll take on and help yourself.
source http://www.articlesbase.com
Wednesday, June 24, 2009
Thoshiba Satellite A355-S6925 16.0 Inch Laptops
The Basics
- Processor: The Intel Core 2 Duo T6400 processor has a 2.0 GHz processor speed, fast 800 MHz front-side bus (FSB), and 2 MB L2 cache. (An L2, or secondary, cache temporarily stores data; and a larger L2 cache can help speed up your system's performance. The FSB carries data between the CPU and RAM, and a faster front-side bus will deliver better overall performance.)
With two computational execution cores in a single processor, it provides greater system response when running multi-threaded applications simultaneously with no significant increase in power consumption. It's optimized for multitasking and is ready to support the Microsoft Windows Vista operating system. It can simultaneously run multiple demanding applications--such as graphics-intensive games or serious number-crunching business productivity applications--while downloading music or running virus-scanning security programs in the background. Some of the advanced Intel innovations of the Core 2 Duo processor include:
- Smart Memory Access: Improves system performance by hiding memory latency, thus optimizing the use of available computer data bandwidth to provide data to the processor when and where it is needed.
- Advanced Digital Media Boost: Effectively doubles the execution speed for instructions used widely in multimedia and graphics applications.
- Dynamic Power Coordination: Coordinates Enhanced Intel SpeedStep Technology and idle power-management state (C-states) transitions independently per core to help save power.
- Deeper Sleep with Dynamic Cache Sizing: Saves power by flushing cache data to system memory during periods of inactivity to lower CPU voltage.
- Hard Drive: The large 320 GB Serial ATA (SATA) hard drive (5400 RPM) offers a wealth of storage space, perfect for storing a vast multimedia collection or for editing digital video. This SATA hard drive also quickens the pace with a higher speed transfer of data--akin to Firewire and USB 2.0.
- Memory: The 4 GB of installed RAM (PC6400, 2 x 2 GB) maximizes the capacity of this notebook, and it also offers an ultra-fast 800 MHz speed.
- DVD/CD Drive: The dual-layer Labelflash DVD drive is compatible with a wide range of formats, including both DVD+RW and DVD-RW discs, CD-RW discs, and dual-layer (DL) DVD±R discs, which can hold up to 8.5 GB of data--great for backing up your MP3 collection or your most important documents. It features the following speeds: 6x for both DVD±R DL, 8x for both single-layer DVD±R, 8x DVD+RW, 6x DVD-RW, 5x DVD-RAM, and 24x/16x for CD-R/RW. It reads DVD-ROM discs at 8x and CD-ROMs at 24x.
With the Labelflash functionality, you can burn high-resolution, high-contrast pictures on the label side of DVD discs using the same laser used for data recording. Enjoy transparency and high-quality not found in traditional printable media. All you need is a Labelflash DVD disc to start labeling without a printer.
- Keyboard & Mouse: This notebook has a standard 86-key keyboard and electro-static two-button touchpad. It also offers a launch button for the Express CD/DVD media player and control buttons (play, stop, next, previous) as well as a volume control dial.
The 16-inch WXGA LCD has a resolution of 1366 x 768 pixels--perfect for watching movies in their intended 16:9 widescreen aspect ratio. It also provides TruBrite technology, which makes images brighter and more vivid thanks to its anti-glare feature. Video is powered by the Intel Graphics Media Accelerator X4500MHD, which uses shared video memory (up to 1750 MB allocated from the system memory) and provides Windows Vista Aero interface support and enhanced 3D graphics performance--delivering over 2x scores on 3DMark 06. Intel Clear Video Technology provides outstanding video playback with sharper image quality, increased clarity, and customizable color controls. It also enables enhanced visual quality of interlaced content on progressive displays.
This notebook also features an integrated audio card and two Harman Kardon stereo speakers.
Be ready for the next platform in wireless connectivity with the integrated quad-mode Intel Wireless 5100AGN Wi-Fi chip. Based on the draft 802.11n Wi-Fi specification, it offers up to five times the performance and twice the wireless range as existing 802.11g wireless. It's also backward compatible with 802.11b/g networks (commonly found in home routers and Wi-Fi hotspots) as well as 802.11a networks (which has a higher throughput, but more limited range--great for closed office environments).
It also includes a next-generation ExpressCard card slot (replacing the PCMCIA slot), which lets you take advantage of thinner, faster, and lighter expansion cards for even more advanced wireless, networking, storage, and security features. It comes with the following external connectors:
- 4 USB 2.0 ports for connecting a wide range of peripherals--from digital cameras to MP3 players (including 1 eSATA/USB combo port)
- 1 FireWire (also known as IEEE 1394 or i.Link) port for connecting digital video camcorders and other peripherals
- Video out: VGA
- 1 ExpressCard 54/34 slot
- 1 headphone jack (with SPDIF digital output for 5.1-channel surround sound)
- 1 microphone jack
- 5-in-1 memory card reader (Secure Digital, MultiMedia, Memory Stick, Memory Stick PRO, xD Picture Card)
- 10/100 Fast Ethernet networking
- 56K modem (V.90)
Operating System
The 64-bit version of Windows Vista Home Premium (with SP1) is the operating system for users with advanced computer needs, and it includes all of the Windows Media Center capabilities for turning your PC into an all-in-one home entertainment center for watching DVD movies and accessing your digital audio library. You can also use Windows Media Center to record and watch your favorite TV shows (even HDTV) and to access new kinds of online entertainment content. Computers that include Windows Vista Home Premium and an auxiliary Windows SideShow display will also allow you to access key data even when your computer is off. It is also easier than ever to share files between other PCs in your household and to manage your laptop computer settings to more securely connect via Wi-Fi.
Every edition of Windows Vista provides the essential tools and technologies to help protect you whether you are browsing the Internet, connecting to a wireless network, or just reading e-mail. All editions of Windows Vista include new tools that can warn you of impending hardware failures long before you have lost any important personal data. And, all Windows Vista editions include parental control features that allow you to manage and monitor your family's use of games, the Internet, instant messaging, and other activities.
Preloaded Software
Microsoft Works 9.0, Google Toolbar, Ulead DVD MovieFactory 5, Norton 360 All-in-One Security (30-day trial), and Microsoft Office 2007 Home and Student Edition (60-day trial).
Dimensions & Weight
This notebook measures 15.1 x 10.5 x 1.52 inches (WxDxH, and it weighs 6.5 pounds.
Power
It comes with a 4000 mAH lithium-ion battery pack for extra-long battery life.
This package contains the Toshiba Satellite A355-S6925 notebook PC, rechargeable lithium-ion battery, AC adapter, and operating instructions. It is backed by a one-year limited hardware warranty.
Product Description
Home. School. Work. Community. How many roles do you play? So Toshiba made sure the Satellite A355 series laptop PC is well dressed for any part, with Intel Core 2 Duo processor, generous 320GB storage and 4GB RAM, plus a wealth of other features aimed at making you a star. Movies, music, photos and games. Who doesn't love being entertained? Of course, it helps that Satellite A355 laptop comes with a brilliant widescreen TruBrite display that puts a shine on almost any activity, offering incredible color and clarity, plus a widescreen format for more room to work and multitask. This Toshiba Satellite notebook is ready to help make your life better, right out of the box. The hardware, software utilities-even the design of the machine itself-are all meant to make things easy, regardless of who, what, where or when. It's a laptop that works for you, with almost no work at all. 16 diagonal (1366 x 768) TruBrite TFT LCD display Built-in Webcam and Microphone Intel Graphics Media Accelerator 4500MHD with up to 1759MB shared Graphics Memory Labelflash DVD+-R/RW Super Multi Drive with Double Layer Harman/Kardon Stereo Speakers Intel WiFi Link 5100AGN 802.11b/g/n Wireless 10/100 Ethernet LAN 5-in-1 Bridge Media Adapter - MMC, SD, MS, MS Pro, xD ExpressCard 54/34 Slot Ports - 3 x USB 2.0, eSATA/USB combo, Headphone out S/P DIF; Microphone-in, VGA, IEEE-1394, RJ-11 (Modem), RJ-45 Approximate Unit Dimensions - 15.1 (W) x 10.5 (D) x 1.52 (H) Approximate Unit Weight - 6.48 pounds Posted
from http://glaptop.blogspot.com
Tuesday, June 23, 2009
http://glaptop.blogspot.com/2009/06/toshiba-satellite-p305-s8904.html
Replace your desktop PC with the Toshiba Satellite P305-S8904 laptop, featuring all the power and hard drive space you expect from a top-of-the-line desktop but in an easily mobile package. Stylishly designed, this Toshiba Satellite features a large, bright 17.1-inch XGA-resolution LCD (1440 x 900)--perfect for viewing multiple application screens or watching widescreen movies on DVD. It's also great for using as a media center, with Toshiba's unique Express Media Player enabling you to bypass the system and access CDs and DVDs with a touch of button. The dual-layer DVD±RW drive also burns CDs and offers LabelFlash print functionality.
It's powered by the 2.0 GHz Intel Core 2 Duo T6400 processor, which boosts speed, reduces power requirements, and saves on battery life. It also offers a fast 800 MHz front-side bus speed and 2 MB L2 cache. It also includes Intel's 5100AGN wireless LAN, which will connect to draft 802.11n routers and offers compatibility with 802.11a/b/g networks as well.
Other features include a 320 GB hard drive, 4 GB of RAM (8 GB maximum), 5-in-1 memory card reader, 10-key keypad, Intel GMA 4500MHD graphics with up to 1750 MB of shared video RAM, combo USB/eSATA port, and pre-installed 64-bit version of Microsoft Windows Vista Home Premium with SP1 operating system. Additionally, this Toshiba notebook is RoHS-compatible, effectively reducing the environmental impact by restricting the use of lead, mercury and certain other hazardous substances.
Brilliant Fusion FinishAn advanced Toshiba notebook should be more than just a way to make mobile life easier. It should be a reflection of you, too. And this laptop offers the gorgeous new high-gloss Fusion finish with striking Horizon design pattern. It features a smooth, shiny palm rest and a recessed touchpad to that gives your notebook both a more streamlined look and more comfort when you're clicking. Separate multimedia buttons let you launch your favorite entertainment right away as well as control playback--letting you start, pause, fast-forward and rewind almost with feather-touch operation.
The Basics
- Processor: The Intel Core 2 Duo T6400 processor has a 2.0 GHz processor speed, fast 800 MHz front-side bus (FSB), and 2 MB L2 cache. (An L2, or secondary, cache temporarily stores data; and a larger L2 cache can help speed up your system's performance. The FSB carries data between the CPU and RAM, and a faster front-side bus will deliver better overall performance.)
With two computational execution cores in a single processor, it provides greater system response when running multi-threaded applications simultaneously with no significant increase in power consumption. It's optimized for multitasking and is ready to support the Microsoft Windows Vista operating system. It can simultaneously run multiple demanding applications--such as graphics-intensive games or serious number-crunching business productivity applications--while downloading music or running virus-scanning security programs in the background. Some of the advanced Intel innovations of the Core 2 Duo processor include:
- Smart Memory Access: Improves system performance by hiding memory latency, thus optimizing the use of available computer data bandwidth to provide data to the processor when and where it is needed.
- Advanced Digital Media Boost: Effectively doubles the execution speed for instructions used widely in multimedia and graphics applications.
- Dynamic Power Coordination: Coordinates Enhanced Intel SpeedStep Technology and idle power-management state (C-states) transitions independently per core to help save power.
- Deeper Sleep with Dynamic Cache Sizing: Saves power by flushing cache data to system memory during periods of inactivity to lower CPU voltage.
- Hard Drive: The large 320 GB Serial ATA (SATA) hard drive (5400 RPM) offers a wealth of storage space, perfect for storing a vast multimedia collection or for editing digital video. This SATA hard drive also quickens the pace with a higher speed transfer of data--akin to Firewire and USB 2.0.
- Memory: The 4 GB of installed RAM (PC6400, 2 x 2 GB) helps boost the amount of available video RAM that's shared with this notebook's video card. It also offers a fast 800 MHz speed. This notebook has an 8 GB maximum RAM capacity. To receive the faster data transfer benefits of the dual-channel DDR2 RAM, any RAM additions require memory modules of same capacity and clockspeed.
- DVD/CD Drive: The dual-layer Labelflash DVD drive is compatible with a wide range of formats, including both DVD+RW and DVD-RW discs, CD-RW discs, and dual-layer (DL) DVD±R discs, which can hold up to 8.5 GB of data--great for backing up your MP3 collection or your most important documents. It features the following speeds: 6x for both DVD±R DL, 8x for both single-layer DVD±R, 8x DVD+RW, 6x DVD-RW, 5x DVD-RAM, and 24x/16x for CD-R/RW. It reads DVD-ROM discs at 8x and CD-ROMs at 24x.
With the Labelflash functionality, you can burn high-resolution, high-contrast pictures on the label side of DVD discs using the same laser used for data recording. Enjoy transparency and high-quality not found in traditional printable media. All you need is a Labelflash DVD disc to start labeling without a printer.
- Keyboard & Mouse: This notebook has a standard 104-key keyboard and electro-static two-button touchpad. It also offers CD/DVD media player and control buttons (play, stop, next, previous) as well as a volume control dial.
This Toshiba Satellite has a 17-inch TFT display with a resolution of 1440 x 900 pixels (native 720p for high-definition viewing). It also provides TruBrite technology, which makes images brighter and more vivid thanks to its anti-glare feature. Video is powered by the Intel Graphics Media Accelerator 4500MHD, which uses shared video memory (up to 1750 MB allocated from the system memory). This graphics card is built with Intel Clear Video technology, which delivers clearer, more detailed images by eliminating many of the jagged edges and video artifacts seen when viewing interlaced content and features powerful color control to ensure videos are not too dark, overly bright, or washed out.
This notebook also features an integrated audio card and two Harman Kardon stereo speakers.
Networking, Connectivity & Expansion
Be ready for the next platform in wireless connectivity with the integrated quad-mode Intel Wireless 5100AGN Wi-Fi chip. Based on the draft 802.11n Wi-Fi specification, it offers up to five times the performance and twice the wireless range as existing 802.11g wireless. It's also backward compatible with 802.11b/g networks (commonly found in home routers and Wi-Fi hotspots) as well as 802.11a networks (which has a higher throughput, but more limited range--great for closed office environments).
With USB Sleep-and-Charge support, you can use your Satellite M305 to charge your favorite portable electronic devices, even when the laptop is asleep. If you use a smartphone, you can just plug it in, power up and go without having to worry that you've got enough charge. It also includes a next-generation ExpressCard 54/34 card slot (though no PCMCIA card slot), which lets you take advantage of thinner, faster, and lighter expansion cards for even more advanced wireless, networking, storage, and security features. Here's the full list of connection options:
- 4 USB 2.0 ports for connecting a wide range of peripherals--from digital cameras to MP3 players (including 1 eSATA/USB combo port)
- 1 FireWire (also known as IEEE 1394 or i.Link) port for connecting digital video camcorders and other peripherals
- 1 ExpressCard 54/34 slot
- Video out: VGA
- 1 headphone jack (with SPDIF digital output for 5.1-channel surround sound)
- 1 microphone jack
- RJ-45 port for 10/100 Ethernet connection
- 56K modem port (V.90)
- 5-in-1 memory card reader (Secure Digital, MultiMedia, Memory Stick, Memory Stick PRO, xD Picture Card)
Operating System
The 64-bit version of Windows Vista Home Premium (with SP1) is the operating system for users with advanced computer needs, and it includes all of the Windows Media Center capabilities for turning your PC into an all-in-one home entertainment center for watching DVD movies and accessing your digital audio library. You can also use Windows Media Center to record and watch your favorite TV shows (even HDTV) and to access new kinds of online entertainment content. Computers that include Windows Vista Home Premium and an auxiliary Windows SideShow display will also allow you to access key data even when your computer is off. It is also easier than ever to share files between other PCs in your household and to manage your laptop computer settings to more securely connect via Wi-Fi.
Every edition of Windows Vista provides the essential tools and technologies to help protect you whether you are browsing the Internet, connecting to a wireless network, or just reading e-mail. All editions of Windows Vista include new tools that can warn you of impending hardware failures long before you have lost any important personal data. And, all Windows Vista editions include parental control features that allow you to manage and monitor your family's use of games, the Internet, instant messaging, and other activities.
Preloaded Software
Microsoft Works 9.0, Google Toolbar, Ulead DVD MovieFactory 5, Norton 360 All-in-One Security (30-day trial), and Microsoft Office 2007 Home and Student Edition (60-day trial).
Dimensions & Weight
This notebook measures 15.8 x 11.4 x 1.5 inches (WxDxH, and it weighs 7.4 pounds.
Power
It comes with a 4000 mAH (6-cell) lithium-ion battery pack for extra-long battery life.
What's in the Box
This package contains the P305-S8904 notebook PC, rechargeable lithium-ion battery, AC adapter, and operating instructions. It is backed by a one-year limited hardware warranty.
Product Description
With a sophisticated high-gloss Fusion Finish, plus exceptional features that include extra large screen, the Satellite P305/P305D Laptop Series is great for casual gamers, entertainment enthusiats or those looking to replace their desktop computer. With a dazzling 17" diagonal widescreen displays, discrete graphics, and luxurious sound system that delivers virtual surround listening, these machines offer up high-end movies, plus major music and gaming action. Yet with muscular dual-core processors, a versatile optical drive, plus memory and storage, they can become true workhorses too. Innovations like an FM Tuner plus webcam with Toshiba Face recgonition complete the "big-time"performance picture. The Toshiba P305-S8904 ships with Genuine Windows Vista Home Premium (SP1, 64 bit version), 2.0 GHz Intel Core 2 Duo T6400 Processor, 2MB L2 Cache, Mobile Intel GM45 Express Chipset, Mobile Intel Graphics Media Accelerator 4500MHD with 128MB-1759MB Dynamically Allocated Shared Graphics Memory, Configured with 4GB PC6400 DDR2 SDRAM, 320GB (5400 RPM) Hard Drive (SATA), DVD SuperMulti (+/-R double layer) drive with LabelFlash supporting 11 formats, 17.0 in (Diagonal) Widescreen TruBrite TFT LCD Display at 1440 x 900 Resolution, webcam and microphone built into LCD bezel, Intel Wi Fi Link 5100AGN /802.11a/g/n. Dimensions: 15.8 " x 11.4" x 1.38" without feet, weight: Starting at 7.39 lbs.
Web Investigator - Find A Person By Phone
Click Here Web Investigator Instant Access Now!
You need not to worry about how to catch the caller who has been bugging you overnight. The first thing which comes into our mind when are being flooded by unsolicited calls from anonymous numbers is to discover the person behind it. When you know how to find a person by phone then your bugging calls are bound to oblivion. The good news for those who would want to do some web investigation is that, finding the owner of an unfamiliar phone number is easier than you might think!
When you are trying to find a person by phone always keep in mind that as long as you have secured the area code and the seven digit number of the caller, you should be able to find or locate the owner of any number. Before anything else, you must first figure out the right places to look for it.
When you are to find a person by phone, you must not start by looking out for the name, address and other pertinent information through the yellow pages. Public phone directories will not do the trick. The reason behind this is the fact that anonymous numbers are not included in the public list of phone numbers.
To have a more effective ways to find a person by phone, you must remember that there is no primary database for cell phone numbers. In order to find the solution, you must secure access to a reverse cell phone directory. If you suffer from prank calls, cheating spouse or unknown outgoing calls on your phone, you will benefit from such type of phone directory.
Saturday, June 20, 2009
Paid Search Marketing and Search Engine Optimisation
There are two ways to improve site rankings. These are the nice way in which you are open and play fair, and the bad way in which you try every trick in the book to fool the search engine into giving you a higher ranking than you deserve.
Search engines dislike displaying pages with higher rankings than they deserve as this means that people will follow useless links and blame the search engines. This is a quick way to lose customers. They will do everything in their power to detect the SEO cheats and when they do they will be sent to the back of the class so it is vital that decent PPC software is used.
The Bad Way: Two famous examples of the bad way of influencing search engines are what is called Google Bombing (or Link Bombing), and Spamdexing. Google bombing employs the anchor text of hyperlinks to fool the search engine. The anchor text could be a phrase totally unrelated to the link destination. Of course it is necessary to ensure that this is repeated many times across the web. For instance the anchor text could contain derogatory words and the link could go to a politician's website. This technique can be used commercially too. Spamdexing is a technique of increasing rankings by repeating keywords many times on a page in a manner that is invisible to the reader but visible to the search engine. Other techniques involve creating multiple links on the internet with many interlinked pages, invisible links, and false websites. Search engines do all they can to detect these scams and de-rank the perpetuators accordingly, though new ways of fooling them are being invented perpetually.
The Good Way: Follow the guidelines laid out by the search engines. All the major search engines now publish what it looks for in a website. These are essentially what any professional web designer would consider good practice and deception free. Content, transparency and structure are key elements. The good way will lead to long term business with good customer relations. The bad way will achieve the opposite.
Article Source: http://www.ArticleStreet.com/
Friday, June 19, 2009
Logistic Regression
Logistic regression is used for binary classification problems -- where you have some examples that are "on" and other examples that are "off." You get as input a training set; which has some examples of each class along with a label saying whether each example is "on" or "off". The goal is to learn a model from the training data so that you can predict the label of new examples that you haven't seen before and don't know the label of.
For one example, suppose that you have data describing a bunch of buildings and earthquakes (E.g., year the building was constructed, type of material used, strength of earthquake,etc), and you know whether each building collapsed ("on") or not ("off") in each past earthquake. Using this data, you'd like to make predictions about whether a given building is going to collapse in a hypothetical future earthquake.
One of the first models that would be worth trying is logistic regression.
Coding it up
I wasn't working on this exact problem, but I was working on something close. Being one to practice what I preach, I started looking for a dead simple Python logistic regression class. The only requirement is that I wanted it to support L2 regularization (more on this later). I'm also sharing this code with a bunch of other people on many platforms, so I wanted as few dependencies on external libraries as possible.
I couldn't find exactly what I wanted, so I decided to take a stroll down memory lane and implement it myself. I've written it in C++ and Matlab before but never in Python.
I won't do the derivation, but there are plenty of good explanations out there to follow if you're not afraid of a little calculus. Just do a little Googling for "logistic regression derivation." The big idea is to write down the probability of the data given some setting of internal parameters, then to take the derivative, which will tell you how to change the internal parameters to make the data more likely. Got it? Good.
For those of you out there that know logistic regression inside and out, take a look at how short the train() method is. I really like how easy it is to do in Python.
Regularization
I caught a little indirect flak during March madness season for talking about how I regularized the latent vectors in my matrix-factorization model of team offensive and defensive strengths when predicting outcomes in NCAA basketball. Apparently people thought I was talking nonsense -- crazy, right?
But seriously, guys -- regularization is a good idea.
Let me drive home the point. Take a look at the results of running the code (linked at the bottom).
Take a look at the top row.
On the left side, you have the training set. There are 25 examples laid out along the x axis, and the y axis tells you if the example is "on" (1) or "off" (0). For each of these examples, there's a vector describing its attributes that I'm not showing. After training the model, I ask the model to ignore the known training set labels and to estimate the probability that each label is "on" based only on the examples's description vectors and what the model has learned (hopefully things like stronger earthquakes and older buildings increase the likelihood of collapse). The probabilities are shown by the red X's. In the top left, the red X's are right on top of the blue dots, so it is very sure about the labels of the examples, and it's always correct.
Now on the right side, we have some new examples that the model hasn't seen before. This is called the test set. This is essentially the same as the left side, but the model knows nothing about the test set class labels (yellow dots). What you see is that it still does a decent job of predicting the labels, but there are some troubling cases where it is very confident and very wrong. This is known as overfitting.
This is where regularization comes in. As you go down the rows, there is stronger L2 regularization -- or equivalently, pressure on the internal parameters to be zero. This has the effect of reducing the model's certainty. Just because it can perfectly reconstruct the training set doesn't mean that it has everything figured out. You can imagine that if you were relying on this model to make important decisions, it would be desirable to have at least a bit of regularization in there.
And here's the code. It looks long, but most of it is to generate the data and plot the results. The bulk of the work is done in the train() method, which is only three (dense) lines. It requires numpy, scipy, and pylab.
* For full disclosure, I should admit that I generated my random data in a way such that it is susceptible to overfitting, possibly making logistic-regression-without-regularization look worse than it is.
The Python Code
from scipy.optimize.optimize import fmin_cg, fmin_bfgs, fmin
import numpy as np
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x))
class SyntheticClassifierData():
def __init__(self, N, d):
""" Create N instances of d dimensional input vectors and a 1D
class label (-1 or 1). """
means = .05 * np.random.randn(2, d)
self.X_train = np.zeros((N, d))
self.Y_train = np.zeros(N)
for i in range(N):
if np.random.random() > .5:
y = 1
else:
y = 0
self.X_train[i, :] = np.random.random(d) + means[y, :]
self.Y_train[i] = 2.0 * y - 1
self.X_test = np.zeros((N, d))
self.Y_test = np.zeros(N)
for i in range(N):
if np.random.randn() > .5:
y = 1
else:
y = 0
self.X_test[i, :] = np.random.random(d) + means[y, :]
self.Y_test[i] = 2.0 * y - 1
class LogisticRegression():
""" A simple logistic regression model with L2 regularization (zero-mean
Gaussian priors on parameters). """
def __init__(self, x_train=None, y_train=None, x_test=None, y_test=None,
alpha=.1, synthetic=False):
# Set L2 regularization strength
self.alpha = alpha
# Set the data.
self.set_data(x_train, y_train, x_test, y_test)
# Initialize parameters to zero, for lack of a better choice.
self.betas = np.zeros(self.x_train.shape[1])
def negative_lik(self, betas):
return -1 * self.lik(betas)
def lik(self, betas):
""" Likelihood of the data under the current settings of parameters. """
# Data likelihood
l = 0
for i in range(self.n):
l += log(sigmoid(self.y_train[i] *
np.dot(betas, self.x_train[i,:])))
# Prior likelihood
for k in range(1, self.x_train.shape[1]):
l -= (self.alpha / 2.0) * self.betas[k]**2
return l
def train(self):
""" Define the gradient and hand it off to a scipy gradient-based
optimizer. """
# Define the derivative of the likelihood with respect to beta_k.
# Need to multiply by -1 because we will be minimizing.
dB_k = lambda B, k : np.sum([-self.alpha * B[k] +
self.y_train[i] * self.x_train[i, k] *
sigmoid(-self.y_train[i] *
np.dot(B, self.x_train[i,:]))
for i in range(self.n)]) * -1
# The full gradient is just an array of componentwise derivatives
dB = lambda B : np.array([dB_k(B, k)
for k in range(self.x_train.shape[1])])
# Optimize
self.betas = fmin_bfgs(self.negative_lik, self.betas, fprime=dB)
def set_data(self, x_train, y_train, x_test, y_test):
""" Take data that's already been generated. """
self.x_train = x_train
self.y_train = y_train
self.x_test = x_test
self.y_test = y_test
self.n = y_train.shape[0]
def training_reconstruction(self):
p_y1 = np.zeros(self.n)
for i in range(self.n):
p_y1[i] = sigmoid(np.dot(self.betas, self.x_train[i,:]))
return p_y1
def test_predictions(self):
p_y1 = np.zeros(self.n)
for i in range(self.n):
p_y1[i] = sigmoid(np.dot(self.betas, self.x_test[i,:]))
return p_y1
def plot_training_reconstruction(self):
plot(np.arange(self.n), .5 + .5 * self.y_train, 'bo')
plot(np.arange(self.n), self.training_reconstruction(), 'rx')
ylim([-.1, 1.1])
def plot_test_predictions(self):
plot(np.arange(self.n), .5 + .5 * self.y_test, 'yo')
plot(np.arange(self.n), self.test_predictions(), 'rx')
ylim([-.1, 1.1])
if __name__ == "__main__":
from pylab import *
# Create 20 dimensional data set with 25 points -- this will be
# susceptible to overfitting.
data = SyntheticClassifierData(25, 20)
# Run for a variety of regularization strengths
alphas = [0, .001, .01, .1]
for j, a in enumerate(alphas):
# Create a new learner, but use the same data for each run
lr = LogisticRegression(x_train=data.X_train, y_train=data.Y_train,
x_test=data.X_test, y_test=data.Y_test,
alpha=a)
print "Initial likelihood:"
print lr.lik(lr.betas)
# Train the model
lr.train()
# Display execution info
print "Final betas:"
print lr.betas
print "Final lik:"
print lr.lik(lr.betas)
# Plot the results
subplot(len(alphas), 2, 2*j + 1)
lr.plot_training_reconstruction()
ylabel("Alpha=%s" % a)
if j == 0:
title("Training set reconstructions")
subplot(len(alphas), 2, 2*j + 2)
lr.plot_test_predictions()
if j == 0:
title("Test set predictions")
show()