Showing posts with label variables. Show all posts
Showing posts with label variables. Show all posts

Wednesday, March 28, 2012

'Loosing' input variables

Hi,

Excuse me for the 'noobish' question but it seems in my mining models, i am 'loosing' input variables. I am using the Microsoft Decision Tree algorithm and eventhough i have set 4 variables as 'input' and all 4 of them are in my mining structure, the model is using only 3. That 4th variable is also missing from the dependency network graph. Can anyone help me solve this problem?

An input attribute might not be used for a split in Decision Tree if the input has a low correlation to the output. Try changing the algorithm parameter COMPLEXITY_PENALTY to increase the number of splits and see if the additional input shows up in the tree.

Another possible factor might be the MINIMUM_SUPPORT parameter. In some cases, a attribute used to split a tree at a level might result in leaf nodes with support less than MINIMUM_SUPPORT. Try decreasing this parameter along with the first change and see if this is the case.

|||

You're not "losing" it - the algorithm simply isn't finding that it is relevant. This could be for a couple of reasons:

1: It's not relevant - it has no relationship to the target variable

2: It is relevant, but it closely correlated to another input. Say for instance you were trying to predict "Will Buy Glasses" and had two input variables, among others, "Has Poor Eyesight" and "Currently Wears Glasses". Say again, that it happens to be that almost everyone with poor eyesight already wears glasses. Now assume the tree splits on "Has Poor Eyesight". Now you have two sub-populations where one has "Has Poor Eyesight" = true and the other "Has Poor Eyesight" = false. Since "Has Poor Eyesight" and "Will Buy Glasses" are so highly correlated, there is no differentiation in "Will Buy Glasses" in either sub-population, and nothing for the tree to further split on.

One way to find if your fourth variable has any impact on your target is to create a Naive Bayes model where all attributes are treated independently and you don't have the "sub-population" behavior.

sql

Friday, March 23, 2012

Loop...

Can someone please tell me if it is possible to create variables dynamically
or with the use of a loop and if so how...
I have the following SQL statement and would like to cut down the number of
variables by using some kind of loop to generate the variables and update
statement!
Thanks...
CREATE PROCEDURE dbo.MenuUpdate
(
@.ItemID Int,
@.Date SmallDateTime,
@.mItem1 nvarchar (255),
@.mItem2 nvarchar (255),
@.mItem3 nvarchar (255),
@.mItem4 nvarchar (255),
@.mItem5 nvarchar (255),
@.mItem6 nvarchar (255),
@.mItem7 nvarchar (255),
@.mItem8 nvarchar (255),
@.mItem9 nvarchar (255),
@.mItem10 nvarchar (255),
@.mPrice1 nvarchar (255),
@.mPrice2 nvarchar (255),
@.mPrice3 nvarchar (255),
@.mPrice4 nvarchar (255),
@.mPrice5 nvarchar (255),
@.mPrice6 nvarchar (255),
@.mPrice7 nvarchar (255),
@.mPrice8 nvarchar (255),
@.mPrice9 nvarchar (255),
@.mPrice10 nvarchar (255)
)
AS
UPDATE tblRestaurant
SET
DateCreated = @.Date,
MenuItem = @.mItem1,
ItemPrice = @.mPrice1
WHERE itemID = @.itemID
GOHave a look at
http://www.sommarskog.se/arrays-in-sql.html
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Tim::.." <myatix_at_hotmail.com> wrote in message
news:099D2D78-9B32-4EE0-AB1C-103A828F8E54@.microsoft.com...
> Can someone please tell me if it is possible to create variables
> dynamically
> or with the use of a loop and if so how...
> I have the following SQL statement and would like to cut down the number
> of
> variables by using some kind of loop to generate the variables and update
> statement!
> Thanks...
>
> CREATE PROCEDURE dbo.MenuUpdate
> (
> @.ItemID Int,
> @.Date SmallDateTime,
> @.mItem1 nvarchar (255),
> @.mItem2 nvarchar (255),
> @.mItem3 nvarchar (255),
> @.mItem4 nvarchar (255),
> @.mItem5 nvarchar (255),
> @.mItem6 nvarchar (255),
> @.mItem7 nvarchar (255),
> @.mItem8 nvarchar (255),
> @.mItem9 nvarchar (255),
> @.mItem10 nvarchar (255),
> @.mPrice1 nvarchar (255),
> @.mPrice2 nvarchar (255),
> @.mPrice3 nvarchar (255),
> @.mPrice4 nvarchar (255),
> @.mPrice5 nvarchar (255),
> @.mPrice6 nvarchar (255),
> @.mPrice7 nvarchar (255),
> @.mPrice8 nvarchar (255),
> @.mPrice9 nvarchar (255),
> @.mPrice10 nvarchar (255)
> )
> AS
> UPDATE tblRestaurant
> SET
> DateCreated = @.Date,
> MenuItem = @.mItem1,
> ItemPrice = @.mPrice1
> WHERE itemID = @.itemID
> GO
>|||OK...
That just blew my mind...
Is there not a way of just adding a loop in a sp or something to generate
the parameters and Update statemet?
Thanks anyway...
"Roji. P. Thomas" wrote:

> Have a look at
> http://www.sommarskog.se/arrays-in-sql.html
> --
> Roji. P. Thomas
> Net Asset Management
> https://www.netassetmanagement.com
>
> "Tim::.." <myatix_at_hotmail.com> wrote in message
> news:099D2D78-9B32-4EE0-AB1C-103A828F8E54@.microsoft.com...
>
>|||>Is there not a way of just adding a loop in a sp or something to generate
>the parameters
It seems that you are passing the values for these parameters from your
client application.
Then how can you just loop inside the SP and get the values?
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Tim::.." <myatix_at_hotmail.com> wrote in message
news:BCADDEAA-5591-4D1F-81FD-C83AC4D2DAA9@.microsoft.com...
> OK...
> That just blew my mind...
> Is there not a way of just adding a loop in a sp or something to generate
> the parameters and Update statemet?
> Thanks anyway...
>
> "Roji. P. Thomas" wrote:
>|||No. I know, this can be frustrating sometimes when you're used to working in
a Real programming language, declaring variables on the fly, arrays and
loops.
But SQL server is not a programming language.
Use the techniques in the link Roji told you.
I use the Iterative Method in a few procedures.
A bit of work the first time you use it but the second time around will be a
lot easier.
In the example you give you would have only 3 or 4 parameters (depending on
how you set it up) and 1 update statement.
And you could pass as many or as few mItem/mPrice as you want and the
procedure would handle it.
"Tim::.." <myatix_at_hotmail.com> wrote in message
news:BCADDEAA-5591-4D1F-81FD-C83AC4D2DAA9@.microsoft.com...
> OK...
> That just blew my mind...
> Is there not a way of just adding a loop in a sp or something to generate
> the parameters and Update statemet?
> Thanks anyway...
>
> "Roji. P. Thomas" wrote:
>|||> Is there not a way of just adding a loop in a sp or something to generate
> the parameters and Update statemet?
No. You can create a function, once, to deal with this, and you shouldn't
have to think hard about it again. I have one for integers and one for
varchar listed at http://www.aspfaq.com/2248 .. they couldn't be much easier
to use.