The Boisdale algorithm - an induction method for a subclass of unification grammar from pos

合集下载

计算机科学选讲 绪论

计算机科学选讲 绪论
12/28
COMPUTER SCIENCE
An Overview
The Origins of Computing Machines
The family tree of today’s computers
___Abacus ___Gear-driven calculators ___Electromechanical machine
2/28
COMPUTER SCIENCE
An Overview
Content
The Role of Algorithms Algorithms The Origins of Computing Machines The Science of Algorithm Abstraction Summary Homework
13/28
COMPUTER SCIENCE
An Overview
Figure 0.4: The Mark I computer
14/28
COMPUTER SCIENCE
An Overviewห้องสมุดไป่ตู้
The Origins of Computing Machines
The family tree of today’s computers
9/28
COMPUTER SCIENCE
An Overview
Figure 0.2: The Euclidean algorithm for finding the greatest common divisor of two positive integers
10/28
COMPUTER SCIENCE
16/28
COMPUTER SCIENCE

An algorithm for the Quillen-Suslin theorem for monoid rings

An algorithm for the Quillen-Suslin theorem for monoid rings

R ? ! R1 ??? R2 ? ! R ???
such that
? r1; r2) 2 R1 R2 j r1 = r2 in Rg; then, with certain extra hypotheses, projective modules over R can be obtained by \patching together" pairs of projective modules over R1 and R2 . In Section 4, we reduce the problem for normal toric monoids M to nding an algorithm for the \interior" submonoid M of M . In Section 7, we construct a sequence of monoids M = M0 ; M1; : : : ; Mk = F; ending in a free monoid F . In Sections 5 and 6 we construct subalgorithms to show that this sequence has the property that projective modules over kMi are obtained from projective modules over kMi+1 by restriction or extension of scalars. Since kF is just a polynomial ring, we can use the Logar-Sturmfels algorithm for the ordinary QS.
AN ALGORITHM FOR THE QUILLEN-SUSLIN THEOREM FOR MONOID RINGS

算法竞赛大模拟解题技巧

算法竞赛大模拟解题技巧

算法竞赛大模拟解题技巧(中英文实用版)Title: Algorithm Competition Big Simulation Problem-Solving TechniquesTitle: 大模拟竞赛解题技巧Section 1: Understanding the ProblemSection 1: 理解题目In order to solve algorithm competition problems effectively, it is crucial to fully understand the problem statement.Read the problem carefully and make sure you grasp the input, output, and constraints.Understand the goal and what is being asked of you.为了解决算法竞赛问题,充分理解题目声明至关重要。

仔细阅读题目,并确保你掌握了输入、输出和限制。

理解目标和你被要求做什么。

Section 2: Developing a StrategySection 2: 制定策略Once you understand the problem, the next step is to develop a strategy to solve it.This may involve breaking the problem down into smaller subproblems, or coming up with a plan to tackle the main problem directly.一旦理解了问题,下一步就是制定解决它的策略。

这可能包括将问题分解成更小的子问题,或者直接制定解决主要问题的计划。

Section 3: Implementing the SolutionSection 3: 实现解决方案After developing a strategy, it"s time to implement your solution.This may involve writing code in a programming language of your choice, or using a specific algorithm or data structure that you have determined will be effective for the problem.制定策略后,是时候实现你的解决方案了。

(完整word版)英文审稿意见汇总

(完整word版)英文审稿意见汇总

1、目标和结果不清晰。

It is noted that your manuscript needs careful editing by someone with expertise in technical English editing paying particular attention to English grammar, spelling, and sentence structure so that the goals and results of the study are clear to the reader.2、未解释研究方法或解释不充分。

◆In general, there is a lack of explanation of replicates and statistical methods used in the study.◆Furthermore, an explanation of why the authors did these various experimentsshould be provided.3、对于研究设计的rationale:Also, there are few explanations of the rationale for the study design.4、夸张地陈述结论/夸大成果/不严谨:The conclusions are overstated. For example, the study did not showif the side effects from initial copper burst can be avoid with the polymer formulation.5、对hypothesis的清晰界定:A hypothesis needs to be presented。

6、对某个概念或工具使用的rationale/定义概念:What was the rationale for the film/SBF volume ratio?7、对研究问题的定义:Try to set the problem discussed in this paper in more clear,write one section to define the problem8、如何凸现原创性以及如何充分地写literature review:The topic is novel but the application proposed is not so novel.9、对claim,如A>B的证明,verification:There is no experimental comparison of the algorithm with previously known work, so it is impossible to judge whether the algorithm is an improvement on previous work.10、严谨度问题:MNQ is easier than the primitive PNQS, how to prove that.11、格式(重视程度):◆In addition, the list of references is not in our style. It is close but not completely correct. I have attached a pdf file with "Instructions for Authors" which shows examples.◆Before submitting a revision be sure that your material is properly prepared and formatted. If you are unsure, please consult the formatting nstructions to authors that are given under the "Instructions and Forms" button in he upper right-hand corner of the screen.12、语言问题(出现最多的问题):有关语言的审稿人意见:◆It is noted that your manuscript needs careful editing by someone with expertise in technical English editing paying particular attention to English grammar, spelling, and sentence structure so that the goals and results of the study are clear to the reader.◆The authors must have their work reviewed by a proper translation/reviewing service before submission; only then can a proper review be performed. Most sentences contain grammatical and/or spelling mistakes or are not complete sentences.◆As presented, the writing is not acceptable for the journal. There areproblems with sentence structure, verb tense, and clause construction.◆The English of your manuscript must be improved before resubmission. We strongly suggest that you obtain assistance from a colleague who is well-versed in English or whose native language is English.◆Please have someone competent in the English language and the subject matter of your paper go over the paper and correct it. ?◆the quality of English needs improving.来自编辑的鼓励:Encouragement from reviewers:◆I would be very glad to re-review the paper in greater depth once it has been edited because the subject is interesting.◆There is continued interest in your manuscript titled "……" which you submitted to the Journal of Biomedical Materials Research: Part B - AppliedBiomaterials.◆The Submission has been greatly improved and is worthy of publication.•The paper is very annoying to read as it is riddled with grammatical errors and poorly constructed sentences. Furthermore, the novelty and motivation of the work is not well justified. Also, the experimental study is shallow. In fact, I cant figure out the legends as it is too small! How does your effort compares with state-of-the-art?•The experiment is the major problem in the paper. Not only the dataset is not published, but also the description is very rough. It is impossible to replicate the experiment and verify the claim of the author. Furthermore, almost no discussion for the experimental result is given. E.g. why the author would obtain this result? Which component is the most important? Any further improvement?•the author should concentrated on the new algorithm with your idea and explained its advantages clearly with a most simple words.•it is good concept, but need to polish layout, language.•The authors did a good job in motivating the problem studied in theintroduction. The mathematic explanation of the proposed solutions is also nice. Furthermore, the paper is accompanied by an adequate set of experiments for evaluating the effectiveness of the solutions the authors propose.•Apparently,Obviously ,Innovation ,refine ,In my humble opinion 如果仍然有需要修改的小毛病,一般你可以用you paper has been conditionally accepted. Please revise .....according to review comments.如果是接受,你可以用We are very pleased to inform you that your paper "xxxxx" has been accepted by [journal name]. Please prepare your paper by journal template...............At a first glance, this short manuscript seems an interesting piece of work, reporting on ×××. Fine, good quality, but all this has been done and published, and nearly become a well-known phenomenon. Therefore, there is insufficient novelty or significance to meet publication criteria. Also, I did not see any expermental evidence how the ** is related with **, except for the hand-waving qualitative discussion. Therefore, I cannot support its publication in JPD in its present form. It should be rejected.建议去小木虫问问,那里有一些资源。

