<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How can I perform Machine Learning Modeling (LGBM) using JMP18 Python Script? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-perform-Machine-Learning-Modeling-using-JMP18-Python/m-p/754088#M93618</link>
    <description>&lt;P&gt;Oh... The code 'head()' is woking well after I consider it as a terminal environment not the jupyter notebook!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;y1 = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/y1.csv')
print(y1.head()) &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then I can get the code result from embedded Log!&lt;/P&gt;&lt;P&gt;So I think I can resolve the rest of things as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;   Activity
0         1
1         1
2         1
3         1
4         1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2024 21:56:31 GMT</pubDate>
    <dc:creator>Steve_Kim</dc:creator>
    <dc:date>2024-05-13T21:56:31Z</dc:date>
    <item>
      <title>How can I perform Machine Learning Modeling using JMP18 Python Script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-perform-Machine-Learning-Modeling-using-JMP18-Python/m-p/752565#M93413</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I am working on creating a LightGBM model using a JMP Python script (JMP18).&lt;BR /&gt;My current setup is as follows:&lt;BR /&gt;&amp;nbsp; - X variables: "train1.csv" file, columns D1 through D1776&lt;BR /&gt;&amp;nbsp; - Y variable: "y1.csv" file, "Activity" column&lt;/P&gt;&lt;P&gt;&amp;nbsp; - Prediction target "Activity": "test1.csv" file,&amp;nbsp;columns D1 through D1776&lt;BR /&gt;&amp;nbsp; - Note: Original file "train_original.csv" file, columns Activity through D1776. from Kaggle.com&amp;nbsp;&amp;nbsp;(&lt;A href="https://www.kaggle.com/competitions/bioresponse/data?select=train.csv" target="_blank" rel="noopener"&gt;Predicting a Biological Response)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I would appreciate it if somebody can provide the guidance for the following issues:&lt;BR /&gt;- Cannot perform LightGBM modeling&amp;nbsp; in JMP18 python environment&lt;BR /&gt;&lt;BR /&gt;I've included my JMP Python script below for your reference. See the followings for details.&lt;BR /&gt;Thank you for your time in advance! : )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;import jmp
import jmputils

# update to latest version of pip (Package Installer of python) and setuptools then install numpy &amp;amp; pandas
jmputils.jpip('install --upgrade', 'pip setuptools')
jmputils.jpip('install', 'pandas numpy scikit-learn keras lightgbm')

# Import package
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)



# Load data
train1 = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/train1.csv')
y1 = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/y1.csv')
test1 = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/test1.csv')

train1.head() # No Result in JMP, but it's okay.&amp;nbsp;It's fine to open the datatable using 'jmp.open'
y1.head() # No Result in JMP, but it's okay. It's fine to open the datatable using 'jmp.open'

# train1 = jmp.open('D:/steve.kim/Kaggle/BI Biological Response/train1.csv')
# y1 = jmp.open('D:/steve.kim/Kaggle/BI Biological Response/y1.csv')



# 01 Modeling training - Library import
from lightgbm import LGBMClassifier

# 02 Modeling training - LGBM Baseline model without hyperparameter tuning
lgb = LGBMClassifier()

# 03 Modeling training - define X (factors) and Y (responses) variables
lgb.fit(train1, y1) #&amp;nbsp;lightgbm.basic.LightGBMError: Length of labels differs from the length of #data

# 04 Predict
predslgb = lgb.predict_proba(test1)&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 04:26:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-perform-Machine-Learning-Modeling-using-JMP18-Python/m-p/752565#M93413</guid>
      <dc:creator>Steve_Kim</dc:creator>
      <dc:date>2024-05-14T04:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can I perform Machine Learning Modeling (LGBM) using JMP18 Python Script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-perform-Machine-Learning-Modeling-using-JMP18-Python/m-p/754088#M93618</link>
      <description>&lt;P&gt;Oh... The code 'head()' is woking well after I consider it as a terminal environment not the jupyter notebook!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;y1 = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/y1.csv')
print(y1.head()) &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then I can get the code result from embedded Log!&lt;/P&gt;&lt;P&gt;So I think I can resolve the rest of things as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;   Activity
0         1
1         1
2         1
3         1
4         1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 21:56:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-perform-Machine-Learning-Modeling-using-JMP18-Python/m-p/754088#M93618</guid>
      <dc:creator>Steve_Kim</dc:creator>
      <dc:date>2024-05-13T21:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I perform Machine Learning Modelingusing JMP18 Python Script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-perform-Machine-Learning-Modeling-using-JMP18-Python/m-p/754129#M93624</link>
      <description>&lt;P&gt;&amp;lt;Shelf Answer&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry about this question!&lt;/P&gt;&lt;P&gt;The python pandas and lightGBM are working well in JMP18 python script! : )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;import jmp
import jmputils

# update to latest version of pip (Package Installer of python) and setuptools then install numpy &amp;amp; pandas
jmputils.jpip('install --upgrade', 'pip setuptools')
jmputils.jpip('install', 'pandas numpy scikit-learn keras lightgbm')

# Checking package version
jmputils.jpip('list')


# Import package
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

# Any results you write to the current directory are saved as output.
import os
print (os.listdir("D:/steve.kim/Kaggle/BI Biological Response"))

# Load data
train_x = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/train_x.csv')
print(train_x.head())

train_y = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/train_y.csv')
print(train_y.head())  

test_x = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/test_x.csv')
print(test_x)


# Modeling
from lightgbm import LGBMClassifier  
lgb = LGBMClassifier(colsample_bytree=0.6, subsample=0.8)
lgb.fit(train_x, train_y)
preds_lgb = lgb.predict_proba(test_x)

sub_lgb = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/test_y.csv')
sub_lgb["Activity"] = preds_lgb[:,1]
print(sub_lgb.head())
test_answer = pd.read_csv('D:/steve.kim/Kaggle/BI Biological Response/test_answer.csv')

# Evaluation
from sklearn.metrics import mean_absolute_error, mean_squared_error, mean_absolute_percentage_error
print('LightGBM MAE')
print(mean_absolute_error(test_answer, sub_lgb))
print('LightGBM MSE')
print(mean_squared_error(test_answer, sub_lgb))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;Shelf&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 04:13:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-perform-Machine-Learning-Modeling-using-JMP18-Python/m-p/754129#M93624</guid>
      <dc:creator>Steve_Kim</dc:creator>
      <dc:date>2024-05-14T04:13:39Z</dc:date>
    </item>
  </channel>
</rss>

