The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Running python in Rapid Miner
There is something that is not clicking with my understanding and I hope you can help. I am fully able to run the code inside of Google Colab and directly inside of Python, however I can never get my code to work in Rapid Miner. There is something I am just not getting. Why is it saying to me that "rm_main(data):" is missing when it is clearly in the script?
What function does rm_main(data): fulfil and why must it be there?
I have attached a sample of my code, please explain where I am going wrong and what I am not understanding.
Thank you!
What function does rm_main(data): fulfil and why must it be there?
I have attached a sample of my code, please explain where I am going wrong and what I am not understanding.
Thank you!
<?xml version="1.0" encoding="UTF-8"?><process version="9.7.002"> <context> <input/> <output/> <macros/> </context> <operator activated="true" class="process" compatibility="9.4.000" expanded="true" name="Process" origin="GENERATED_TUTORIAL"> <parameter key="logverbosity" value="init"/> <parameter key="random_seed" value="2001"/> <parameter key="send_mail" value="never"/> <parameter key="notification_email" value=""/> <parameter key="process_duration_for_mail" value="30"/> <parameter key="encoding" value="SYSTEM"/> <process expanded="true"> <operator activated="true" class="python_scripting:execute_python" compatibility="9.8.000" expanded="true" height="82" name="Execute Python" width="90" x="112" y="238"> <parameter key="script" value="import pandas def rm_main(data): 		API_KEY = '' 		API_SECRET = '' 		API_URL = 'https://api.receptiviti.com/v1/score' 		 		 		TEXT_SAMPLES = ['"To excel and lead in an established organization that provides a technically stimulating and learning environment, and to actively participate in organizational development by giving my best input, through team work and optimum utilization of available resources in order to harvest advantages for the organization. Specialties: -IBM Certified Solution Designer - Object Oriented Analysis and Design, vUML 2 -IBM Certified Advanced Application Developer-Lotus Notes and Domino 6/6.5 -IBM Certified Advanced Instructor for Lotus Notes Domino 6/6.5 Application Development - analysis and design, database design, prototyping, customer support, Java, Oracle, Lotus Script, MS SQL Server, UML, PL/SQL, OO Telecommunication: Interconnect, Optimized Routing, Roaming I am responsible for analysis and design of business requirements through interaction with the Business Architects, Technical Architects, and Product Management. Part of my role is to produce the requirement specification documents for the developers, testers, and technical writers. I conduct workshops with the team in order for them to understand the requirements; this includes presenting the business requirements and the technical solution. One of my key roles is to support the Software Development Managers during planning, software development and testing by giving my input to help making them decisions. I also look after the support issues logged by the testers and customers. I help new and junior team members understanding the product design. Being a senior analyst, my role is to take initiatives and identify areas in the processes and product that need improvement and can be made more efficient for better productivity. I demonstrate the software to the teams within the organization and have presented our work to customers occasionally. Java, J2EE and Lotus Notes Developer My sole responsibilities included analysis, design and development of J2EE and Domino based office automation/ERP Solutions. I actively participated in creating Software Projects Proposal documents for companies. I also conducted client trainings and demonstrations for the understanding of deployed modules. I worked in J2EE Java technology to automate ministries of Pakistan. I also worked as an Associate Developer for trouble- shooting, support and mentoring of Domino based Virtual Office suite of LMKR installed on their Domino cluster. Taught Internet Programming Using Java at Post Graduate Level It was a pleasant experience working with Rushda at CSG. She is a good listener and a team player. She is calm and her approach towards testing software is quite interactive. She approaches developers, analysts and other stakeholders if more information is required. She is a quick leaner and I appreciate her contribution towards delivering the MVP of our reporting platform through manual and automated testing. Shanti is a very friendly, cooperative, technical, and a hardworking individual. She is a team player who listens very carefully to the team\'s objectives and leads the team from the front. What I loved about working with Shanti was her ability to analyse a task in hand, do research about the unknowns in a collaborative manner and present it back. Although I worked in Cape Town, she worked from Italy, the distance was never an issue. She has the technology, communication skills and the right approach to work with the team remotely and face-to-face. I highly recommend Shanti and I have full belief that team receiving her a team member will grow and strengthen further. Hardworking, thorough, pro-active and team player are the words that come to my mind when I think about Carolyn. Her approach towards understanding the domain, software and the business makes it fun to work with her. She has excellent writing abilities, her verbal communication skills are no less. It is always a pleasure to be in her company because she continuously polishes her skills by studying more about her field of interest i.e. writing and reading. So when she says something, you know it is with complete authority and background research. She indeed is a senior team player who doesn\'t only want to documentation work get done, but also the software to get better from the end-user point of view. She quickly becomes indispensable to a team and I would love to be part of a team where she is the technical writer. Jackie is a person of many qualities. As an HR person, she engages with employees at personal level. Extremely helpful and always smiling no matter what. She listens to people carefully, smiles with them, shares their happy and sad moments and gives advice or guidance. During her stay in CSG International, I knew I could rely on her at any time. I wish her best of luck for her future endeavors, she is a person who would fit into any organization easily... she wins people\'s hearts. You are definitely missed at CSG... A very friendly person who is popular in his peers and colleagues. Keeps the team very lively. A hardworking guy in my observation who likes to completes his tasks not only on time, but with full focus and dedication so that the best outcome can be achieved for the customers and the organisation. He always likes to aim high and sets high standards for bringing growth to the company. Ryan is a friendly and hardworking team player who is willing to take the challenge when thrown in deep end. As a System Analyst, I have always seen Ryan reviewing my SRSs thoroughly to improve the quality of the product. As a tester, Ryan works hard on the tasks in hand, he is not shy to ask questions and help improving the product. The best thing I like about Ryan is his ever smiling face, he is very cooperative, he is a people\'s person and very well known figure in our company. I will not hesitate Ryan to any company who is looking for a hardworking tester or even an analyst Cooperation, collaboration, friendliness and patience are among many qualities Shahan possess. I found Shahan to be a professional who always focused towards customer and quality. He was patient towards customer queries and expert in handling critical situations. I found Shahan to be reliable and hardworking during several projects we did for various clients. Shahan likes to analyse the situation and gather complete requirements in order to serve customers better. I found that our manager always trusted Shahan with major projects in our company. I highly recommend Shahan to anyone who is searching for a talented and dedicated resource. This is my baby sister, who is an artist. She has a shop now on Etsy where she sells her art work. If you are keen, please go ahead and have a look. The art work, once purchased, can be printed. In case you didn\'t know, three mountaineers went to K-2 a few weeks back to climb it in winter conditions. Three friends, a Pakistani, Chilien and an Icelandic. They made it to the summit but something went wrong on the way back. One of the biggest search operation in the history was conducted by the three countries but they didn\'t find them. Rest in Peace Ali, John and Juan...You are forever part of K-2..."'] 		SINGLE_TEXT_SAMPLE = ' '.join(TEXT_SAMPLES) 		print(data) 		print(SINGLE_TEXT_SAMPLE)		 		import sys 		import json 		import requests 	 		def get_payload_and_url(text): 		 if len(text)<1: 		 print("ERROR: 'text' should not be empty") 		 return {} 		 if isinstance(text, str): 		 return ({ 		 "content": text 		 }, API_URL) 		 if isinstance(text, list): 		 return ([{ 		 "content": content 		 } for content in text], API_URL + '/bulk') 		 		def call_receptiviti_api(text): 		 payload, url = get_payload_and_url(text) 		 results = [] 		 if len(payload)>0: 		 response = requests.post(url, data=json.dumps(payload), auth=(API_KEY, API_SECRET), headers = {'Content-Type': 'application/json'}) 		 if response.status_code==200: 		 results = response.json() 		 return results 		 		# print out the results 		print("Single Call to Receptiviti API") 		single_result = call_receptiviti_api(SINGLE_TEXT_SAMPLE) 		display(single_result) 		 		 		 		# connect 2 output ports to see the results 		return data"/> <parameter key="notebook_cell_tag_filter" value=""/> <parameter key="use_default_python" value="true"/> <parameter key="package_manager" value="conda (anaconda)"/> <parameter key="use_macros" value="false"/> </operator> <connect from_op="Execute Python" from_port="output 1" to_port="result 1"/> <portSpacing port="source_input 1" spacing="0"/> <portSpacing port="sink_result 1" spacing="0"/> <portSpacing port="sink_result 2" spacing="0"/> </process> </operator> </process>
0
Best Answer
-
MarcoBarradas Administrator, Employee-RapidMiner, RapidMiner Certified Analyst, Member Posts: 272 UnicornHi @Robi_Me in the rm_main(data) the function is expecting you to deliver a DataSet to the example set port of the python operator. If you are not delivering data to this operator you only need to declare the function in the following way.
rm_main():2