正确对待算法的作文题目

正确对待算法的作文题目

正确对待算法的作文题目英文回答:Correct Attitude towards Algorithms.Algorithms have become an integral part of our daily lives, from the way we search for information on the internet to the way we shop online. With the increasing reliance on algorithms, it is important for us to have a correct attitude towards them.First and foremost, it is important to understand that algorithms are simply a set of instructions or rules to be followed in problem-solving operations. They are not inherently good or bad, but it is how they are used that determines their impact. Therefore, it is crucial for us to use algorithms responsibly and ethically.Furthermore, it is essential to be aware of the potential biases and limitations of algorithms. Algorithmsare created by humans, and as a result, they may reflect the biases and prejudices of their creators. It is important to critically evaluate the algorithms we encounter and consider the potential implications of their use.In addition, it is important to remember that algorithms are tools, not replacements for human judgment and critical thinking. While algorithms can assist us in processing and analyzing large amounts of data, they should not be relied upon blindly. It is important to use algorithms as a complement to human intelligence, rather than a substitute for it.In conclusion, having a correct attitude towards algorithms involves using them responsibly, being aware of their potential biases, and recognizing their limitations. By approaching algorithms with a critical mindset, we can harness their potential while mitigating their negative impact.中文回答:正确对待算法。

The Sequential Quadratic Programming Method

The Sequential Quadratic Programming Method

The Sequential Quadratic Programming Method
167
2 ewton Methods and Local Optimality
In this and subsequent sections we trace the development of Newton methods from the simplest case of nonlinear equations, through to the general case of nonlinear programming with equations and inequalities.
x∈IR
subject to ci (x) ≥ 0
i = 1 , 2 , . . . , m.
(1.1)
In this formulation, equation constraints must be encoded as two opposed inequality constraints, that is c(x) = 0 is replaced by c(x) ≥ 0 and −c(x) ≥ 0, which is usually not convenient. Thus in practice a more detailed formulation is appropriate, admitting also equations, linear constraints and simple bounds. One way to do this is to add slack variables to the constraints, which
The Sequential Quadratic Programming Method

算法是一把双刃剑作文材料

算法是一把双刃剑作文材料英文回答:Algorithm is indeed a double-edged sword. On one hand, algorithms have greatly improved our lives and brought us convenience and efficiency. For example, recommendation algorithms on e-commerce platforms can help us findproducts that we may be interested in, saving us time and effort. Search algorithms enable us to quickly find information on the internet, making research and learning more accessible. Algorithms also play a crucial role in various industries, such as finance, healthcare, and transportation, optimizing processes and improving outcomes.However, algorithms also have their downsides. Onemajor concern is the issue of algorithmic bias. Algorithms are created by humans and are based on data that maycontain inherent biases. This can lead to unfair outcomes, such as discriminatory hiring practices or biased loan approvals. Another concern is the potential for algorithmsto invade privacy. With the increasing amount of data being collected and analyzed, algorithms have the power to infer personal information and make predictions about individuals, raising concerns about surveillance and data misuse.Furthermore, algorithms can also perpetuate echo chambers and filter bubbles. Recommendation algorithms tend to show us content that aligns with our existingpreferences and beliefs, limiting our exposure to diverse perspectives. This can reinforce our existing biases and hinder critical thinking and open-mindedness.中文回答:算法确实是一把双刃剑。

Using and combining predictors that specialize

