How to call python in matlab?

조회 수: 1 (최근 30일)
slevin Lee
slevin Lee 2022년 10월 26일
답변: surya venu 2024년 7월 18일
I want to use the SymbolicTransformer function of python GPlearn
Like this sentence~
function_set = ['add', 'sub', 'mul', 'div', 'log', 'sqrt', 'abs', 'neg', 'max', 'min']
gp1 = SymbolicTransformer(generations=10, population_size=1000,
hall_of_fame=100, n_components=10,
function_set=function_set,
parsimony_coefficient=0.0005,
max_samples=0.9, verbose=1,
random_state=0, n_jobs=3)
How to input in matlab?
  댓글 수: 2
Alex Hanes
Alex Hanes 2022년 10월 26일
Look at the documentation: Call Python from MATLAB and the related links. There are Examples that show you how to get started.
slevin Lee
slevin Lee 2022년 10월 26일
I know that matlab can call user-defined py files, but can it call third-party python libraries?

댓글을 달려면 로그인하십시오.

답변 (1개)

surya venu
surya venu 2024년 7월 18일
Hi,
You can call third-party Python libraries by adding 3-p libraries as suffuix to "py" command.
Here are some example MATLAB codes:
>> py.numpy.array([12 12])
>> py.time.sleep(1)
>> py.tensorflow.constant(3, dtype=py.tensorflow.int32)
>> py.gplearn.genetic.SymbolicRegressor(...)
Hope it helps.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by