Question 1 | MCQ
THIS IS QUESTION PAPER FOR THE SUBJECT "DEGREE LEVEL : DATA SCIENCE AND AI LAB (COMPUTER BASED EXAM)"
ARE YOU SURE YOU HAVE TO WRITE EXAM FOR THIS SUBJECT?
CROSS CHECK YOUR HALL TICKET TO CONFIRM THE SUBJECTS TO BE WRITTEN.
(IF IT IS NOT THE CORRECT SUBJECT, PLS CHECK THE SECTION AT THE TOP FOR THE SUBJECTS REGISTERED BY YOU)
ARE YOU SURE YOU HAVE TO WRITE EXAM FOR THIS SUBJECT?
CROSS CHECK YOUR HALL TICKET TO CONFIRM THE SUBJECTS TO BE WRITTEN.
(IF IT IS NOT THE CORRECT SUBJECT, PLS CHECK THE SECTION AT THE TOP FOR THE SUBJECTS REGISTERED BY YOU)
Solution
In text generation with GPT-2, what effect does increasing the temperature parameter generally have?
Solution
Solution
Fill in the missing function call to correctly compile and execute the LangGraph workflow.
graph = StateGraph()
# ... add nodes and edges ...
app = graph.________() output = app.________({"query": "What is LangGraph?"})
graph = StateGraph()
# ... add nodes and edges ...
app = graph.________() output = app.________({"query": "What is LangGraph?"})
Solution
In LangGraph, which of the following statements correctly describe the role of State? (Select all that apply)
Solution
What does the following line do?
x = x.to('cuda')
x = x.to('cuda')
Solution
You are training a neural network using PyTorch. The following code blocks are parts of a typical training loop. Arrange them in the correct order to form a valid training loop for one epoch. Make necessary assumptions and choose the correct option
(A) outputs = model(inputs) loss = criterion(outputs, labels)
(B) optimizer.step()
(C) for inputs, labels in dataloader:
(D) loss.backward()
(E) optimizer.zero_grad()
(A) outputs = model(inputs) loss = criterion(outputs, labels)
(B) optimizer.step()
(C) for inputs, labels in dataloader:
(D) loss.backward()
(E) optimizer.zero_grad()
Solution
Solution
When performing gradient accumulation in PyTorch, which of the following statements are true?
Solution
Solution
Solution
The parent node of a decision tree P has 50 samples belonging to class A and 50 samples belonging to class B from a total of 100 samples. After the split at node P, the left child L has the 50 points belonging to class B and the right child R has the 50 points belonging to class A.
What is the absolute value of Entropy(P) - (Entropy(L) + Entropy(R)) ?
What is the absolute value of Entropy(P) - (Entropy(L) + Entropy(R)) ?
Solution
What will this code retrieve?
vectorstore = FAISS.from_documents(chunks, embedding_model) results = vectorstore.similarity_search("product launch", k=3) print(type(results[0]))
vectorstore = FAISS.from_documents(chunks, embedding_model) results = vectorstore.similarity_search("product launch", k=3) print(type(results[0]))
Solution
A dataset df contains 20000 rows and 7 columns. The columns are named id, road_type, num_lanes, weather, speed_limit, area and public.
The number of unique values taken by the columns are as follows: id - 20000, road_type - 4, num_lanes - 4, weather - 3, speed_limit - 25, area - 30, public - 2.The following transformations were done on the dataset.
df = df.drop(columns=['id'])
encoder = ColumnTransformer( transformers=[
('road_type', OneHotEncoder(drop = None, handle_unknown='ignore'), ['road_type']),
('weather', OneHotEncoder(drop = None, handle_unknown='ignore'), ['weather']),
('area', OrdinalEncoder(handle_unknown="use_encoded_value",unknown_value=100), ['area'])
], remainder='passthrough'
)
X_encoded = encoder.fit_transform(df)
How many columns are present in the dataset X_encoded?
The number of unique values taken by the columns are as follows: id - 20000, road_type - 4, num_lanes - 4, weather - 3, speed_limit - 25, area - 30, public - 2.The following transformations were done on the dataset.
df = df.drop(columns=['id'])
encoder = ColumnTransformer( transformers=[
('road_type', OneHotEncoder(drop = None, handle_unknown='ignore'), ['road_type']),
('weather', OneHotEncoder(drop = None, handle_unknown='ignore'), ['weather']),
('area', OrdinalEncoder(handle_unknown="use_encoded_value",unknown_value=100), ['area'])
], remainder='passthrough'
)
X_encoded = encoder.fit_transform(df)
How many columns are present in the dataset X_encoded?
Solution
What is the output of the following snippet of code?
import numpy as np
A = np.array([
[1, 5, 9],
[10, 2, 1],
[0, 2, 3]
]) array_sum = A.sum(axis=1) print(array_sum)
import numpy as np
A = np.array([
[1, 5, 9],
[10, 2, 1],
[0, 2, 3]
]) array_sum = A.sum(axis=1) print(array_sum)
Solution
Solution
x and y are 1D NumPy arrays, that is, x.ndim = 1 and y.ndim = 1. Also, x.shape == y.shape. What would happen if we run x @ y?
Solution
You are working with two datasets and trying to combine them to get two columns in the combined_dataset using the following code:
from datasets import concatenate_datasets, load_dataset
ds1 = load_dataset("imdb", split="train[:4000]") ds2 = load_dataset("csv", data_files="reviews.csv")
combined_dataset = concatenate_datasets([ds1, ds2])
Assume the following:
The ds1 dataset has columns: text (string), label (int).
The ds2 dataset has columns: review (string), sentiment (int).
from datasets import concatenate_datasets, load_dataset
ds1 = load_dataset("imdb", split="train[:4000]") ds2 = load_dataset("csv", data_files="reviews.csv")
combined_dataset = concatenate_datasets([ds1, ds2])
Assume the following:
The ds1 dataset has columns: text (string), label (int).
The ds2 dataset has columns: review (string), sentiment (int).
Solution
You need to add a new column char_count, representing the character count of the text column in your dataset. Which of the following code snippets will achieve this using the .map() method?
Solution
You notice your RAG system returns irrelevant results. Which change might help?
# Current setup splitter = RecursiveCharacterTextSplitter(chunk_size=5000, chunk_overlap=500)
retriever = vectorstore.as_retriever(search_kwargs={"k": 1})
# Current setup splitter = RecursiveCharacterTextSplitter(chunk_size=5000, chunk_overlap=500)
retriever = vectorstore.as_retriever(search_kwargs={"k": 1})
Solution
What will be the output of the following code?
from langchain_text_splitters import RecursiveCharacterTextSplitter text = "Hello world. How are you? I am fine." splitter = RecursiveCharacterTextSplitter(chunk_size=15, chunk_overlap=5) chunks = splitter.split_text(text) print(len(chunks))
from langchain_text_splitters import RecursiveCharacterTextSplitter text = "Hello world. How are you? I am fine." splitter = RecursiveCharacterTextSplitter(chunk_size=15, chunk_overlap=5) chunks = splitter.split_text(text) print(len(chunks))
Solution
In a standard 8-bit grayscale image, what pixel values typically represent pure black and pure white, respectively?
Solution
How is a standard color (RGB) image typically represented as a NumPy array?
Solution
Which of the following statements regarding Data Augmentation are correct?
Solution
What is the main difference between PIL.Image.open() and cv2.imread() when loading a color image?
Solution
Shape
Thickness [ / ]
3
All colors