Proceedings of the Twenty-Ninth Annual ACM Symposium on the Theory of Computing,1997. Using and combining predictors that specializeYoav Freund Robert E.Schapire Yoram SingerAT&T Labs600Mountain Avenue,Murray Hill,NJ07974 yoav,schapire,singer@Manfred K.Warmuth University of California Santa Cruz,CA95064 manfred@Abstract.We study online learning algorithms that predict by com-bining the predictions of several subordinate prediction algorithms, sometimes called“experts.”These simple algorithms belong to the multiplicative weights family of algorithms.The performance of these algorithms degrades only logarithmically with the number of experts,making them particularly useful in applications where the number of experts is very large.However,in applications such as text categorization,it is often natural for some of the experts to abstain from making predictions on some of the instances.We show how to transform algorithms that assume that all experts are always awake to algorithms that do not require this assumption.We also show how to derive corresponding loss bounds.Our method is very general,and can be applied to a large family of online learning algorithms.We also give applications to various prediction models including decision graphs and“switching”experts.1IntroductionWe study online learning algorithms that predict by combin-ing the predictions of several subordinate prediction algo-rithms,sometimes called“experts.”Starting with the work of Vovk[19]and Littlestone and Warmuth[14],many algo-rithms have been developed in recent years which use multi-plicative weight updates.These algorithms enjoy theoretical performance guarantees which can be proved without mak-ing any statistical assumptions.Such results can be made meaningful in a non-statistical setting by proving that the per-formance of the master algorithm can never be much worse than that of the best expert.Furthermore,the dependence of such a bound on the number of experts is only logarithmic, making such algorithms applicable even when the number of experts is enormous.In this paper,we study an extension of the online pre-diction frameworkfirst proposed by Blum[1].The added feature is that we allow experts to abstain from making a pre-problems.The naive solution to these prediction problemsuses a very large set of experts,making the calculations ofthe prediction computationally infeasible.We show how a large set of experts can be represented using a much smallerset of specialists.Each expert corresponds to a subset of thespecialists which take turns in making their predictions.Onlya small fraction of the specialists are involved in producingeach prediction,which reduces the computational load evenfurther.Specifically,we apply this decomposition to the problemof predicting almost as well as the best pruning of a decisiongraph.This generalizes previous work on predicting almostas well as the best pruning of a decision tree[21,10].We also apply our methods to the problem of predict-ing in a model in which the“best”expert may change with time.We derive a specialist-based algorithm for this prob-lem that is as fast as the best known algorithm of Herbsterand Warmuth[11]and achieves almost as good a loss bound.However,unlike their algorithm,ours does not require priorknowledge of the length of the sequence and the number of switches.2The specialist frameworkWe now give a formal definition of the framework.We define online learning with specialists as a game that is played be-tween the prediction algorithm and an adversary.We assumethat there are specialists,indexed by1.We assume that predictions and outcomes are real-valued num-bers from a bounded range01.1We define a loss function L:01010that associates a non-negative loss to each pair of prediction and outcome.The game proceeds in iterations1,each con-sisting of the followingfive steps:1.The adversary chooses a set1of spe-cialists that are awake at iteration.2.The adversary chooses a prediction for each awakespecialist.3.The algorithm chooses its own predictionˆ.4.The adversary chooses an outcome.5.The algorithm suffers loss Lˆand eachof the awake specialists suffers loss L.Specialists that are asleep suffer no loss.The performance of an algorithm is measured in terms ofits total loss1.We are interested in boundsthat hold for any adversarial strategy.As the adversary chooses the outcome after the algorithm made its prediction, it can clearly inflict on the algorithm a large loss on each The expression1L describes the total loss of an algorithm that at each iteration predicts by randomly choosing one of the specialists in according to thefixed distribution restricted to and re-normalized.Equa-tion(1)defines the total loss of the best distribution,which suffers the minimal loss for the particular sequence.As this optimal is not known in advance,it is impossible to actu-ally achieve a total loss of(1),and all we can hope for is to guarantee that the loss of our algorithms is never much larger than it.Comparison to average prediction:In this case we compare the total loss of the algorithm tomin∆1L2 whereL L2This definition is similar in motivation to the definition of regret in the statistical analysis of prediction algorithms.However,unlike in that case,no statistical assumptions are made here regarding the mechanism that is generating the sequence.The bounds here hold for any sequence of outcomes.random and predicting with its prediction.Since in most interesting cases the loss function is convex,bounds of this form imply bounds of the previous form but not vice versa. Bounds of this second form are harder to achieve.In his work on predicting using specialists[1],Blum proves a bound on the performance of a variant of the Win-now algorithm[13].This algorithm is used for making binary predictions and Blum made the additional assumption that a non-empty subset of the specialists never make a mistake.It is assumed that at any iteration at least one of these infallible specialists is awake.This is a special case of our framework in which there exists a vector(which has non-zero compo-nents on the infallible subset of specialists)such that the loss associated with this vector is zero.33Design and analysis of specialist algorithms In this section we show how to transform insomniac learning algorithms into the specialist framework.We start with a simple case and then describe a general transformation which we then apply to other,more complex cases.A few preliminaries:Recall that∆denotes the set of probability vectors of dimension,i.e.,∆01:1.For two probability vectors ∆,the relative entropy,written RE isln.(We follow the usual convention that 0ln00.)For probability vector∆and a set 1,we define.3.1Log lossOne of the simplest and best known online prediction algo-rithms is the Bayes algorithm,which has been rediscovered many times,for instance,in the context of universal coding, Bayesian estimation and investment management[4,6,7]. In this case,the predictions are from the range01,the out-comes are from01and the loss is the log loss,or coding length,defined asLˆlnˆif 1ln1ˆif0.Note that this loss is always nonnegative,but may be infinite(for instance,ifˆ0and1).algorithm is described on the left side of Figure1.This algorithm maintains a probability vector over theexperts.4On each round,each expert provides a prediction01.The Bayes algorithm combines these by takingln1ˆln lnˆL LˆParameters:Prior distribution1∆;number of trials. Algorithm BayesDo for121.Predict with the weighted average of the experts predic-tions:ˆ12.Observe outcome3.Calculate a new posterior distribution:11ˆif 0.Algorithm SBayesDo for121.Predict with the weighted average of the predictions ofthe awake specialists:ˆˆif11Figure1:The Bayes algorithm and the Bayes algorithm for specialists. The proof is similar when0.We thus get Equation(4). Summing this equality for1and using the fact that the relative entropy is always positive we getRE1RE1RE11Lˆ1LRearranging terms then gives the statement of the theorem.RE1Insomniac algorithmDo for121.Observe.2.Predictˆpred.3.Observe outcome and suffer loss Lˆ.4.Calculate the new weight vector1update Specialist algorithmDo for121.Observe and.2.Predictˆpred.3.Observe outcome and suffer loss Lˆ.4.Calculate the new weight vector1so that it satisfiesthe following:(a)1for(b)1update(c)111.1L1ln11L1Parameters:Prior distribution1∆;learning rate0;number of trials. Algorithm SAbsDo for121.Predict with:ˆ2ln22ln2 Otherwise,1.2.Observe outcome and incur loss Lˆˆ.3.Calculate a new posterior distribution:if12ˆFigure4:The exponentiated gradient algorithm for specialists and square loss.this case depend on and are2ln21RE13.4Square lossWe next consider the square loss Lˆˆ-ing the algorithm for on-line prediction with square loss de-scribed by Vovk[19],we can derive an algorithm whose bound is in terms of the comparison loss L.In this section,we show how to get a more powerful bound in terms of L using a different family of algorithms,called the exponentiated gradient()algorithms.This family was introduced by Kivinen and Warmuth[12]and is derived and analyzed using the relative entropy.It thusfits within the framework of Section3.2.The algorithm is similar to the algorithms based on Vovk’s work in that they maintain one weight per input and update these weights multiplicatively.The main difference is that instead of having the loss in the exponent of the update factor,we have the gradient of the loss.Applying the transformation of Section3.2to,we obtain the algorithm shown in Figure4.Like, this algorithm has a parameter0that needs to be tuned. At the core of the relative loss bound for,there is again an inequality of the form given in Equation(6).Kivinen and Warmuth[12,Lemma5.8]prove that such an inequality holds for,22121A 5In order to handle degenerate situations,we also assign a specialist to a“dummy”edge that comes in to the start node;this specialist is always awake.located is equal to the number of edges of the decision graph ,and the time needed to formulate a prediction is the length of the path from the start node to a terminal node.To analyze the algorithm,we compare the log loss of the algorithm to the loss of any pruning.Let be the pruning which achieves the smallest total loss.We say that an edge is a terminal edge if it is an ingoingedge of a terminal node.We let the comparison vector be uniform over all the terminal edges in.Let be the number of terminal edges in, and let be the total number of edges in the full decision graph.On each round,exactly one terminal edge of is traversed in;this follows from the manner in which prunings have been defined.Hence,exactly one specialist in the support set of is awake so1for all .By construction,the loss of is equal to the loss of the predictions computed by pruning.From Theorem1,we therefore get that the additional loss of the algorithm relative to the loss of is at most RE1.If we choose1 to be uniform over all the edges in the full decision graph then RE1ln,giving an additional loss bound of ln.This bound is essentially optimal for general decision graphs.In the special case that the decision graph is actually a de-cision tree,we could instead apply the techniques of Willems, Shtarkov and Tjalkens[21]and Helmbold and Schapire[10]. Their methods also lead to an algorithm for predicting almost as well as the best pruning of the decision tree,but results in an additional loss bound of only where,as above,is the number of terminal edges of,which,for trees,is simply equal to the number of leaves.For trees,our bounds can be improved to2which is still inferior to the above bound. However,our method is more general and can be applied not only to decision trees but to any directed acyclic graph.4.3Switching expertsIn the conventional(insomniac)on-line learning model,we compare the loss of the master algorithm to the loss of the best of experts for the entire sequence.However,it is nat-ural to expect that different experts will be best for different segments of the data sequence.In this section,we study such a model of prediction in which the“best”expert may change with time.Specifically,we imagine that the sequence of prediction rounds is subdivided(in a manner unknown to the learner) into at most segments where each segment is associated with a unique expert which suffers the minimal loss on the segment.The sequence of segments and its associated se-quence of best experts is called a segmentation.Our goal is to perform well relative to the best segmentation.This prediction problem wasfirst studied by Littlestone and Warmuth[14].Currently,the best of the known algo-rithms for this problem are due to Herbster and Warmuth[11]. Although the algorithms we obtain are just as efficient as theirs(time per iteration),our bounds are slightly weaker than Herbster and Warmuth’s.However,their algo-rithms require estimates of and and their bounds degrade as the quality of the estimates degrades.Our algorithm does not require prior knowledge of and.We use the log loss in this section.We call the original experts the ground experts,and we define a set of higher-level experts called segmentation experts.A-segmentation expert is defined by a segmentation of the sequence into segments,each associated with a ground expert.That is,each -segmentation expert is defined by a sequence of switchpoints001and a sequence of ground experts1.Here,the interpretation is that the segmentation expert predicts the same as expert on trials 11through(inclusive).Our goal is to predict almost as well as the best segmentation expert.If the algorithm were provided in advance with the number of segments and the length of the sequence,then we could keep one weight for each of the exponentially many -segmentation experts and apply the algorithm of Section3.1.In this case,the additional loss,relative to the best-segmentation expert,is upper bounded by ln 1ln.Note that this bound coincides with the description length(in nats)of a segmentation expert(when and are known),a bound which seems impossible to beat. Herbster and Warmuth’s bound is essentially larger than this bound by,provided that and are known ahead of time by their algorithm.Our bound is ln ln larger than either bound,but our algorithm requires no prior knowledge of and.We now describe our construction of specialists for the switching experts problem.We construct one specialist 12for each ground expert and for each pair of positive integers12.Such a specialist uses the pre-dictions of expert on rounds1through2(inclusive)and is asleep the rest of the time.We choose the initial weight of this specialist to be11222where is any distribution on the natural numbers.It is not hard to show that1sums to one when summed over all of the defined specialists.With this construction of specialists,we are ready to apply .6Let usfirst analyze the additional loss of the algo-rithm.For any-segmentation expert of the form described above,we can set the comparison vector to be uniform over the specialists naturally associated with the segmentation, namely,111112211. Since exactly one of these is awake at each time step,1.Furthermore,note that the prediction asso-ciated with is identical to that of the-segmentation expert from which it was derived.Therefore,from Theorem1,we get that the additional loss incurred by our algorithm relative12.Observe outcome and incur loss.3.Calculate new weights:(a)1(b)1ˆif0.(c)111Figure6:The SBayes algorithm for switching experts.to any-segmentation expert is at mostRE11ln1lnThis bound clearly depends on the choice of.For instance, if we choose ln12for the appropriate normalizing constant,then the bound is at most ln2ln ln.It is not immediately obvious how to implement this al-gorithm since it requires maintenance of an infinite number of specialists.We describe below an efficient scheme that requires maintenance of only weights,and in which predictions and updates also require only time per round.The main idea is to show that the predictions of can be written in the formˆ1rithm at time isˆ1112121Our implementation maintains only the weights. We now show how to update these weights efficiently.Let1ˆif0.Then,from the manner in which weights are updated by ,we have that12221 1111 1where22This update takes1time per weight,assuming that1 has been precomputed.The resulting algorithm is shown in Figure6.AcknowledgmentsThanks to William Cohen for helpful comments on this work.References[1]Avrim Blum.Empirical support for winnow and weighted-majoritybased algorithms:results on a calendar scheduling domain.In ml95, pages64–72,1995.[2]Nicol`o Cesa-Bianchi,Y oav Freund,David P.Helmbold,David Haus-sler,Robert E.Schapire,and Manfred K.Warmuth.How to use expert advice.In Proceedings of the Twenty-Fifth Annual ACM Symposium on the Theory of Computing,pages382–391,1993.To appear,Journal of the Association for Computing Machinery.[3]William W.Cohen and Yoram Singer.Context-sensitivelearning meth-ods for text categorization.In sigir96,pages307–315,1996.[4]Thomas M.Cover.Universal portfolios.Mathematical Finance,1(1):1–29,January1991.[5]Thomas M.Cover and Aaron pound Bayes predictorsfor sequences with apparent Markov structure.IEEE Transactions on Systems,Man,and Cybernetics,SMC-7(6):421–424,June1977. [6]Alfredo DeSantis,George Markowsky,and Mark N.Wegman.Learn-ing probabilistic prediction functions.In Proceedings of the1988 Workshop on Computational Learning Theory,pages312–328,1988.[7]Robert rmation Theory and Reliable Communication.John Wiley&Sons,1968.[8]David Haussler,Jyrki Kivinen,and Manfred K.Warmuth.Tightworst-case loss bounds for predicting with expert advice.In Com-putational Learning Theory:Second European Conference,Euro-COLT’95,pages69–83.Springer-Verlag,1995.[9]David P.Helmbold,Jyrki Kivinen,and Manfred K.Warmuth.Worst-case loss bounds for sigmoided neurons.In Advances in Neural Infor-mation Processing Systems7,pages309–315,1995.[10]David P.Helmbold and Robert E.Schapire.Predicting nearly as wellas the best pruning of a decision tree.In Proceedings of the Eighth Annual Conference on Computational Learning Theory,pages61–68, 1995.[11]Mark Herbster and Manfred Warmuth.Tracking the best expert.In Pro-ceedings of the Twelfth International Conference on Machine Learn-ing,pages286–294,1995.[12]Jyrki Kivinen and Manfred K.Warmuth.Additive versus exponenti-ated gradient updates for linear prediction.In stoc95,pages209–218, 1995.See also technical report UCSC-CRL-94-16,University of Cal-ifornia,Santa Cruz,Computer Research Laboratory.[13]Nick Littlestone.Learning when irrelevant attributes abound:A newlinear-threshold algorithm.Machine Learning,2:285–318,1988. [14]Nick Littlestone and Manfred K.Warmuth.The weighted majorityrmation and Computation,108:212–261,1994. [15]Neri Merhav,Meir Feder,and Michael Gutman.Some properties ofsequential predictors for binary Markov sources.IEEE Transactions on Information Theory,39(3):887–892,May1993.[16]Jorma Rissanen and Glen ngdon,Jr.Universal modeling andcoding.IEEE Transactions on Information Theory,IT-27(1):12–23, January1981.[17]Dana Ron,Y oram Singer,and Naftali Tishby.Learning probabilisticautomata with variable memory length.In Proceedings of the Seventh Annual ACM Conference on Computational Learning Theory,pages 35–46,1994.[18]V.G.V ovk.A game of prediction with expert advice.In Proceedingsof the Eighth Annual Conference on Computational Learning Theory, 1995.[19]V olodimir G.V ovk.Aggregating strategies.In Proceedings of theThird Annual Workshop on Computational Learning Theory,pages 371–383,1990.[20]Marcelo J.Weinberger,Abraham Lempel,and Jacob Ziv.A sequentialalgorithm for the universal coding offinite-memory sources.IEEE Transactions on Information Theory,38(3):1002–1014,May1992.[21]Frans M.J.Willems,Y uri M.Shtarkov,and Tjalling J.Tjalkens.Thecontext tree weighting method:basic properties.IEEE Transactions on Information Theory,41(3):653–664,1995.。

模拟ai英文面试题目及答案

模拟ai英文面试题目及答案模拟AI英文面试题目及答案1. 题目: What is the difference between a neural network anda deep learning model?答案: A neural network is a set of algorithms modeled loosely after the human brain that are designed to recognize patterns. A deep learning model is a neural network with multiple layers, allowing it to learn more complex patterns and features from data.2. 题目: Explain the concept of 'overfitting' in machine learning.答案: Overfitting occurs when a machine learning model learns the training data too well, including its noise and outliers, resulting in poor generalization to new, unseen data.3. 题目: What is the role of a 'bias' in an AI model?答案: Bias in an AI model refers to the systematic errors introduced by the model during the learning process. It can be due to the choice of model, the training data, or the algorithm's assumptions, and it can lead to unfair or inaccurate predictions.4. 题目: Describe the importance of data preprocessing in AI.答案: Data preprocessing is crucial in AI as it involves cleaning, transforming, and reducing the data to a suitableformat for the model to learn effectively. Proper preprocessing can significantly improve the performance of AI models by ensuring that the input data is relevant, accurate, and free from noise.5. 题目: How does reinforcement learning differ from supervised learning?答案: Reinforcement learning is a type of machine learning where an agent learns to make decisions by performing actions in an environment to maximize a reward signal. It differs from supervised learning, where the model learns from labeled data to predict outcomes based on input features.6. 题目: What is the purpose of a 'convolutional neural network' (CNN)?答案: A convolutional neural network (CNN) is a type of deep learning model that is particularly effective for processing data with a grid-like topology, such as images. CNNs use convolutional layers to automatically and adaptively learn spatial hierarchies of features from input images.7. 题目: Explain the concept of 'feature extraction' in AI.答案: Feature extraction in AI is the process of identifying and extracting relevant pieces of information from the raw data. It is a crucial step in many machine learning algorithms, as it helps to reduce the dimensionality of the data and to focus on the most informative aspects that can be used to make predictions or classifications.8. 题目: What is the significance of 'gradient descent' in training AI models?答案: Gradient descent is an optimization algorithm used to minimize a function by iteratively moving in the direction of steepest descent as defined by the negative of the gradient. In the context of AI, it is used to minimize the loss function of a model, thus refining the model's parameters to improve its accuracy.9. 题目: How does 'transfer learning' work in AI?答案: Transfer learning is a technique where a pre-trained model is used as the starting point for learning a new task. It leverages the knowledge gained from one problem to improve performance on a different but related problem, reducing the need for large amounts of labeled data and computational resources.10. 题目: What is the role of 'regularization' in preventing overfitting?答案: Regularization is a technique used to prevent overfitting by adding a penalty term to the loss function, which discourages overly complex models. It helps to control the model's capacity, forcing it to generalize better to new data by not fitting too closely to the training data.。

算法导论(第二版)习题答案(英文版)


Last update: December 9, 2002
1.2 − 2 Insertion sort beats merge sort when 8n2 < 64n lg n, ⇒ n < 8 lg n, ⇒ 2n/8 < n. This is true for 2 n 43 (found by using a calculator). Rewrite merge sort to use insertion sort for input of size 43 or less in order to improve the running time. 1−1 We assume that all months are 30 days and all years are 365.
n
Θ
i=1
i
= Θ(n2 )
This holds for both the best- and worst-case running time. 2.2 − 3 Given that each element is equally likely to be the one searched for and the element searched for is present in the array, a linear search will on the average have to search through half the elements. This is because half the time the wanted element will be in the first half and half the time it will be in the second half. Both the worst-case and average-case of L INEAR -S EARCH is Θ(n). 3
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

The Boisdale Algorithm – an Induction Method for a Subclass of Unification Grammar from Positive DataBradford Starkie1,2, and Henning Fernau2,31 Telstra Research Laboratories, 770 Blackburn Rd Clayton, MelbourneVictoria, 3127, AustraliaBrad.Starkie@.au/~bstarkie/2 University of Newcastle, School of Electrical Engineering and Computer Science, Uni-versity Drive, NSW 2308 Callaghan, Australia3 Theoretische Informatik, Wilhelm-Schickard-Institut für Informatik,Universität Tübingen, Sand 13, D-72076 Tübingen, Germanyfernau@informatik.uni-tuebingen.dermatik.uni-tuebingen.de/~fernau/Abstract. This paper introduces a new grammatical inference algorithmcalled the Boisdale algorithm. This algorithm can identify a class of context-free unification grammar in the limit from positive data only. The Boisdalealgorithm infers both the syntax and the semantics of the language, where thesemantics of the language can be described using arbitrarily complex datastructures represented as key value pairs. The Boisdale algorithm is an align-ment based learning algorithm that executes in polynomial time with respectto the length of the training data and can infer a grammar when presentedwith any set of sentences tagged with any data structure. This paper includes adescription of the algorithm, a description of a class of language that it canidentify in the limit and some experimental results.1. Introdu tionIf an algorithm can identify a class of language in the limit from positive data only, then it is guaranteed to learn a grammar of that class exactly at some finite time when presented with an infinite stream of example sentences generated from that language. In this respect, the ability to identify a class of language in the limit is a measure of the quality of the algorithm if the objective of the learning task is to learn a language exactly. The papers of Gold [5] and Angluin [3] are the quintessen-tial texts on identification in the limit of languages from positive data only. A brief but up-to-date introduction to the state of the art of grammatical inference of con-text-free grammars can be found in de la Higuera and Oncina [4].In Starkie [9] a new grammatical inference algorithm for inferring context-free grammars was introduced called the Left-Alignment algorithm. This algorithm has the property that it can identify a class of context-free grammar in the limit from positive data only. The Boisdale algorithm described in this paper is an extension of the left alignment algorithm that enables the semantics of the language to be learntin addition to the syntax of the language. To this end ,we use unification grammars that are similar to Definite Clause Grammars (DCGs) Pereira and Warren [7]; both can be viewed as attributed context-free grammars. Unification grammars can be used to both convert natural language sentences into data structures (represented as key-value pairs) and to convert data structures into natural language sentences. The algorithm can infer a grammar when presented with an arbitrary set of tagged sen-tences, and can do so in polynomial (update) time. We also add a very brief descrip-tion of a class of grammar that can be identified in the limit using the Boisdale algo-rithm (so-called Boisdale grammars); Starkie and Fernau [10] contains a proof showing that all Boisdale grammars can be identified in the limit from positive data only using the Boisdale algorithm. Some experimental results will be presented including an empirical confirmation that the algorithm can infer any Boisdale grammar in the limit from positive data only. Although the Boisdale algorithm can infer any Boisdale grammar in the limit from positive data, there exist some sets of training examples for which no Boisdale grammar exists that can generate those sentences amongst others. In this instance, the Boisdale algorithm still terminates and returns a unification grammar that can generate at least the training examples. The exact characterization of the class of grammars that can be identified in the limit using the Boisdale algorithm is currently an open problem.2. Background2.1 NotationA unification grammar is given by a 5-tuple G =(N,Σ,Π,S,A) where N is the al-phabet of non-terminal symbols; Σ is the alphabet of terminal symbols with N∩Σ= { }; S is a special non-terminal called the start symbol; A is the signature definition which is an ordered list of key-type pairs (k,t) and Π is a finite set of rewrite rules ofthe form r = “Ni (x1..x|A|) →Ω1(x1..x|A|) … Ω|r|(x1..x|A|)” where Ni∈N,Ω i∈(Σ∪N).The rewrite rules of G define transformations of sequences of terms to other se-quences of terms. A term is comprised of a root and a signature. The root is a sym-bol and the signature is an ordered list of symbols. In our definition of unification grammars, all terms in the language have the same number of elements in their signature as there are elements in the signature definition. For example, the term “City(- ?fm)” has the root “City” and the signature “(- ?fm)”. In this paper we will use the symbol ‘-’ to denote an undefined value within a signature. A signature that contains only one or more instances of the symbol “-” within parentheses is referred to as the empty signature. For instance, the term “sydney(- -)” has the root “sydney" and the empty signature “(- -)”. The notation root(X) denotes the root of X.If a term does not explicitly show a signature, then it contains the empty signa-ture, i.e., we can write “sydney” in place of “sydney(- -)”.A term Ω is either a terminal term in which case root(Ω) ∈Σ and begins with a lower case letter, or a non-terminal term in which case root(Ω) ∈N and begins with an upper case letter. A terminal term always has the empty signature.In this paper an uppercase letter is used to represent any non-terminal symbol (e.g., A), a lowercase symbol to represent any terminal symbol (e.g., a) and a Greekletter is used to represent a symbol that could be either terminal or non-terminal (e.g.,Ω or Ψ). The notation A(x) represents a term with an unknown number of symbols in its signature and |x| denotes the length of the signature. An italic upper-case letter is used to represent a sequence of zero or more terminals or non-terminal terms (e.g., A) and an italic bold uppercase letter represents a sequence of one or more terms, either terminal or non-terminal (e.g., A). The notation |A| denotes the number of terms in A. Lowercase italic letters represent a sequence of zero or more terminal terms (e.g., a) and bold italic lowercase letters represent a sequence of one or more terminal terms (e.g., a).2.2 Unification GrammarsAn example unification grammar G that is described using the notation employed in this paper is given below. Relating to the formal definition introduced above, for this grammar the non-terminal alphabet is {S,City}, the terminal alphabet is {syd-ney,perth,perth scotland}and the signature definition is {(fm.fm),(to,fm)}.%slots {fm fm, to fm}%start SS(?fm ?to)→S(?fm -)S(- ?to)S(?fm -)→ from City(?fm -)S(- ?to)→ to City(?to -)City(SYD -)→sydneyCity(PTH -)→perthCity(SCT -)→perth scotlandFigure 1 An example unification grammarThe first part in this denotation is the signature definition. This states that all terms in the grammar have two parameters namely a “to” attribute and an “fm” attribute. Both of these attributes are of the same type, specifically the type “fm”. As well as defining the length of the signature (two) the signature definition enables a term signature to be converted into a key-value form. For instance, the signature (PTH SYD) can be seen as the attributes {fm=PTH, to=SYD}. The start symbol of G is the non-terminal ‘S’ and all sentences that are described by this grammar (denoted L(G)) can be generated by expanding the non-terminal S until no non-terminal terms exist in the term sequence. Non-terminals can be expanded using the rewrite rules. Symbols other than ‘-’ that appear in the signature on the left-hand side of the rule and in the signature of a symbol on the right hand side are variables. (Prefixed by ‘?’ in this paper). If a rule is well formed, then for every variable in the signature of the left hand side of a rewrite rule, there is exactly one instance of that variable contained in the signature of exactly one non-terminal on the right hand side of the rewrite rule. Similarly, for every variable in the signature of a non-terminal on the right hand side of rule, there is exactly one instance of that variable in the signature on the left hand side of the rewrite rule. For instance, the rule “S(?fm ?to)→S(?fm -)S(- ?to)” contains one instance of the variable “?fm” on the left hand side and ex-actly one instance of “?fm” on the right hand side.Before each non-terminal is expanded, all variables in the signature on the left-hand side of the rule need to be instantiated to a constant value via a process re-ferred to as unification . Two signatures are said to unify if there is a set of mappings σ: t → u for the variables in the signatures such that if you replace the variables with their mappings, the two signatures are identical. The notation L σ denotes the result of applying the substitution σ to L .For instance, in the above example the signature (“melbourne” “sydney”) unifies with (?fm ?to) using the mapping σ =(?fm →“melbourne”, ?to →“sydney”). That is,(?fm ?to)σ = (“melbourne” “sydney”). In contrast, the signature (“melbourne” “syd-ney”) does not unify with the signature (- ?to).An important method of expanding the start symbol into a terminal sequence is the rightmos t expans ion (denoted ⇒rm,G ) in which non-terminals are expanded right to left. For example:S(“melbourne”-)S(-“sydney”) ⇒rm,G S(“melbourne”-) to City(-“sydney”).The notation A ⇒*B denotes that A can be expanded using zero or more single step expansions to become B . A constituent is defined as an ordered pair (A , B ) where A ⇒* B . Similarly, a string can be converted to a data structure by a process referred to as reduction (denoted ⇐), where rewrite rules are applied in reverse. One impor-tant method of reduction is the leftmos t reduction (denoted L,G ⇐) in which reduc-tions are applied left to right. For example:to melbourne L,G ⇐ to City(“melbourne”-) L,G ⇐ S(-“melbourne”)Similarly, the notation B ⇐* A denotes that B can be transformed to become A via zero or more single step reductions.To formally describe a leftmost reduction we need to introduce a definition of uniquely inverted that can be applied to unification grammar. A unification gram-mar is uniquely inverted if there are no two rules of the form A(x)→B and C(y)→D such that root(B ) = root(D ). Here the function root is extended to a sequence of terms as follows: root(Ω1 Ω2 .. Ωx ) = root(Ω1) root(Ω2) .. root(Ωx ). Formally a leftmost reduction can be described as follows: if G is uniquely invertedand A B C L,G ⇐ A D(x) C then there exists a substitution ζ and a rule D(y) → Q such that Q ζ = B and D(y) ζ = D(x) and there does not exist any rule of the form E(x)→Fsuch that for some substitution ρ, A B C = H F ρ J ⇐ H E(x)ρ J and H F ρ is a proper prefix of A B . For any uniquely inverted unification grammar, the normal form achieved from a leftmost reduction is deterministic Otto [6]. It can be seen that if B L ⇐* N(x) then N(x) ⇒*rm,G B . To describe the Boisdale algorithm, some additional notation is required. If N(y) is a term, then val(y) denotes the unordered list of values (either constants or variables) in y other than ‘-’. Let pattern(y) be a sequence of 0’s and 1’s that denotes whether each element of the signature is either ‘-’ or not ‘-‘ respectively. Let const(y) denote the unordered list of constants in y; e.g., if y = (“melbourne” - ?action 6), then val(y) ={ “melbourne”, ?action, 6 }, pattern(y)=(1011) and const(y)={ “melbourne”, 6 }. The function val can be extended to terms and term sequences as follows: val(A(x))=val(x) and val(A(x) B ) = val(A(x)) ∪ val(B ). The functions const can be similarly expanded to reference terms and term sequences.2.3 The Typed Leftmost ReductionWe will now introduce the concept of the typed leftmost reduction . Given a set of rewrite rules, a starting term sequence and a set of constants, a typed leftmost reduc-tion defines a deterministic set of reductions. A typed leftmost reduction is similar to a leftmost reduction in that rewrite rules are applied in a left to right sequence with the following important distinction: the definition of a typed leftmost reduction includes a set of constants c such that a rule R can only be used if const(R) ⊆ c. This is reflected by the notation L(c),G ⇐.The function typed_leftmost(I ,G,c) shown inFigure 2 calculates the typed leftmost reduction B such that I L(c),G ⇐*B .Function typed_leftmost(I ,G,c)//I a sequence of terms,G a set of rewrite rules//c a set of constants{i=0;while(i < |I |){shift I [i] onto stack;i++;while(∃ A(x)→ B , ∃σ such that B σ = top |B | of stack,const (x)⊆ c){ pop |B | symbols off stack;push A(x)σ onto stack;}}Figure 2 An algorithm for calculating a typed leftmost reductionFormally, given a target set of constants c, a uniquely inverted set of rewrite rulesG and a starting sequence I a typed leftmost reduction denoted I L(c),G ⇐* B is a se-quence of reduction steps such that if I L(c)⇐* A D C L(c) ⇐ A F(x) C L(c) ⇐* B then there exists a substitution ζ and a rule F(x)ζ → D ζ such that const(x) ⊆ c and theredoes not exist any rule of the form E(y)→F and a substitution σ such that A D C = HF σ J ⇐ H E(y)σ J L ⇐* B and H F σ is a proper prefix of A D , const(y) ⊆ c. Although the definition of a typed leftmost reduction is stated in terms of auniquely inverted grammar, we will extend the definition to enable it to be used as part of the inference process as follows: If two rules R 1 and R 2 can be applied at any point in a typed leftmost reduction sequence then if |const(R 1)| > |const(R 2)|, the sequence is reduced by R 1; otherwise, the sequence is reduced by R 2.2.4 The Working Principle of the Boisdale AlgorithmIt can be seen that for all unification grammars, if B L(c),G ⇐*A(c) then A(c)⇒*rm,G B . The Boisdale algorithm has been designed to infer grammars where for each rule there exists at least one terminal sequence, whose typed leftmost reduction recreates a rightmost derivation in reverse, i.e., for each rule of the form A(d)→E there existsat least one terminal string b such that A(c) ⇒rm,G E σ ⇒*rm,G b and b L(c),G ⇐*E σL(c),G ⇐A(c). The Boisdale algorithm takes as its input a set of positive training examples each tagged with key value pairs representing the meaning of those sentences. The con-stituents of these sentences are then guessed by aligning sentences with common prefixes from the left. In Starkie and Fernau [10] it is proven that a class of grammar exists such that aligning sentences from the left either identifies the correct constitu-ents of the sentence, or if it incorrectly identifies constituents then those constituents will be deleted by the time the algorithm has completed.The Boisdale algorithm is believed to be one example of a class of alignmentbased learning algorithms that can identify classes of unification grammar in the limit from positive data only. A related algorithm could be constructed to infer grammars for which all sentences can be reconstructed using a typed leftmost reduc-tion, i.e.,∀A(c) ⇒rm,G E⇒*rm,G b, b L(c),G⇐* E L(c),G⇐A(c).Similarly the concept of a typed rightmost reduction can be introduced that is identical to a typed leftmost reduction with the exception that reductions occur in a right to left manner. This variant of course gives rise to another class of learnable languages.3. The Boisdale AlgorithmThe Boisdale algorithm begins with a set T of positive examples of the language L(G) where each s∈ T can include a set of key value pairs (denoted attributes(s)) that describe the semantics of s. Although this algorithm uses unstructured key value pairs to describe the semantics of sentences, arbitrarily complex data structures can be mapped into assignment functions and therefore simple key-value pairs as de-scribed in Starkie [8]. (eg date.hours= “4” date.minutes=“30”).The algorithm creates a set of constituents C and hypothesis grammar H with rule set Π. The algorithm is comprised of the following 7 steps.Step 1. (Incorporation Phase)For each sentence s ∈ T, attributes(s) =x a rewrite rule of the form S(x) →s is added to H.Step 2. (Alignment Phase)Rule 1. If there exists two sentences c x1and c x2with a common prefix c and withattributes y1 and y2, respectively, for which the same attribute keys are defined, i.e.,pattern(y1)=pattern(y2), then a new non-terminal X1is introduced and two rules ofthe form X1(y5) →x1and X1(y6) →x2are created. The signatures of these rules (y5and y6) are constructed such that val(y5) = val(y1) – val(y2) and val(y6) = val(y2) –val(y1).Example: When presented with the sentences “from sydney"{fm=SYD} and "from perth" {fm=PTH}, the non-terminal X48is constructed and the rulesX48(SYD -)→sydney and X48(PTH -)→perthare added to the hypothesis grammar.Rule 2. If there exists a sentence c x7 that is a prefix of another sentence c x7x8withattributes y7 and y8, respectively, for which the same attribute keys are defined, i.e.,pattern(y7)=pattern(y8) such that there exists at least one key value pair in y7that isnot in y8 then a new non-terminal X7is created and two rules of the form X7(y10) →x 7 and X7(y11) →x7x8are constructed.Example: When presented with the sentences "from perth" {fm=PTH} and "fromperth scotland" {fm=SCT} the non-terminal X48 is formed and the rules “X48(PTH-)→perth” and “X48(SCT -)→perth scotland” are constructed.At this point the right hand side all of the rewrite rules of the hypothesis grammar contain only terminals. The set of constituents C is then created by copying the hypothesis grammar H, i.e., C ={ (A(x),B ) | “A(x)→B ”∈H }. Continue to step 3. Step 3. (Substitution Phase)The substitution phase consists of two sub phases: normalisation and completion. In both subphases, merging of non-terminals may occur. Merging non-terminals in the Boisdale algorithm involves the relabelling of some non-terminals as well as the reordering of the signatures of non-terminals. A reordering r is an array of length l where l is the number of attributes per term in the grammar. Each element of r (denoted r i ) is set to either ‘-’ or an integer k such that k < l . When a signature s isreordered using a reordering r, a signature u is created such that u i = ‘-’ if r i = ‘-’, otherwise u i = s k where k= r i . After u has been constructed s is replaced by u. We will use the notation y |-|ς z to denote that y is reordered using the reordering ς to be-come z.Example: The signature (- SYD) can be reordered using the reordering (1 -) to be-come (SYD –).When the non-terminals A and C are merged using the reordering r, all signatures attached to A are reordered using r. A well-founded linear ordering <r (not defined here) is used to determine the name of the newly merged non-terminal. Specifically, if A<r C then all instances of C are renamed as A, otherwise all instances of A are renamed as C. For any non-terminal N i other than ‘S’ ‘S’<r N i . This ensures that H always contains at least one rule with the start symbol on its left hand side. Example: If a grammar contains the rulesX 1(- SYD)→sydney and X 2(PTH -)→perthand the non-terminal X 2 is merged with X 1 using the reordering (- 1) then aftermerging these rules become; X 1(- SYD)→sydney and X 1(- PTH)→perth. Normalisation.During normalization for each rule of the form N i (y)→E in H the right hand side E is reduced using a typed leftmost reduction and y (i.e., using the function of Figure2.) That is the value K is calculated where E L(y) ⇐* K.a) I f N i ≠ ‘S’ and a term sequence is encountered while reducing E that beginswith N i , then the rule N i (y)→E is deleted.b) O therwise if K ≠ N i (y) and |K |≠1 and each constant in const(K ) appears the samenumber of times in const(y), then the rule N i (y)→E is replaced by the ruleN i (y)→K.c) I f K ≠ N i (y) and |K |=1 and each constant in const(K ) appears the same number of times in const(y), then the non-terminal K is merged with N i in both H and C. This process is repeated until ∀ r = (A(x)→B ) ∈ Π, B L(x) ⇐* A(x). Example: If H contains only the following rulesS(SYD -)→from sydney and X 48(SYD -)→sydney then after normalisation (part c)) these rules will becomeS(?fm -)→from X 48(?fm -) and X 48(SYD -)→sydney. Completion.During completion the right hand side of each constituent in C is reduced using a typed leftmost reduction. Specifically for all c=(A(x),B ) ∈ C the value D is calcu-lated such that B L(x) ⇐* D .a) I f A ≠ ‘S’ and a term sequence is encountered while reducing B that begins withA the constituent (A(x),B ) is deleted.b) O therwise if D ≠ A(x) and each constant in const(D ) appears the same number of times in const(x) then a rule of the form A(x)→ D is added to H.c) I f D ≠ A(x) and |D |=1 and each constant in const(D ) appears the same number of times in const(x) then the non-terminal D is merged with A in both H and C. This process is repeated until no more rules are added to H.Example: If H contains only the following ruleX 48(SYD -)→sydney and C contains the following constituents(S(SYD -),from sydney) and (X 48(SYD -),sydney) then after completion the rules of H will beS(?fm -)→from X 48(?fm -) and X 48(SYD -)→sydney. In the substitution phase, normalisation is first performed followed by completion. If the grammar has changed, the process is repeated, beginning with normalization; otherwise, the algorithm continues to the merging phase.Step 4. (Merging Phase)During the merging phase, non-terminals are merged by applying the following rules:• If there exists two rules of the form A(x) → B C(y) and A(q) → E D(z) that can be unified using the mapping σ so that the right hand sides are identical (i.e., B =E σ) with the exception of the last non-terminal on the right hand side of each rule, and the signatures of the last non-terminal can be reordered using the reordering ς so that they unify, i.e., y |-|ς z σ then C and D are merged using ς.Example: If there are two rules of the formX 1(?fm ?to) → from City(?fm -) to X 2(- ?to) andX 1(?fm ?to) → from City(?fm -) to City(?to -), then the non-terminals X 2 and City are merged. • If there exists two rules of the form A(x) → B and C(y) → E where the same right hand side of each rule can be unified using some mapping σ (i.e., B =E σ) and the signatures of the left hand sides can be reordered using some reordering ς, i.e., x |-|ς y σ then A and C are merged using ς.Example: If there are two rules of the formX 2(sydney-) → sydney andCity(sydney -) → sydney,then the non-terminals X 2 and City are merged. • If there exists two rules of the form A(x) → Ω1Ω2 …Ωn and A(y) → Ψ1Ψ2…Ψn and ∀i root(Ωi )= root(Ψi ) and there exists a σ1 such that A(y)σ1 = A(x), (Ψ1Ψ2…Ψn ) σ1 = (Ω1Ω2 …Ωn ) but there does not exist a σ2 such that A(x)σ2 = A(y), (Ω1Ω2 …Ωn ) σ2 = (Ψ1Ψ2…Ψn ), then the rule “A(x) ⇒* Ω1Ω2 …Ωn ” is deleted. Example: If a grammar contains two rules of the formS(?fm ?to) → from City(?fm –) to City(- ?to) andS(?fm ?fm) → from City(?fm –) to City(- ?fm),then the rule “S(?fm ?fm) → from City(?fm –) to City(- ?fm)” is deleted. This is because every sentence that can be generated by this rule can be generated from the other rule, although the converse is not true.The merging phase continues until no more non-terminals can be merged. Once the merging phase has completed, if the number of rules or the number of non-terminals has changed, then the substitution phase is repeated; otherwise, the algorithm may continue to the unchunking phase.Step 5. (Unchunking phase)If there exists a non-terminal A in the grammar where A is not the start symbol such that there is only one rule of the form A(x) →B, then for all instances of A(y)on the right hand side of any other rule R1,i.e., R1= C(z) →D A(y) E a substitutionσ is found such that A(x)σ = A(y) and R1 is transformed to become C(z) →D BσE . The rule A(x) →B is then deleted, as well as all constituents of the form (A(y),F). Example: If there are two rules of the formX48(?fm -)→perth X49(?fm -) andX49(SCT -)→scotlandand there are no other rules with X49 on their left hand side then these rules are re-placed by the following rule:X48(SCT -)→perth scotland.The unchunking phase is continued until no-more changes can be made. If the grammar has changed during the unchunking phase then the algorithm returns to the substitution phase otherwise it continues to the catch all stage.Step 6. (Catch all stage)In this stage of the algorithm, rules are added to ensure that every sentence in the training set can be generated using the hypothesis grammar. Specifically, an emptyset of rewrite rules H2 is first created. Then if sL(x)⇐*D and D ≠ S(x), then s isparsed using a chart parser Allen [2]. If S(x)⇒*s then no action is taken otherwisethe rule S(x)→D is added to H2. At the end of the catch all stage, all rules in H2areadded to H.Step 7. (Final stage)In the final stage, rules that are unreachable from the start symbol are deleted. An algorithm for doing this can be found in Aho and Ullman [1].4. ExampleConsider the case where the Boisdale grammar is presented with the following set of training examples:{"from sydney"{ fm=SYD},"from perth"{fm=PTH},"to sydney"{to=SYD},"from perth scotland" {fm=SCT},"from perth to sydney"{fm=PTH to=SYD}}.At the completion of the alignment phase the hypothesis grammar is as follows: S(SYD -)→from sydneyS(PTH -)→from perthS(- SYD)→to sydneyS(SCT -)→from perth scotlandS(PTH SYD)→from perth to sydneyX48(SYD -)→sydneyX48(SCT -)→perth scotlandX48(PTH -)→perthX49(SCT -)→scotlandX50(PTH SYD)→perth to sydneyX51(PTH SYD)→to sydneyAt the beginning of the substitution phase, the rule “S(SYD -)→from sydney” is examined. The right hand side of this rule is reduced using a typed leftmost reduc-tion as follows from sydney L({SYD})⇐* from X48(SYD-). Because the resulting term sequence is not S(SYD-) the rule “S(SYD-)→from X48(SYD-)” is constructed. The right hand side of a rewrite rule cannot contain a constant in a signature therefore the value SYD is replaced by the variable ?fm resulting in the rule “S(?fm-)→from X48(?fm-)”. This rule is well-formed therefore it is added to the hypothesis grammar and the rule“S(SYD-) →from sydney” is deleted. The remainder of the rules are similarly examined. At the end of normalisation sub phase all constituents can be parsed using a typed leftmost reduction therefore no rules are added during the completion sub phase. At the completion of the substitution phase, the grammar is as follows: S(?fm -)→from X48(?fm -)S(?fm ?to)→S(?fm -)S(- ?to)S(- ?to)→ to X48(?to -)X48(SYD -)→sydneyX48(PTH -)→perthX48(?fm -)→perth X49(?fm -)X49(SCT -)→scotlandX50(?fm ?to)→X48(?fm -)S(- ?to).No non-terminals are merged during the merging phase. During the unchunkingphase the non-terminal X49 is unchunked. The algorithm then re-enters the substitu-tion phase, because the hypothesis grammar has changed. The algorithm then transi-tions through the merging, unchunking and catch all stage, without modifying thehypothesis grammar. During the final stage, the non-terminal X50 is deleted, and thealgorithm returns the grammar shown in Figure 1.5. Identification in the LimitA description of a class of unification grammar called Boisdale grammars can be found in Starkie and Fernau [10] along with a proof sketch that the Boisdale algo-rithm can infer the class of Boisdale grammars in the limit from positive data only. The report Starkie and Fernau [10] also contains a proof that the algorithm can exe-cute in polynomial update time with respect to the size of the training data. A basic ingredient of the identification proof is the following concept.Definition.Let C be a set of constituents. A unification grammar G minimally parses C if • the right hand side B of each constituent c i =(A(x),B) ∈ C can be reduced tothe left hand side A(x) of c using a typed leftmost reduction, i.e.,∀(A(x),B) BL(x),G⇐*A(x) and。

相关文档
最新文档