Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 9.3, Problem 5E
Program Plan Intro
To describe a linear-time
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Appendix A
10-Fold Cross Validation for Parameter Selection
Cross Validation is the standard method for evaluation in empirical machine learning. It can also be used
for parameter selection if we make sure to use the training set only.
To select parameter A of algorithm A(X) over an enumerated range d E [A1,..., A] using dataset D, we do
the following:
1. Split the data D into 10 disjoint folds.
2. For each value of A e (A1,..., Ar]:
(a) For i = 1 to 10
Train A(A) on all folds but ith fold
Test on ith fold and record the error on fold i
(b) Compute the average performance of A on the 10 folds.
3. Pick the value of A with the best average performance
Now, in the above, D only includes the training data and the parameter A is chosen without the knowledge
of the test data. We then re-train on the entire train set D using the chosen A and evaluate the result on
the test set.
Algorithm for LLP-GAN training algorithmInput: The training set L = {(Bi, pi)}n i=1; L: number of total iterations; λ: weight parameter.Input: The parameters of the final discriminator D.Set m to the total number of training data points
2. Use the rbinom() function to generate a random sample of size N = 50 from the bino-
mial distribution Binomial(n, p), with n
6 and p = 0.3. Note that this distribution
has mean u = np and standard deviation o =
Vnp(1 – p). Record the obtained sample
as a vector v. Repeat the tasks of Problem 1 for the sample v.
Chapter 9 Solutions
Introduction to Algorithms
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- A bottle factory produces bottles of equal mass. During a production, the weight of one of the bottles is set incorrectly. The factory scale will be used to find this bottle. Design a decrease-andconquer algorithm which finds the that bottle. Analyze the worst-case, best-case and average-case complexities of your algorithm. Explain your algorithm.arrow_forwardWe have considered, in the context of a randomized algorithm for 2SAT, a random walk with a completely reflecting boundary at 0—that is, whenever position 0 is reached, with probability 1 we move to position 1 at the next turn. Consider now a random walk with a partially reflecting boundary at 0– whenever position 0 is reached, with probability 1/4 we move to position 1 at the next turn, and with probability 3/4 we stay at 0. Everywhere else the random walk either moves up or down 1, each with probability 1/2. Find the expected number of moves to reach n starting from position i using a random walk with a partially reflecting boundary. (You may assume there is a unique solution to this problem, as a function of n and i; you should prove that your solution satisfies the appropriate recurrence.)arrow_forwardProcedure 1 (Local Search(y) with depth δ) t := 1.While t ≤ δ and ∃z : (H(z,y)=1 and f(z) > f(y)) do y := z. t := t + 1.If there is more than one Hamming neighbor with larger fitness, z may be chosen arbitrarily among them.Algorithm 1 ((1+1) Memetic Algorithm ((1+1) MA)) write correct algorithm otherwise you will get downvote.arrow_forward
- Procedure 1 (Local Search(y) with depth δ) t := 1.While t ≤ δ and ∃z : (H(z,y)=1 and f(z) > f(y)) do y := z. t := t + 1.If there is more than one Hamming neighbor with larger fitness, z may be chosen arbitrarily among them.Algorithm 1 ((1+1) Memetic Algorithm ((1+1) MA))arrow_forwardWrite The Rank-Maximal Matching Algorithm. Let G = (AUP, EU... UE). Initialize G₁ = G₁, and M to any maximum matching in G. For i = 1 tor-1 solve \ the steps, and output.arrow_forwardGiven an abstraction of the City Tube Map where each node represents the city’s attraction, plan the trip for the tourist to visit. Start from node 1 that is their hotel, a group of tourists wants to visit all places. However, due to the time limitation, they can only visit each attraction once. To find the best order of places to visit, genetic algorithm can be used to derive the best possible solutions.arrow_forward
- GIVEN: n red points and n blue points in the plane in general position (i.e., no 3 points are on the same line) PROVE: there exists a matching (i.e., 1-1 correspondence) between red and blue points such that the segments connecting the corresponding points do not intersect. EXTRA/HINT: describe an algorithm for finding such matchingarrow_forwardLet P2(x) be the least squares interpolating polynomial for f(x) := sin(πx) on the interval [0,1] (with weight function w(x) = 1). Determine nodes (x0,x1,x2) for the second-order Lagrange interpolating polynomial Pˆ2(x) so that P2 = Pˆ2. You are welcome to proceed theoretically or numerically using Python.arrow_forwardIf we choose to represent each genotype as a partial permutation, then provide an algebraic expression, in terms of n, for the size of the genetic search space (the number of possible valid genotypes), in terms of n. Assume that n ≥ 4.arrow_forward
- Recall the Monte Carlo method, from week 6 (section 6.2.2), for approximating . Suppose we choose a point (x, y) randomly (with uniform distribution) in the unit square. The probability that it lies inside a circle of diameter 1 contained in the unit square is equal to the area of that circle, or π/4. So this Monte Carlo method works as follows: Write a function montecarlo (M) which takes an integer M and returns an approximation to π. (I can't give you an example output, as the random nature of the procedure means approximations will differ!)arrow_forwardA. Suppose that every random variable in the joint distribution of P(A,B,C,D,E) = P(E|C,D)P(D|C)P(C|A,B)P(B|A)P(A). has a domain containing 10 elements. How many rows are needed to list the full joint distribution in an explicit table? B. Suppose that every random variable in the joint distribution of P(A,B,C,D,E) = P(E|C,D)P(D|C)P(C|A,B)P(B|A)P(A). has a domain containing 10 elements. How many rows in total are needed to list the conditional probability tables for your belief network representation?arrow_forwardhow to use a histrogram to estimate the the size of selection of the form σA<=γ(r)?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks Cole
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole