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?"})
6406535953823.
connect(), execute()
6406535953824.
run(), output()
6406535953825.
setup(), call()
6406535953826.
compile(), invoke()
A published solution is not available for this question yet.
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()
6406535953835.
(C) → (E) → (A) → (D) → (B)
6406535953836.
(C) → (B) → (E) → (A) → (D)
6406535953837.
(E) → (C) → (A) → (B) → (D)
6406535953838.
(C) → (E) → (A) → (B) → (D)
A published solution is not available for this question yet.
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)) ?
A published solution is not available for this question yet.
What will this code retrieve?
vectorstore = FAISS.from_documents(chunks, embedding_model)
results = vectorstore.similarity_search("product launch", k=3)
print(type(results[0]))
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?
A published solution is not available for this question yet.
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)
6406535953858.
[15, 13, 5]
6406535953859.
[11, 9, 13]
6406535953860.
33
6406535953861.
[9, 10, 3]
A published solution is not available for this question yet.
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).
6406535953870.
The combined dataset will automatically align the columns and combine rows
successfully.
6406535953871.
To combine the datasets, you must align the column names using
.rename_column() or .map().
6406535953872.
The concatenate_datasets() function requires both datasets to have the same split
names.
6406535953873.
Both datasets must have the same schema (column names and types) to be
concatenated.
6406535953874.
The concatenate_datasets() function modifies ds1 and ds2 in place.
A published solution is not available for this question yet.
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?
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})
6406535953879.
Increase k to 5 to get more context.
6406535953880.
Decrease chunk_size to 500 for more focused chunks.
6406535953881.
Remove chunk_overlap completely.
A published solution is not available for this question yet.
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))
A published solution is not available for this question yet.