Logistic Multivariate Regression Model in Oracle (How to?)

Hi All,
Is there a way to do a logistic regression and store predicted values back onto the data?  I work in the Healthcare Sector and I need to do some multivariate logistic regression to be able to predict Admission Rates (Dependant Variable) from the Emergency Department given a set of independant/predictor variables such as Age, Gender, Triage Level (1 through 5) and the Charleston Comorbidity Index (Scoring system for categorizing how ill a person is using diagnosis codes).  I went to the following website:
Deep Data Mining Blog: Build a Scorecard in Oracle Using Logistic Regression Model
The author talks about using logistic regarding to scorecard credit card risk but he never really gets into the details on how he did it, ie the SQL Code that he used to input the dependant and predictor variables and such to get the predicted values.  I haven't found much on the internet regarding this.  I'm not a super advanced Oracle user but I am relatively experienced with PL/SQL so all I need is a really simple explanation or snippet of code on how to do this regression.  I'm using Oracle 10g at present. So let us say I have the following 3 Predictor Variables: AGE, GENDER, TRIAGE_LEVEL and the following independant variable ED_ADMISSION_RATE.  How would I do this regression to get the predicted ED Admission Rate?  I realize this is a vary high level approach but I can't think of any other way to explain this so I'm hoping to get some input at least to point me in the right direction.
Any help would be appreciated. 
Thanks,
Ed

Sounds like you need this:
Oracle Advanced Analytics | Oracle Database | Oracle
If one of the included methods does not work, Adv. Analytics allows you to use R scripts... and there are a lot of them.
Also, make sure you read up on the improvements made in 12c.
MK

