JS 的OOP 模式 还算可以模仿

 
 
/*
* Swipe 1.0
*
* Brad Birdsall, Prime
* Copyright 2011, Licensed GPL & MIT
*
*/
; window . Swipe = function ( element , options ) {
   // return immediately if element doesn't exist
   if ( ! element ) return null ;
   var _this = this ;
   // retreive options
   this . options = options || {};
   this . index = this . options . startSlide || 0 ;
   this . speed = this . options . speed || 300 ;
   this . callback = this . options . callback || function () {};
   this . delay = this . options . auto || 0 ;
   // reference dom elements
   this . container = element ;
   this . element = this . container . children [ 0 ]; // the slide pane
   // static css
   this . container . style . overflow = 'hidden' ;
   this . element . style . listStyle = 'none' ;
   this . element . style . margin = 0 ;
   // trigger slider initialization
   this . setup ();
   // begin auto slideshow
   this . begin ();
   // add event listeners
   if ( this . element . addEventListener ) {
     this . element . addEventListener ( 'touchstart' , this , false );
     this . element . addEventListener ( 'touchmove' , this , false );
     this . element . addEventListener ( 'touchend' , this , false );
     this . element . addEventListener ( 'touchcancel' , this , false );
     this . element . addEventListener ( 'webkitTransitionEnd' , this , false );
     this . element . addEventListener ( 'msTransitionEnd' , this , false );
     this . element . addEventListener ( 'oTransitionEnd' , this , false );
     this . element . addEventListener ( 'transitionend' , this , false );
     window . addEventListener ( 'resize' , this , false );
   }
};
Swipe . prototype = {
   setup : function () {
     // get and measure amt of slides
     this . slides = this . element . children ;
     this . length = this . slides . length ;
     // return immediately if their are less than two slides
     if ( this . length < 2 ) return null ;
     // determine width of each slide
     this . width = Math . ceil (( "getBoundingClientRect" in this . container ) ? this . container . getBoundingClientRect (). width : this . container . offsetWidth );
     // Fix width for Android WebView (i.e. PhoneGap)
     if ( this . width === 0 && typeof window . getComputedStyle === 'function' ) {
       this . width = window . getComputedStyle ( this . container , null ). width . replace ( 'px' , '' );
     }
     // return immediately if measurement fails
     if ( ! this . width ) return null ;
     // hide slider element but keep positioning during setup
     var origVisibility = this . container . style . visibility ;
     this . container . style . visibility = 'hidden' ;
     // dynamic css
     this . element . style . width = Math . ceil ( this . slides . length * this . width ) + 'px' ;
     var index = this . slides . length ;
     while ( index -- ) {
       var el = this . slides [ index ];
       el . style . width = this . width + 'px' ;
       el . style . display = 'table-cell' ;
       el . style . verticalAlign = 'top' ;
     }
     // set start position and force translate to remove initial flickering
     this . slide ( this . index , 0 );
     // restore the visibility of the slider element
     this . container . style . visibility = origVisibility ;
   },
   slide : function ( index , duration ) {
     var style = this . element . style ;
     // fallback to default speed
     if ( duration == undefined ) {
         duration = this . speed ;
     }
     // set duration speed (0 represents 1-to-1 scrolling)
     style . webkitTransitionDuration = style . MozTransitionDuration = style . msTransitionDuration = style . OTransitionDuration = style . transitionDuration = duration + 'ms' ;
     // translate to given index position
     style . MozTransform = style . webkitTransform = 'translate3d(' + - ( index * this . width ) + 'px,0,0)' ;
     style . msTransform = style . OTransform = 'translateX(' + - ( index * this . width ) + 'px)' ;
     // set new index to allow for expression arguments
     this . index = index ;
   },
   getPos : function () {
    
     // return current index position
     return this . index ;
   },
   prev : function ( delay ) {
     // cancel next scheduled automatic transition, if any
     this . delay = delay || 0 ;
     clearTimeout ( this . interval );
     if ( this . index ) this . slide ( this . index - 1 , this . speed ); // if not at first slide
     else this . slide ( this . length - 1 , this . speed ); //if first slide return to end
   },
   next : function ( delay ) {
     // cancel next scheduled automatic transition, if any
     this . delay = delay || 0 ;
     clearTimeout ( this . interval );
     if ( this . index < this . length - 1 ) this . slide ( this . index + 1 , this . speed ); // if not last slide
     else this . slide ( 0 , this . speed ); //if last slide return to start
   },
   begin : function () {
     var _this = this ;
     this . interval = ( this . delay )
       ? setTimeout ( function () {
         _this . next ( _this . delay );
       }, this . delay )
       : 0 ;
  
   },
  
   stop : function () {
     this . delay = 0 ;
     clearTimeout ( this . interval );
   },
  
   resume : function () {
     this . delay = this . options . auto || 0 ;
     this . begin ();
   },
   handleEvent : function ( e ) {
     switch ( e . type ) {
       case 'touchstart' : this . onTouchStart ( e ); break ;
       case 'touchmove' : this . onTouchMove ( e ); break ;
       case 'touchcancel' :
       case 'touchend' : this . onTouchEnd ( e ); break ;
       case 'webkitTransitionEnd' :
       case 'msTransitionEnd' :
       case 'oTransitionEnd' :
       case 'transitionend' : this . transitionEnd ( e ); break ;
       case 'resize' : this . setup (); break ;
     }
   },
   transitionEnd : function ( e ) {
    
     if ( this . delay ) this . begin ();
     this . callback ( e , this . index , this . slides [ this . index ]);
   },
   onTouchStart : function ( e ) {
    
     this . start = {
       // get touch coordinates for delta calculations in onTouchMove
       pageX : e . touches [ 0 ]. pageX ,
       pageY : e . touches [ 0 ]. pageY ,
       // set initial timestamp of touch sequence
       time : Number ( new Date () )
     };
     // used for testing first onTouchMove event
     this . isScrolling = undefined ;
    
     // reset deltaX
     this . deltaX = 0 ;
     // set transition time to 0 for 1-to-1 touch movement
     this . element . style . MozTransitionDuration = this . element . style . webkitTransitionDuration = 0 ;
    
     e . stopPropagation ();
   },
   onTouchMove : function ( e ) {
     // ensure swiping with one touch and not pinching
     if ( e . touches . length > 1 || e . scale && e . scale !== 1 ) return ;
     this . deltaX = e . touches [ 0 ]. pageX - this . start . pageX ;
     // determine if scrolling test has run - one time test
     if ( typeof this . isScrolling == 'undefined' ) {
       this . isScrolling = !! ( this . isScrolling || Math . abs ( this . deltaX ) < Math . abs ( e . touches [ 0 ]. pageY - this . start . pageY ) );
     }
     // if user is not trying to scroll vertically
     if ( ! this . isScrolling ) {
       // prevent native scrolling
       e . preventDefault ();
       // cancel slideshow
       clearTimeout ( this . interval );
       // increase resistance if first or last slide
       this . deltaX =
         this . deltaX /
           ( ( ! this . index && this . deltaX > 0 // if first slide and sliding left
             || this . index == this . length - 1 // or if last slide and sliding right
             && this . deltaX < 0 // and if sliding at all
           ) ?
           ( Math . abs ( this . deltaX ) / this . width + 1 ) // determine resistance level
           : 1 ); // no resistance if false
      
       // translate immediately 1-to-1
       this . element . style . MozTransform = this . element . style . webkitTransform = 'translate3d(' + ( this . deltaX - this . index * this . width ) + 'px,0,0)' ;
      
       e . stopPropagation ();
     }
   },
   onTouchEnd : function ( e ) {
     // determine if slide attempt triggers next/prev slide
     var isValidSlide =
           Number ( new Date ()) - this . start . time < 250 // if slide duration is less than 250ms
           && Math . abs ( this . deltaX ) > 20 // and if slide amt is greater than 20px
           || Math . abs ( this . deltaX ) > this . width / 2 , // or if slide amt is greater than half the width
     // determine if slide attempt is past start and end
         isPastBounds =
           ! this . index && this . deltaX > 0 // if first slide and slide amt is greater than 0
           || this . index == this . length - 1 && this . deltaX < 0 ; // or if last slide and slide amt is less than 0
     // if not scrolling vertically
     if ( ! this . isScrolling ) {
       // call slide function with slide end value based on isValidSlide and isPastBounds tests
       this . slide ( this . index + ( isValidSlide && ! isPastBounds ? ( this . deltaX < 0 ? 1 : - 1 ) : 0 ), this . speed );
     }
    
     e . stopPropagation ();
   }
};
【6层】一字型框架办公楼(含建筑结构图、计算书) 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
深度学习是机器学习的一个子领域,它基于人工神经网络的研究,特别是利用多层次的神经网络来进行学习和模式识别。深度学习模型能够学习数据的高层次特征,这些特征对于图像和语音识别、自然语言处理、医学图像分析等应用至关重要。以下是深度学习的一些关键概念和组成部分: 1. **神经网络(Neural Networks)**:深度学习的基础是人工神经网络,它是由多个层组成的网络结构,包括输入层、隐藏层和输出层。每个层由多个神经元组成,神经元之间通过权重连接。 2. **前馈神经网络(Feedforward Neural Networks)**:这是最常见的神经网络类型,信息从输入层流向隐藏层,最终到达输出层。 3. **卷积神经网络(Convolutional Neural Networks, CNNs)**:这种网络特别适合处理具有网格结构的数据,如图像。它们使用卷积层来提取图像的特征。 4. **循环神经网络(Recurrent Neural Networks, RNNs)**:这种网络能够处理序列数据,如时间序列或自然语言,因为它们具有记忆功能,能够捕捉数据中的时间依赖性。 5. **长短期记忆网络(Long Short-Term Memory, LSTM)**:LSTM 是一种特殊的 RNN,它能够学习长期依赖关系,非常适合复杂的序列预测任务。 6. **生成对抗网络(Generative Adversarial Networks, GANs)**:由两个网络组成,一个生成器和一个判别器,它们相互竞争,生成器生成数据,判别器评估数据的真实性。 7. **深度学习框架**:如 TensorFlow、Keras、PyTorch 等,这些框架提供了构建、训练和部署深度学习模型的工具和库。 8. **激活函数(Activation Functions)**:如 ReLU、Sigmoid、Tanh 等,它们在神经网络中用于添加非线性,使得网络能够学习复杂的函数。 9. **损失函数(Loss Functions)**:用于评估模型的预测与真实值之间的差异,常见的损失函数包括均方误差(MSE)、交叉熵(Cross-Entropy)等。 10. **优化算法(Optimization Algorithms)**:如梯度下降(Gradient Descent)、随机梯度下降(SGD)、Adam 等,用于更新网络权重,以最小化损失函数。 11. **正则化(Regularization)**:技术如 Dropout、L1/L2 正则化等,用于防止模型过拟合。 12. **迁移学习(Transfer Learning)**:利用在一个任务上训练好的模型来提高另一个相关任务的性能。 深度学习在许多领域都取得了显著的成就,但它也面临着一些挑战,如对大量数据的依赖、模型的解释性差、计算资源消耗大等。研究人员正在不断探索新的方法来解决这些问题。
1、资源项目源码均已通过严格测试验证,保证能够正常运行;、 2项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值