2. Write R and python code to replace “bcz” with “because” in whole text? Answer: • R code: #In R Sub() function can be used to find the text and with help of gsub(), text can be replaced: test <- "high five to edwisor bcz they are doing good work" gsub("bcz", "because", test) (PS: I HAVE ATTACHED SEPARATE R CODE FILE.) • Python Code: In Python same can be achieved by using string.replace() function. our_str = ‘Bcz i love bollywood’ import string new_str = str.replace(our_str, 'Bcz', 'Because') print(new_str)
(PS: I HAVE ATTACHED SEPARATE PYTHON CODE FILE.) 3. How do you deal with the English text having Hindi words in between? Answer: There are two ways to treat Hindi text between English words: Translate the Hindi Words to English: Lookup all the words in English dictionary and tag them such as Remove the Hindi Words: Using the words corpus from NLTK ( The Natural Language Toolkit). 4. Write R code to connect with this public API - Answer: Create a account on to get the api key Library(httr) Query <- Out<- GET(url=Query) 5. What are the different methods to deploy a model into production system? ANSWER: • Before deploying any models into productions, we should consider following points: I. What are my requirements? (i.e. how many requests are you expecting per second, what latency is required…etc) II. How will I evaluate the model’s performance in production? (and how will I collect and store the additional data from interactions) III. How frequently do I plan on re-training my model? IV. What are the data pre-processing needs? V. Will the format of the production input data differ drastically from the model training data? Will it come in batches or as a stream? VI. Does the model need to be able to run offline? • Broadly the methods can be categorized into two: I. Online deployment models: Data mining tools like RevoDeployR or Orange or using Web framework. II. Offline deployment Modes: a. Programming language like Java,C, VB. b. Database and SQL scripts. c. Predictive model mark-up language. d. Schedulers.
You've reached the end of your free preview.
Want to read both pages?