Similar Messages

  • Oracle Data Mining - How to use PREDICTION function with a regression model

    I've been searching this site for Data Mining Q&A specifically related to prediction function and I wasn't able to find something useful on this topic. So I hope that posting it as a new thread will get useful answers for a beginner in oracle data mining.
    So here is my issue with prediction function:
    Given a table with 17 weeks of sales for a given product, I would like to do a forecast to predict the sales for the week 18th.
    For that let's start preparing the necessary objects and data:
    CREATE TABLE T_SALES
    PURCHASE_WEEK DATE,
    WEEK NUMBER,
    SALES NUMBER
    SET DEFINE OFF;
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('11/27/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 1, 55488);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('12/04/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 2, 78336);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('12/11/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 3, 77248);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('12/18/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 4, 106624);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('12/25/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 5, 104448);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/01/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 6, 90304);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/08/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 7, 44608);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/15/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 8, 95744);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/22/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 9, 129472);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/29/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 10, 110976);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('02/05/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 11, 139264);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('02/12/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 12, 87040);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('02/19/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 13, 47872);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('02/26/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 14, 120768);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('03/05/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 15, 98463.65);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('03/12/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 16, 67455.84);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('3/19/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 17, 100095.66);
    COMMIT;
    There are a lot of linear regression models and approaches for sales forecast out on the market, however I will focus on what oracle 11g offers i.e. package SYS.DBMS_DATA_MINING to create a model using regression as mining function and then, once the model is created, to apply prediction function on the model.
    Therefore I'll have to go through few steps:
    i) normalization of data
    CREATE OR REPLACE VIEW t_sales_norm AS
    SELECT week,
    sales,
    (sales - 91423.95)/27238.3693126778 sales_norm
    FROM t_sales;
    whereas the numerical values are the mean and the standard deviation:
    select avg(sales) from t_sales;
    91423.95
    select stddev(sales) from t_sales;
    27238.3693126778
    ii) auto-correlation. For the sake of simplicity, I will safely assume that there is no auto-correlation (no repetitive pattern in sales among the weeks). Therefore to define the lag data I will consider the whole set:
    CREATE OR REPLACE VIEW t_sales_lag AS
    SELECT a.*
    FROM (SELECT week,
    sales,
    LAG(sales_norm, 1) OVER (ORDER BY week) L1,
    LAG(sales_norm, 2) OVER (ORDER BY week) L2,
    LAG(sales_norm, 3) OVER (ORDER BY week) L3,
    LAG(sales_norm, 4) OVER (ORDER BY week) L4,
    LAG(sales_norm, 5) OVER (ORDER BY week) L5,
    LAG(sales_norm, 6) OVER (ORDER BY week) L6,
    LAG(sales_norm, 7) OVER (ORDER BY week) L7,
    LAG(sales_norm, 8) OVER (ORDER BY week) L8,
    LAG(sales_norm, 9) OVER (ORDER BY week) L9,
    LAG(sales_norm, 10) OVER (ORDER BY week) L10,
    LAG(sales_norm, 11) OVER (ORDER BY week) L11,
    LAG(sales_norm, 12) OVER (ORDER BY week) L12,
    LAG(sales_norm, 13) OVER (ORDER BY week) L13,
    LAG(sales_norm, 14) OVER (ORDER BY week) L14,
    LAG(sales_norm, 15) OVER (ORDER BY week) L15,
    LAG(sales_norm, 16) OVER (ORDER BY week) L16,
    LAG(sales_norm, 17) OVER (ORDER BY week) L17
    FROM t_sales_norm) a;
    iii) choosing the training data. Again, I will choose the whole set of 17 weeks, as for this discussion in not relevant how big should be the set of training data.
    CREATE OR REPLACE VIEW t_sales_train AS
    SELECT week, sales,
    L1, L2, L3, L4, L5, L6, L7, L8, L9, L10,
    L11, L12, L13, L14, L15, L16, L17
    FROM t_sales_lag a
    WHERE week >= 1 AND week <= 17;
    iv) build the model
    -- exec SYS.DBMS_DATA_MINING.DROP_MODEL('t_SVM');
    BEGIN
    sys.DBMS_DATA_MINING.CREATE_MODEL( model_name => 't_SVM',
    mining_function => dbms_data_mining.regression,
    data_table_name => 't_sales_train',
    case_id_column_name => 'week',
    target_column_name => 'sales');
    END;
    v) finally, where I am confused is applying the prediction function against this model and making sense of the results.
    On a search on Google I found 2 ways of applying this function to my case.
    One way is the following:
    SELECT week, sales,
    PREDICTION(t_SVM USING
    LAG(sales,1) OVER (ORDER BY week) as l1,
    LAG(sales,2) OVER (ORDER BY week) as l2,
    LAG(sales,3) OVER (ORDER BY week) as l3,
    LAG(sales,4) OVER (ORDER BY week) as l4,
    LAG(sales,5) OVER (ORDER BY week) as l5,
    LAG(sales,6) OVER (ORDER BY week) as l6,
    LAG(sales,7) OVER (ORDER BY week) as l7,
    LAG(sales,8) OVER (ORDER BY week) as l8,
    LAG(sales,9) OVER (ORDER BY week) as l9,
    LAG(sales,10) OVER (ORDER BY week) as l10,
    LAG(sales,11) OVER (ORDER BY week) as l11,
    LAG(sales,12) OVER (ORDER BY week) as l12,
    LAG(sales,13) OVER (ORDER BY week) as l13,
    LAG(sales,14) OVER (ORDER BY week) as l14,
    LAG(sales,15) OVER (ORDER BY week) as l15,
    LAG(sales,16) OVER (ORDER BY week) as l16,
    LAG(sales,17) OVER (ORDER BY week) as l17
    ) pred
    FROM t_sales a;
    WEEK, SALES, PREDICTION
    1, 55488, 68861.084076412
    2, 78336, 104816.995823913
    3, 77248, 104816.995823913
    4, 106624, 104816.995823913
    As you can see for the first row there is a value of 68861.084 and for the rest of 16 values is always one and the same 104816.995.
    Question: where is my week 18 prediction ? or maybe I should say which one is it ?
    Another way of using prediction even more confusing is against the lag table:
    SELECT week, sales,
    PREDICTION(t_svm USING a.*) pred
    FROM t_sales_lag a;
    WEEK, SALES, PREDICTION
    1, 55488, 68861.084076412
    2, 78336, 75512.3642096908
    3, 77248, 85711.5003385927
    4, 106624, 98160.5009687461
    Each row out of 17, its own 'prediction' result.
    Same question: which one is my week 18th prediction ?
    Thank you very much for all help that you can provide on this matter.
    It is as always highly appreciated.
    Serge F.

    Kindly let me know how to give input to predict the values for example script to create model is as follows
    drop table data_4svm
    drop table svm_settings
    begin
    dbms_data_mining.drop_model('MODEL_SVMR1');
    CREATE TABLE data_4svm (
    id NUMBER,
    a NUMBER,
    b NUMBER
    INSERT INTO data_4svm VALUES (1,0,0);
    INSERT INTO data_4svm VALUES (2,1,1);
    INSERT INTO data_4svm VALUES (3,2,4);
    INSERT INTO data_4svm VALUES (4,3,9);
    commit;
    --setting table
    CREATE TABLE svm_settings
    setting_name VARCHAR2(30),
    setting_value VARCHAR2(30)
    --settings
    BEGIN
    INSERT INTO svm_settings (setting_name, setting_value) VALUES
    (dbms_data_mining.algo_name, dbms_data_mining.algo_support_vector_machines);
    INSERT INTO svm_settings (setting_name, setting_value) VALUES
    (dbms_data_mining.svms_kernel_function, dbms_data_mining.svms_linear);
    INSERT INTO svm_settings (setting_name, setting_value) VALUES
    (dbms_data_mining.svms_active_learning, dbms_data_mining.svms_al_enable);
    COMMIT;
    END;
    --create model
    BEGIN
    DBMS_DATA_MINING.CREATE_MODEL(
    model_name => 'Model_SVMR1',
    mining_function => dbms_data_mining.regression,
    data_table_name => 'data_4svm',
    case_id_column_name => 'ID',
    target_column_name => 'B',
    settings_table_name => 'svm_settings');
    END;
    --to show the out put
    select class, attribute_name, attribute_value, coefficient
    from table(dbms_data_mining.get_model_details_svm('MODEL_SVMR1')) a, table(a.attribute_set) b
    order by abs(coefficient) desc
    -- to get predicted values (Q1)
    SELECT PREDICTION(MODEL_SVMR1 USING *
    ) pred
    FROM data_4svm a;
    Here i am not sure how to predict B values . Please suggest the proper usage . Moreover In GUI (.NET windows form ) how user can give input and system can respond using the Q1

  • SQL Server Excel Add In for Data Mining: How do I retrieve the coefficients underlying the logististic regression model in excel

    I constructed a logistics regression model inside Excel using the Data Mining Add In.  I would like to see the coefficients for each input variable.  I can't seem to find this inside excel.  I tried running queries in DMX inside
    Mgt Studio but that seems to return multiple coefficients
    for each input  variable.  I am seeking
    ONE coefficient for each variable.
    Other applications I have used in the past provided the intercept and one coefficient for each input variable.  Can someone advise on how I can achieve that inside excel or Analysis Services?
    Thanks
    Rich
     

    We have this problem when we install the add-in using an Administrator's login ID.
    The problem is that the add-in automatically registers the Excel add-in. This causes a whole host of problems, including the one you describe (even when we install with the user as the admin on their own machine). Other problems include conflicts with other Add-ins (e.g. nVision) & utlities that import PDF into Excel.
    For our Citrix environment we do the following:
    · Install Essbase Add-In as Administrator
    · Replace “ntuser.dat” file in Default User profile with the “ntuser.dat” file from Administrator’s profile. (Replace C:\Documents and Settings\Default User\NTUSER.DAT with C:\Documents and Settings\Administrator\NTUSER.DAT).
    · Delete existing user profile from the system
    Once user logs back in, a new profile will be created to work with Essbase add-in.
    Note:
    1. 1. NTUSER.DAT file is a hidden file. It is only visible if show hidden file option is enabled
    2. Deleting user profile from the system remove all user customization such as shortcuts, favorites, pst file etc. as well.
    BUG NOTE: When you try to Unregister the Excel Add-in from your Start button, the shortcut points to the wrong file name. The file name should be "unRegExcelAddin.exe"
    I hope this helps.

  • Error in import : tabular model with Oracle

    Hi there,
    I seems to be getting very strange error.
    I am trying to build tabular model over oracle db. I get test successfull for connection, able to validate the query, and in query designer, if i execute it shows me data too. But when i press finish, it gives me error while importing.
    ERROR from import screen
    OLE DB or ODBC error: ORA-01033: ORACLE initialization or shutdown in progress.
    A connection could not be made to the data source with the DataSourceID of '8ffdbfd9-e21f-442d-9040-b66dc074c87d', Name of 'XXXXXXX'.
    An error occurred while processing the partition 'XXX_3fc019fa-4d1a-4d39-9317-3dcde3297579' in table 'XXXXXX'.
    The current operation was cancelled because another operation in the transaction failed.
    I cant figure this out,Even in Execl powerpivot i am able to pull the data in.
    Any idea..TIA
    Rahul Kumar, MCTS, India, http://sqlserversolutions.blogspot.com/

    Hi Rahul,
    Based on my research, for the error “OLE DB or ODBC error: ORA-01033: ORACLE initialization or shutdown in progress.
    A connection could not be made to the data source with the DataSourceID of '8ffdbfd9-e21f-442d-9040-b66dc074c87d', Name of 'XXXXXXX'.”
    It seems that it related to Oracle database, here are some links about how to troubleshoot this issue, please see:
    ERROR - ORA-01033 oracle initialization or shutdown in progress
    ERROR - ORA-01033 oracle initialization or shutdown in progress
    If the issue persists, since I am not an expert on Oracle database, you can post the question on the Oracle forum, so that you can get more help.
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Error in DMSYS.DBMS_JDM_INTERNAL when applying SVM regression model

    Hi,
    I created SVM regression model with case-id column of varchar2(40) and several numeric inputs. When I try to apply the model (even on the same table that was used for training) I am getting
    Server task state: error
    Server task detail:
    ORA-06502: PL/SQL: numeric or value errorORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "DMSYS.DBMS_JDM_INTERNAL", line 387
    ORA-06512: at line 1
    I am using Oracle 10.2.0.1 and Miner 10.2.0.2
    Thanks.

    There is a known bug that causes this issue. It is fixed in 10.2.0.3 database patch release.
    Regards
    Sunil

  • Error when create classification model by Oracle Data Miner 10.1.0.2

    Hello every body!
    Please help me!
    I have created a classification model by Oracle Data Mining 10.1.0.2, Oracle 10g Release 1 (10.1.0.3) with following options:
    Single record per case
    Adaptive Bayes Network algorithms
    SingleFeatureBuild
    When finished, i receive an error with following detail content:
    ORA-40101: Data Mining System Error ODM_ABN_MODEL-ODM_ABN_BUILD--20002
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
    ORA-06512: at "DMSYS.ODM_ABN_MODEL", line 458
    ORA-06512: at "DMSYS.ODM_ABN_MODEL", line 5664
    ORA-40101: Data Mining System Error ODM_ABN_MODEL-ODM_ABN_BUILD--20012
    ORA-06512: at line 1
    Hope you help me!
    Thanks!

    Hi,
    Can you provide instructions that recreate this problem using sample data we provide in the SH schema?
    Thanks, Mark

  • What is the model number and how many ports in the back?

    What is the Model number and how many ports int he back?

    You can compare your yourself here:
    http://www.apple.com/wifi/
    The AirPort Express is Model Number A1394
    The AirPort Extreme is Model Number A1408

  • Fm amd fx  format model in oracle

    hii
    every1 can you please help me in understanding fm amd fx format model in oracle ??
    thanks

    Have you read through this: Format Model Modifiers?
    If so, what specific questions do you have?

  • Infinite Insight Tutorials (not Regression Model)

    Hi,
    I have seen the official SAP Tutorial for creating a Regression model in Infinite Insight, does anybody know if there is anything similar for any ofthe other modules, Explorer, Clustering Model, Association Rules, Social or Recommendation?
    I can't find any, but presume there must be some out these somewhere,
    Thanks
    Howard Stiles

    Hi,
    If you had download the zip file, you also have some pdf included (51047379.zip\DATA_UNITS\SAP_INFINITESIGHT_DOCUMENT\Help\PDF\US).
    All the datasets are avaiables in the folder "Samples" in your install directory : C:\Program Files\SAP InfiniteInsight\WorkstationV6.5.5\Samples. (KAR for association Rule, KSN for social network, etc...)
    You can also find some exercises on the workbook SAP Advanced Analytics on the sap partneredge website, in particular data manipulation with the creation of analytical datasets. (SAP PartnerEdge).
    Hope it helps,
    Edouard

  • TMF SID Model vs Oracle EBO (FP)

    Hi Guys,
    I need some info and difference in the implementation of TMF SID model and Oracle FP(EBO, EBM and EBS) pack.
    Could someone please guide me in right direction.
    Regards
    Edited by: Arpit on Jan 22, 2013 2:55 AM

    Hi Guys,
    Any help on this is really appreciated.
    Regards

  • How to screen capture paper Layout model in oracle reports

    Hi,
    I have several reports and i need to be able to capture paper layout (model) view in pdfs or jpgs for presentation etc. Short of going and doing screen prints, is there an automated/batch way to do that since i have several reports. One path that comes to my mind is the XML route with appropriate style sheet that preserves the pdf look and feel)
    Note that i am not asking to run a report with data which i can do manually, but instead need the layout model in the jpg/gif/pdf formats.
    Thanks,

    Hi
    How do you know that your report server is up and running?
    rgds
    Tony

  • DTM/DGM, how to use a digital ground/terrain model in oracle?

    I got delivered a set of regular spaced (2d) points with height. = DGM
    1)
    My expected use of this is to get an interpolated height at an arbitrary point (which might not be exactly at a point of the DGM/DTM).
    How can I do this?
    2) are there special procedures, datatypes for a regular height model? (not TIN)

    Thanks that sounds great.
    SDO_GEOR.evaluateDouble(
    georaster IN SDO_GEORASTER,
    pyramidLevel IN NUMBER,
    ptGeom IN SDO_GEOMETRY,
    layers IN VARCHAR2,
    interpolationMethod IN VARCHAR2
    ) RETURN SDO_NUMBER_ARRAY;
    Which assumption is correct about using ptGeom?
    a) The interpolation outcome differs on different positions within a single cell.
    b) It doesnt matter where IN a single cell the point ptGeom is. ptGeom is only used to determine which cell is meant. -> Whether the point is in the upper left or lower right of a single cell doesnt matter

  • How to get List of Entailments created on all the models in Oracle.

    Hi,
    I have some Entailments created in Oracle DB. Is there a sql which lists me all the entailments created on all the Models?
    Problem is I dont have name of the Entailments created with me, so i need a way to findout the list of entailments created on my models.
    Thanks and Regards,
    Manish H

    Below queries helped me:
    select * from MDSYS.RDF_MODEL$
    select * from MDSYS.RDF_RULES_INDEX_INFO

  • How to connect data modeler to oracle cloud database DAAS

    using  Version 4.1.0.873
    i believe i read long ago that this was possible
    thanks for your help

    finally found it
    http://www.thatjeffsmith.com/archive/2015/01/uploading-data-to-oracle-schema-as-a-service-using-oracle-sql-developer/
    cheers

  • Issue with Engineer Multidimensional Model from Oracle Model

    Here is the scenario:
    1. Created logical star schema model including a dimension with nested subtypes (SuperTypeEntity1 -> Subtype 1 -> Nested Subtype 2)
    2. Forward engineer to Relational model using Single Table implementation
    3. Create Oracle 11g physical model definitions for the star
    4. Define dimension, levels, and hierarchy in physiclal model
    5. Create new multidimensional model, right click menu and execute "Engineer from Oracle Model"
    Result:
    Model and diagram built with correct dimension, levels, level attributes, hierarchy
    Problem: The entity that the dimension levels are related to is the subtype entity that appears first alphabetically! What it should do is be related to the SuperTypeEntity since I used the Single Table implementation (IMO). I can manually change the property to pick the SuperType but then it loses the assignments for the Level Key and the Descriptive Attributes (which were defined in the physcial miodel) so I have to manually repopulate those properties.
    Associated problem: Since I tend to do things incrementally (define a few dimensions at a time), everytime I re-run the engineering utility, it resets the dimension back to the wrong subtype everytime. (I like the fact that I can rebuild the multidimensional model iteratively to incorporate changes, but in this case it would be nice to "lock in" my manual changes).
    My only work around at this point is to either only run the engineering utility once (which is pretty impractical) or temporarily prefix my super type entity with an "A" so it always comes up first in the list until I am done with all my iterations.

    Hi Kent,
    dimensional model is not well suited to use entity hierarchies.
    I can manually change the property to pick the SuperType but then it loses the assignments for the Level Key and the Descriptive Attributes (which were defined in the physcial miodel) so I have to manually repopulate those properties.It seems all your key and descriptive attributes are in SuperTypeEntity1 (the root of hierarchy). How to proceed if some attributes (key +descriptive) are in subtypes, should SuperType be set as level entity again?
    Philip

Maybe you are looking for